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 = {
services.blueman-applet.enable = true; network-manager-applet.enable = true;
blueman-applet.enable = true;
systemd.user.services.blueman-applet = { hyprpaper = {
Service = { Restart = "on-failure"; RestartSec = "3s"; }; 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 = { wayland.windowManager.hyprland = {
enable = true; enable = true;
@ -72,7 +82,8 @@ in
"noti -t 'Hyprland' -m 'New config loaded\!'" "noti -t 'Hyprland' -m 'New config loaded\!'"
]; ];
exec-once = [ exec-once = [
"swww init" # "swww init"
"${pkgs.hyprpaper}/bin/hyprpaper"
]; ];
# exec-shutdown = [ ]; # exec-shutdown = [ ];

View file

@ -1,16 +1,29 @@
{ findutils { findutils
, gnugrep
, coreutils , coreutils
, writeShellScriptBin , writeShellScriptBin
, swww , hyprland
, backgrounds_directory ? "$HOME/Immagini/Sfondi/" , backgrounds_directory ? "$HOME/Immagini/Sfondi/"
}: writeShellScriptBin "wl-update-background" '' }: 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` # set -e
else # if [ $# -eq 0 ]; then
image="$1" # image=`${findutils}/bin/find ${backgrounds_directory} -type f | ${gnugrep}/bin/grep -v "/\." | ${coreutils}/bin/shuf -n 1`
fi # else
echo "image: $image" # image="$1"
${swww}/bin/swww img "$image" # 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"
''