From a21694b1c6913e2d08224eb506f3dd87c44e8aca Mon Sep 17 00:00:00 2001 From: Carlos Sousa Date: Sat, 8 Mar 2025 23:17:45 +0100 Subject: [PATCH] added random local wallpaper via hyprpaper --- config/hypr/config.d/autostart.conf | 1 + config/hypr/hyprpaper.conf | 0 config/hypr/scripts/config | 4 ++++ config/hypr/scripts/random_hyprpaper.sh | 13 +++++++++++++ config/systemd/user/random_hyprpaper.service | 6 ++++++ config/systemd/user/random_hyprpaper.timer | 16 ++++++++++++++++ 6 files changed, 40 insertions(+) create mode 100644 config/hypr/hyprpaper.conf create mode 100644 config/hypr/scripts/config create mode 100755 config/hypr/scripts/random_hyprpaper.sh create mode 100644 config/systemd/user/random_hyprpaper.service create mode 100644 config/systemd/user/random_hyprpaper.timer diff --git a/config/hypr/config.d/autostart.conf b/config/hypr/config.d/autostart.conf index 0b93424..65c44f5 100644 --- a/config/hypr/config.d/autostart.conf +++ b/config/hypr/config.d/autostart.conf @@ -23,3 +23,4 @@ exec-once = syncthing --no-browser & # Wallpaper exec-once = hyprpaper +exec-once = systemctl --user start random_hyprpaper.timer diff --git a/config/hypr/hyprpaper.conf b/config/hypr/hyprpaper.conf new file mode 100644 index 0000000..e69de29 diff --git a/config/hypr/scripts/config b/config/hypr/scripts/config new file mode 100644 index 0000000..20421fd --- /dev/null +++ b/config/hypr/scripts/config @@ -0,0 +1,4 @@ +# Example for Wallpaper Directories +# All sub directories are included +#WALLPAPER_DIR="/mnt/data/Zebra/Photos/Edited" + diff --git a/config/hypr/scripts/random_hyprpaper.sh b/config/hypr/scripts/random_hyprpaper.sh new file mode 100755 index 0000000..ec07e50 --- /dev/null +++ b/config/hypr/scripts/random_hyprpaper.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env bash + +# Source the config file from the same directory as the script +SCRIPT_DIR=$(dirname "$0") +source "$SCRIPT_DIR/config" + +CURRENT_WALL=$(hyprctl hyprpaper listloaded) + +# Get a random wallpaper that is not the current one +WALLPAPER=$(find "$WALLPAPER_DIR" -type f ! -name "$(basename "$CURRENT_WALL")" | shuf -n 1) + +# Apply the selected wallpaper +hyprctl hyprpaper reload ,"$WALLPAPER" diff --git a/config/systemd/user/random_hyprpaper.service b/config/systemd/user/random_hyprpaper.service new file mode 100644 index 0000000..a542877 --- /dev/null +++ b/config/systemd/user/random_hyprpaper.service @@ -0,0 +1,6 @@ +[Unit] +Description=Set a random wallpaper with waypaper + +[Service] +Type=oneshot +ExecStart=%h/.config/hypr/scripts/random_hyprpaper.sh diff --git a/config/systemd/user/random_hyprpaper.timer b/config/systemd/user/random_hyprpaper.timer new file mode 100644 index 0000000..c69574f --- /dev/null +++ b/config/systemd/user/random_hyprpaper.timer @@ -0,0 +1,16 @@ +[Unit] +Description=Set a random wallpaper every minute + +[Timer] +Persistent=true +# Every Minute +#OnCalendar=*:0/1 + +# Every 30 Minutes +OnCalendar=*:0/30 + +# Every Hour +#OnCalendar=*:00 + +[Install] +WantedBy=timers.target