'change wallpaper' option in toolbelt now returns to the original fzf window if escape is pressed

This commit is contained in:
pagedmov
2024-10-26 16:11:00 -04:00
parent b66fbc4944
commit c19620f77c
5 changed files with 9 additions and 22 deletions

View File

@@ -19,29 +19,14 @@ calc() {
read -n 1 -s 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 running=true
declare -A commands=( 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" ["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 System Monitor"]="exec hyprctl dispatch exec '[float;size 50% 70%;move onscreen cursor -50% -50%] kitty btop'"
["Open Volume Controls"]="hyprctl dispatch exec '[float;size 50% 70%;move onscreen cursor -50% -50%] pavucontrol'" ["Open Volume Controls"]="exec 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 Keyring"]="hyprctl dispatch resizeactive -300 0 && moveonscreen && if keyring; then running=false; else hyprctl dispatch resizeactive exact 40% 25% && moveonscreen; fi"
["Calculator"]="calc" ["Calculator"]="calc"
) )

View File

@@ -91,12 +91,14 @@
viconf = import ./commands/viconf.nix { viconf = import ./commands/viconf.nix {
pkgs = pkgs; pkgs = pkgs;
}; };
chscheme = import ./nix/chscheme.nix { chscheme = import ./wm-controls/chscheme.nix {
pkgs = pkgs; pkgs = pkgs;
}; };
chpaper = import ./wm-controls/chpaper.nix { pkgs = pkgs; };
in { in {
home.packages = [ home.packages = [
compress compress
chpaper
chscheme chscheme
keyring keyring
crs crs

View File

@@ -2,7 +2,7 @@
pkgs.writeShellScriptBin "chpaper" '' 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/$(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 "$paper" | xargs -I {} sed -i '/wallpaper =/s|"[^"]*"|"{}"|' "$FLAKEPATH"/flake.nix
echo "Successfully changed wallpaper. Rebuild now?" && \ echo "Successfully changed wallpaper. Rebuild now?" && \
select choice in "Yes" "No"; do select choice in "Yes" "No"; do

View File

@@ -12,7 +12,7 @@
image = wallpaper; image = wallpaper;
polarity = "dark"; polarity = "dark";
autoEnable = true; autoEnable = true;
opacity.terminal = 0.2; opacity.terminal = 0.35;
targets = { targets = {
console.enable = true; console.enable = true;
feh.enable = true; feh.enable = true;