improve: hakase-wallpaper-switch
This commit is contained in:
@@ -6,13 +6,13 @@
|
||||
"animation slide right, class:^(org\.hakase\.popup\..*)$"
|
||||
"dimaround, class:^(org\.hakase\.popup\..*)$"
|
||||
# --- WALLPAPER PICKER ---
|
||||
"float, class:^(wallpaper-selector)$"
|
||||
"float, class:^(org\.hakase\.switch-wallpaper)$"
|
||||
"float, initialTitle:^(Wallpaper Selector)$"
|
||||
"center, class:^(wallpaper-selector)$"
|
||||
"center, class:^(org\.hakase\.switch-wallpaper)$"
|
||||
"center, initialTitle:^(Wallpaper Selector)$"
|
||||
"size 60% 60%, class:^(wallpaper-selector)$"
|
||||
"size 60% 60%, class:^(org\.hakase\.switch-wallpaper)$"
|
||||
"size 60% 60%, initialTitle:^(Wallpaper Selector)$"
|
||||
"dimaround, class:^(wallpaper-selector)$"
|
||||
"dimaround, class:^(org\.hakase\.switch-wallpaper)$"
|
||||
"dimaround, initialTitle:^(Wallpaper Selector)$"
|
||||
|
||||
# Prevent Firefox and Terminal from stealing focus on launch
|
||||
|
||||
+29
-6
@@ -1,12 +1,35 @@
|
||||
{myConfig, ...}: {
|
||||
{
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
myConfig,
|
||||
...
|
||||
}: let
|
||||
wallpaperDir = "${config.home.homeDirectory}/.config/nixos/assets/Wallpapers";
|
||||
defaultWallpaper = "${wallpaperDir}/${myConfig.hyprland.wallpaper}";
|
||||
cacheWallpaper = "${config.home.homeDirectory}/.cache/current_wallpaper";
|
||||
in {
|
||||
services.hyprpaper = {
|
||||
enable = true;
|
||||
settings = {
|
||||
# preload = ["../../assets/Wallpapers/${myConfig.hyprland.wallpaper}"];
|
||||
# wallpaper = [
|
||||
# "HDMI-A-1,../../assets/Wallpapers/${myConfig.hyprland.wallpaper}"
|
||||
# ];
|
||||
preload = [cacheWallpaper];
|
||||
wallpaper = [
|
||||
",${cacheWallpaper}"
|
||||
];
|
||||
};
|
||||
};
|
||||
# systemd.user.startServices = "sd-switch";
|
||||
|
||||
home.activation.setupWallpaper = lib.hm.dag.entryAfter ["writeBoundary"] ''
|
||||
if [ ! -f "${cacheWallpaper}" ]; then
|
||||
mkdir -p "$(dirname "${cacheWallpaper}")"
|
||||
if [ -f "${defaultWallpaper}" ]; then
|
||||
cp "${defaultWallpaper}" "${cacheWallpaper}"
|
||||
else
|
||||
echo "Default wallpaper not found at ${defaultWallpaper}"
|
||||
touch "${cacheWallpaper}"
|
||||
fi
|
||||
fi
|
||||
'';
|
||||
|
||||
systemd.user.startServices = "sd-switch";
|
||||
}
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
(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...'"
|
||||
ghostty --class="org.hakase.switch-wallpaper" --title="Wallpaper Selector" -e bash -c "hakase-wallpaper-switch 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...'"
|
||||
kitty --class org.hakase.switch-wallpaper --title "Wallpaper Selector" -e bash -c "hakase-wallpaper-switch run || read -p 'Hit Enter to close...'"
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
@@ -33,12 +33,17 @@
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# ${pkgs.hyprland}/bin/hyprctl hyprpaper unload all
|
||||
# Persistence logic
|
||||
CACHE_FILE="$HOME/.cache/current_wallpaper"
|
||||
cp "$WALLPAPER" "$CACHE_FILE"
|
||||
|
||||
${pkgs.hyprland}/bin/hyprctl hyprpaper preload "$WALLPAPER"
|
||||
${pkgs.hyprland}/bin/hyprctl hyprpaper wallpaper ",$WALLPAPER"
|
||||
# Reload hyprpaper
|
||||
${pkgs.hyprland}/bin/hyprctl hyprpaper unload all
|
||||
${pkgs.hyprland}/bin/hyprctl hyprpaper preload "$CACHE_FILE"
|
||||
${pkgs.hyprland}/bin/hyprctl hyprpaper wallpaper ",$CACHE_FILE"
|
||||
|
||||
exec matugen image "$WALLPAPER"
|
||||
exec matugen image "$CACHE_FILE"
|
||||
'')
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user