From c19620f77c1ad1172aa36107f3c212b7f1ebbcfe Mon Sep 17 00:00:00 2001 From: pagedmov Date: Sat, 26 Oct 2024 16:11:00 -0400 Subject: [PATCH] 'change wallpaper' option in toolbelt now returns to the original fzf window if escape is pressed --- modules/home/scripts/commands/toolbelt.nix | 23 ++++--------------- modules/home/scripts/default.nix | 4 +++- .../{commands => wm-controls}/chpaper.nix | 2 +- .../scripts/{nix => wm-controls}/chscheme.nix | 0 modules/sys/environment/stylix.nix | 2 +- 5 files changed, 9 insertions(+), 22 deletions(-) rename modules/home/scripts/{commands => wm-controls}/chpaper.nix (95%) rename modules/home/scripts/{nix => wm-controls}/chscheme.nix (100%) diff --git a/modules/home/scripts/commands/toolbelt.nix b/modules/home/scripts/commands/toolbelt.nix index 8954124..c9f360a 100644 --- a/modules/home/scripts/commands/toolbelt.nix +++ b/modules/home/scripts/commands/toolbelt.nix @@ -19,29 +19,14 @@ calc() { read -n 1 -s } -chpaper() { - paper="$\{self}/assets/wallpapers/$(find "$FLAKEPATH"/assets/wallpapers -exec basename {} \; | rg "\.\w+$" | fzf --preview "chafa -s 30x40 $FLAKEPATH/assets/wallpapers/{}")" - [ "$paper" = "$\{self}/assets/wallpapers/" ] && echo "Cancelling wallpaper change" && exit 0 - echo "$paper" | xargs -I {} sed -i '/wallpaper =/s|"[^"]*"|"{}"|' "$FLAKEPATH"/flake.nix - echo "Successfully changed wallpaper. Rebuild now?" && \ - select choice in "Yes" "No"; do - case $choice in - "Yes") - rebuild;pkill -9 hyprpaper;exit 0;; - "No") - echo "Exiting...";exit 0;; - esac - done -} - running=true declare -A commands=( - ["Change Wallpaper"]="chpaper" + ["Change Wallpaper"]="moveonscreen --center && if chpaper; then running=false; else moveonscreen; fi" ["Change System Color Scheme"]="hyprctl dispatch resizeactive 10% 80% && moveonscreen --center && if chscheme; then running=false; else hyprctl dispatch resizeactive exact 40% 25% && moveonscreen; fi" - ["Open System Monitor"]="hyprctl dispatch resizeactive 50% 70% moveactive onscreen cursor -50% -50%; kitty btop'" - ["Open Volume Controls"]="hyprctl dispatch exec '[float;size 50% 70%;move onscreen cursor -50% -50%] pavucontrol'" - ["Open Keyring"]="exec hyprctl dispatch exec '[float;size 25% 30%;move onscreen cursor 20 20] [ ! -f /tmp/keyringfile ] && kitty keyring'" + ["Open System Monitor"]="exec hyprctl dispatch exec '[float;size 50% 70%;move onscreen cursor -50% -50%] kitty btop'" + ["Open Volume Controls"]="exec hyprctl dispatch exec '[float;size 50% 70%;move onscreen cursor -50% -50%] pavucontrol'" + ["Open Keyring"]="hyprctl dispatch resizeactive -300 0 && moveonscreen && if keyring; then running=false; else hyprctl dispatch resizeactive exact 40% 25% && moveonscreen; fi" ["Calculator"]="calc" ) diff --git a/modules/home/scripts/default.nix b/modules/home/scripts/default.nix index d56112b..bdfebac 100644 --- a/modules/home/scripts/default.nix +++ b/modules/home/scripts/default.nix @@ -91,12 +91,14 @@ viconf = import ./commands/viconf.nix { pkgs = pkgs; }; - chscheme = import ./nix/chscheme.nix { + chscheme = import ./wm-controls/chscheme.nix { pkgs = pkgs; }; + chpaper = import ./wm-controls/chpaper.nix { pkgs = pkgs; }; in { home.packages = [ compress + chpaper chscheme keyring crs diff --git a/modules/home/scripts/commands/chpaper.nix b/modules/home/scripts/wm-controls/chpaper.nix similarity index 95% rename from modules/home/scripts/commands/chpaper.nix rename to modules/home/scripts/wm-controls/chpaper.nix index 224bfdd..6116f7e 100644 --- a/modules/home/scripts/commands/chpaper.nix +++ b/modules/home/scripts/wm-controls/chpaper.nix @@ -2,7 +2,7 @@ pkgs.writeShellScriptBin "chpaper" '' paper="$\{self}/assets/wallpapers/$(find "$FLAKEPATH"/assets/wallpapers -exec basename {} \; | rg "\.\w+$" | fzf --preview "chafa -s 30x40 $FLAKEPATH/assets/wallpapers/{}")" - [ "$paper" = "$\{self}/assets/wallpapers/" ] && echo "Cancelling wallpaper change" && exit 0 + [ "$paper" = "$\{self}/assets/wallpapers/" ] && echo "Cancelling wallpaper change" && exit 1 echo "$paper" | xargs -I {} sed -i '/wallpaper =/s|"[^"]*"|"{}"|' "$FLAKEPATH"/flake.nix echo "Successfully changed wallpaper. Rebuild now?" && \ select choice in "Yes" "No"; do diff --git a/modules/home/scripts/nix/chscheme.nix b/modules/home/scripts/wm-controls/chscheme.nix similarity index 100% rename from modules/home/scripts/nix/chscheme.nix rename to modules/home/scripts/wm-controls/chscheme.nix diff --git a/modules/sys/environment/stylix.nix b/modules/sys/environment/stylix.nix index 6d75834..0ef0fe7 100644 --- a/modules/sys/environment/stylix.nix +++ b/modules/sys/environment/stylix.nix @@ -12,7 +12,7 @@ image = wallpaper; polarity = "dark"; autoEnable = true; - opacity.terminal = 0.2; + opacity.terminal = 0.35; targets = { console.enable = true; feh.enable = true;