add: wallpaper changer

This commit is contained in:
kenji
2025-12-27 20:09:43 -06:00
parent f8cdd03c17
commit 7d04d1d840
2 changed files with 29 additions and 2 deletions
+9
View File
@@ -5,6 +5,15 @@
"float, class:^(org\.hakase\.popup\..*)$"
"animation slide right, class:^(org\.hakase\.popup\..*)$"
"dimaround, class:^(org\.hakase\.popup\..*)$"
# --- WALLPAPER PICKER ---
"float, class:^(wallpaper-selector)$"
"float, initialTitle:^(Wallpaper Selector)$"
"center, class:^(wallpaper-selector)$"
"center, initialTitle:^(Wallpaper Selector)$"
"size 60% 60%, class:^(wallpaper-selector)$"
"size 60% 60%, initialTitle:^(Wallpaper Selector)$"
"dimaround, class:^(wallpaper-selector)$"
"dimaround, initialTitle:^(Wallpaper Selector)$"
# Prevent Firefox and Terminal from stealing focus on launch
"suppressevent activate, workspace:20"
+20 -2
View File
@@ -1,17 +1,35 @@
{pkgs, ...}: {
home.packages = with pkgs; [
(writeShellScriptBin "switch-wallpaper" ''
(writeShellScriptBin "hakase-wallpaper-switch" ''
if [[ "$1" != "run" ]]; then
if command -v ghostty &> /dev/null; then
ghostty --class="wallpaper-selector" --title="Wallpaper Selector" -e bash -c "switch-wallpaper run || read -p 'Hit Enter to close...'"
exit 0
elif command -v kitty &> /dev/null; then
kitty --class wallpaper-selector --title "Wallpaper Selector" -e bash -c "switch-wallpaper run || read -p 'Hit Enter to close...'"
exit 0
fi
fi
tmp_file=$(mktemp)
target_dir="$HOME/.config/nixos/assets/Wallpapers"
if [ ! -d "$target_dir" ]; then
target_dir="$HOME"
fi
# Ensure we are in a terminal that supports yazi
${pkgs.yazi}/bin/yazi "$target_dir" --chooser-file="$tmp_file"
if [ ! -f "$tmp_file" ]; then
echo "No selection file created."
exit 1
fi
WALLPAPER=$(cat "$tmp_file")
rm -f "$tmp_file"
if [ -z "$WALLPAPER" ]; then
echo "No wallpaper selected."
exit 0
fi
@@ -20,7 +38,7 @@
${pkgs.hyprland}/bin/hyprctl hyprpaper preload "$WALLPAPER"
${pkgs.hyprland}/bin/hyprctl hyprpaper wallpaper ",$WALLPAPER"
exec matugen image $WALLPAPER
exec matugen image "$WALLPAPER"
'')
];
}