'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
}
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"
)

View File

@@ -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

View File

@@ -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

View File

@@ -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;