add: wallpaper changer
This commit is contained in:
@@ -5,6 +5,15 @@
|
|||||||
"float, class:^(org\.hakase\.popup\..*)$"
|
"float, class:^(org\.hakase\.popup\..*)$"
|
||||||
"animation slide right, class:^(org\.hakase\.popup\..*)$"
|
"animation slide right, class:^(org\.hakase\.popup\..*)$"
|
||||||
"dimaround, 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
|
# Prevent Firefox and Terminal from stealing focus on launch
|
||||||
"suppressevent activate, workspace:20"
|
"suppressevent activate, workspace:20"
|
||||||
|
|||||||
@@ -1,17 +1,35 @@
|
|||||||
{pkgs, ...}: {
|
{pkgs, ...}: {
|
||||||
home.packages = with 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)
|
tmp_file=$(mktemp)
|
||||||
target_dir="$HOME/.config/nixos/assets/Wallpapers"
|
target_dir="$HOME/.config/nixos/assets/Wallpapers"
|
||||||
if [ ! -d "$target_dir" ]; then
|
if [ ! -d "$target_dir" ]; then
|
||||||
target_dir="$HOME"
|
target_dir="$HOME"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Ensure we are in a terminal that supports yazi
|
||||||
${pkgs.yazi}/bin/yazi "$target_dir" --chooser-file="$tmp_file"
|
${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")
|
WALLPAPER=$(cat "$tmp_file")
|
||||||
rm -f "$tmp_file"
|
rm -f "$tmp_file"
|
||||||
|
|
||||||
if [ -z "$WALLPAPER" ]; then
|
if [ -z "$WALLPAPER" ]; then
|
||||||
|
echo "No wallpaper selected."
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -20,7 +38,7 @@
|
|||||||
${pkgs.hyprland}/bin/hyprctl hyprpaper preload "$WALLPAPER"
|
${pkgs.hyprland}/bin/hyprctl hyprpaper preload "$WALLPAPER"
|
||||||
${pkgs.hyprland}/bin/hyprctl hyprpaper wallpaper ",$WALLPAPER"
|
${pkgs.hyprland}/bin/hyprctl hyprpaper wallpaper ",$WALLPAPER"
|
||||||
|
|
||||||
exec matugen image $WALLPAPER
|
exec matugen image "$WALLPAPER"
|
||||||
'')
|
'')
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user