Switch to hyprpaper

This commit is contained in:
Filippo Berto 2025-03-01 10:21:17 +01:00
parent 10534d485e
commit 8706085d15
Signed by: bertof
GPG key ID: 9DBF7E6A1D2CE9ED
2 changed files with 41 additions and 17 deletions

View file

@ -43,13 +43,23 @@ in
;
};
services.network-manager-applet.enable = true;
services.blueman-applet.enable = true;
services = {
network-manager-applet.enable = true;
blueman-applet.enable = true;
systemd.user.services.blueman-applet = {
Service = { Restart = "on-failure"; RestartSec = "3s"; };
hyprpaper = {
enable = true;
settings = {
preload = "${../../wallpapers/n8ca4obsys991.png}";
wallpaper = [ ",${../../wallpapers/n8ca4obsys991.png}" ];
};
};
};
systemd.user.services = {
blueman-applet.Service = { Restart = "on-failure"; RestartSec = "3s"; };
network-manager-applet.Service = { Restart = "on-failure"; RestartSec = "3s"; };
};
wayland.windowManager.hyprland = {
enable = true;
@ -72,7 +82,8 @@ in
"noti -t 'Hyprland' -m 'New config loaded\!'"
];
exec-once = [
"swww init"
# "swww init"
"${pkgs.hyprpaper}/bin/hyprpaper"
];
# exec-shutdown = [ ];

View file

@ -1,16 +1,29 @@
{ findutils
, gnugrep
, coreutils
, writeShellScriptBin
, swww
, hyprland
, backgrounds_directory ? "$HOME/Immagini/Sfondi/"
}: writeShellScriptBin "wl-update-background" ''
set -e
if [ $# -eq 0 ]; then
image=`${findutils}/bin/find ${backgrounds_directory} -type f | ${gnugrep}/bin/grep -v "/\." | ${coreutils}/bin/shuf -n 1`
else
image="$1"
fi
echo "image: $image"
${swww}/bin/swww img "$image"
}: writeShellScriptBin "wl-update-background"
# ''
# set -e
# if [ $# -eq 0 ]; then
# image=`${findutils}/bin/find ${backgrounds_directory} -type f | ${gnugrep}/bin/grep -v "/\." | ${coreutils}/bin/shuf -n 1`
# else
# image="$1"
# fi
# echo "image: $image"
# ${swww}/bin/swww img "$image"
# ''
''
set -euo pipefail
WALLPAPER_DIR=${backgrounds_directory}
CURRENT_WALL=$(hyprctl hyprpaper listloaded)
# Get a random wallpaper that is not the current one
WALLPAPER=$(${findutils}/bin/find "$WALLPAPER_DIR" -type f ! -name "$(${coreutils}/bin/basename "$CURRENT_WALL")" | ${coreutils}/bin/shuf -n 1)
# Apply the selected wallpaper
${hyprland}/bin/hyprctl hyprpaper reload ,"$WALLPAPER"
''