This commit is contained in:
Hadi
2024-10-07 11:17:59 +02:00
parent ab65fe342b
commit 75f2c2c7c6
20 changed files with 289 additions and 157 deletions

View File

@@ -62,7 +62,7 @@
}
{
key = "<leader>E";
action = "<cmd>Neotree<cr>";
action = "<cmd>Neotree toggle<cr>";
options.desc = "Neotree";
}

View File

@@ -1,3 +1,12 @@
# - ## Brightness
#-
#- This module provides a set of scripts to control the brightness of the screen.
#-
#- - `brightness-up` increases the brightness by 5%.
#- - `brightness-down` decreases the brightness by 5%.
#- - `brightness-set [value]` sets the brightness to the given value.
#- - `brightness-change [up|down] [value]` increases or decreases the brightness by the given value.
{ pkgs, ... }:
let

View File

@@ -1,3 +1,11 @@
# - ## Caffeine
#-
#- Caffeine is a simple script that toggles hypridle (disable suspend & screenlock).
#-
#- - `caffeine-status` - Check if hypridle is running. (0/1)
#- - `caffeine-status-icon` - Check if hypridle is running. (icon)
#- - `caffeine` - Toggle hypridle.
{ pkgs, ... }:
let
caffeine-status = pkgs.writeShellScriptBin "caffeine-status" ''

View File

@@ -1,3 +1,11 @@
# - ## Hyprfocus
#-
#- A simple script to toggle focus on few windows in Hyprland.
#- (disable gaps, border, shadow, opacity, etc.)
#-
#- - `hyprfocus-on` - Enable hyprfocus.
#- - `hyprfocus-off` - Disable hyprfocus.
#- - `hyprfocus-toggle` - Toggle hyprfocus.
{ pkgs, ... }:
let
hyprfocus-on = pkgs.writeShellScriptBin "hyprfocus-on"

View File

@@ -1,3 +1,10 @@
# - ## Hyprpanel
#-
#- Quick scripts to toggle, reload and kill hyprpanel.
#-
#- - `hyprpanel-toggle` - Toggle hyprpanel.
#- - `hyprpanel-reload` - Reload hyprpanel.
#- - `hyprpanel-kill` - Kill hyprpanel.
{ pkgs, ... }:
let
hyprpanel-toggle = pkgs.writeShellScriptBin "hyprpanel-toggle" ''

View File

@@ -1,3 +1,8 @@
# - ## Nerdfont FZF
#-
#- This module provides a script to search for Nerd Fonts icons using fzf.
#-
#- - `nerdfont-fzf` - Search for Nerd Fonts icons using fzf.
{ pkgs, config, ... }:
let
homedir = config.home.homeDirectory;

View File

@@ -1,3 +1,12 @@
# - ## Night-Shift
#-
#- Night-Shift is a feature that reduces the amount of blue light emitted by your screen, which can help reduce eye strain and improve sleep quality. This module provides a set of scripts to control Night-Shift on your system.
#-
#- - `night-shift-on` activates Night-Shift.
#- - `night-shift-off` deactivates Night-Shift.
#- - `night-shift` toggles Night-Shift.
#- - `night-shift-status` checks if Night-Shift is active. (0/1)
#- - `night-shift-status-icon` checks if Night-Shift is active. (icon)
{ pkgs, ... }:
let

View File

@@ -1,55 +1,65 @@
# - ## Nixy
#-
#- Nixy is a simple script that I use to manage my NixOS system. It's a simple script that provides a menu to rebuild, upgrade, update, collect garbage, clean boot menu, etc.
#-
#- - `nixy` - UI wizard to manage the system.
#- - `nixy rebuild` - Rebuild the system.
#- - `nixy ...` - ... see the script for more commands.
{ pkgs, config, ... }:
let
nixy = pkgs.writeShellScriptBin "nixy" ''
function exec() {
$@
}
nixy = pkgs.writeShellScriptBin "nixy"
# bash
''
function exec() {
$@
}
function ui(){
DEFAULT_ICON="󰘳"
function ui(){
DEFAULT_ICON="󰘳"
# "icon;name;command"[]
apps=(
";Rebuild;nixy rebuild"
";Upgrade;nixy upgrade"
";Update;nixy update"
";Collect Garbage;nixy gc"
";Clean Boot Menu;nixy cb"
)
# "icon;name;command"[]
apps=(
"󰑓;Rebuild;nixy rebuild"
"󰦗;Upgrade;nixy upgrade"
"󰚰;Update;nixy update"
";Collect Garbage;nixy gc"
"󰍜;Clean Boot Menu;nixy cb"
" ;Hyprland Keybindings;nvim ${config.var.configDirectory}/docs/KEYBINDINGS-HYPRLAND.md"
)
# Apply default icons if empty:
for i in "''${!apps[@]}"; do
apps[i]=$(echo "''${apps[i]}" | sed 's/^;/'$DEFAULT_ICON';/')
done
# Apply default icons if empty:
for i in "''${!apps[@]}"; do
apps[i]=$(echo "''${apps[i]}" | sed 's/^;/'$DEFAULT_ICON';/')
done
fzf_result=$(printf "%s\n" "''${apps[@]}" | awk -F ';' '{print $1" "$2}' | fzf)
[[ -z $fzf_result ]] && exit 0
fzf_result=''${fzf_result/ /;}
line=$(printf "%s\n" "''${apps[@]}" | grep "$fzf_result")
command=$(echo "$line" | sed 's/^[^;]*;//;s/^[^;]*;//')
fzf_result=$(printf "%s\n" "''${apps[@]}" | awk -F ';' '{print $1" "$2}' | fzf)
[[ -z $fzf_result ]] && exit 0
fzf_result=''${fzf_result/ /;}
line=$(printf "%s\n" "''${apps[@]}" | grep "$fzf_result")
command=$(echo "$line" | sed 's/^[^;]*;//;s/^[^;]*;//')
exec "$command"
exit 0
}
exec "$command"
exit 0
}
[[ $1 == "" ]] && ui
[[ $1 == "" ]] && ui
if [[ $1 == "rebuild" ]];then
sudo nixos-rebuild switch --flake ${config.var.configDirectory}#${config.var.hostname}
elif [[ $1 == "upgrade" ]];then
sudo nixos-rebuild switch --upgrade --flake ${config.var.configDirectory}#${config.var.hostname}
elif [[ $1 == "update" ]];then
cd ${config.var.configDirectory} && nix flake update
elif [[ $1 == "gc" ]];then
cd ${config.var.configDirectory} && sudo nix-collect-garbage -d
elif [[ $1 == "cb" ]];then
sudo /run/current-system/bin/switch-to-configuration boot
elif [[ $1 == "remote" ]];then
cd ~/.config/nixos && git add . && git commit -m "update" && git push
ssh jack -S -C "cd /home/hadi/.config/nixos && git pull && sudo -S nixos-rebuild switch --flake ~/.config/nixos#jack"
else
echo "Unknown argument"
fi
'';
if [[ $1 == "rebuild" ]];then
sudo nixos-rebuild switch --flake ${config.var.configDirectory}#${config.var.hostname}
elif [[ $1 == "upgrade" ]];then
sudo nixos-rebuild switch --upgrade --flake ${config.var.configDirectory}#${config.var.hostname}
elif [[ $1 == "update" ]];then
cd ${config.var.configDirectory} && nix flake update
elif [[ $1 == "gc" ]];then
cd ${config.var.configDirectory} && sudo nix-collect-garbage -d
elif [[ $1 == "cb" ]];then
sudo /run/current-system/bin/switch-to-configuration boot
elif [[ $1 == "remote" ]];then
cd ~/.config/nixos && git add . && git commit -m "update" && git push
ssh jack -S -C "cd /home/hadi/.config/nixos && git pull && sudo -S nixos-rebuild switch --flake ~/.config/nixos#jack"
else
echo "Unknown argument"
fi
'';
in { home.packages = [ nixy ]; }

View File

@@ -1,5 +1,9 @@
# - ## Screenshot
#-
#- This module provides a script to take screenshots using `hyprshot` and `swappy`.
#-
#- - `screenshot [region|window|monitor] [swappy]` - Take a screenshot of the region, window, or monitor. Optionally, use `swappy` to copy the screenshot to the clipboard.
{ pkgs, ... }:
let
screenshot = pkgs.writeShellScriptBin "screenshot" ''
if [[ $2 == "swappy" ]];then

View File

@@ -1,3 +1,11 @@
# - ## Sound
#-
#- This module provides a set of scripts to control the volume of the default audio sink using `wpctl`.
#-
#- - `sound-up` increases the volume by 5%.
#- - `sound-down` decreases the volume by 5%.
#- - `sound-set [value]` sets the volume to the given value.
#- - `sound-toggle` toggles the mute state of the default audio sink.
{ pkgs, ... }:
let

View File

@@ -1,3 +1,10 @@
# - ## System
#-
#- Usefull quick scripts
#-
#- - `menu` - Open wofi with drun mode.
#- - `powermenu` - Open power dropdown menu.
#- - `lock` - Lock the screen.
{ pkgs, ... }:
let