From 3a8b8f8504927c00ea0b4eefae8428b96bea6e42 Mon Sep 17 00:00:00 2001 From: Nikolai Papin Date: Fri, 4 Jul 2025 00:31:01 +0300 Subject: [PATCH] feat: random wallpapers --- hypr/hyprland.conf | 11 +++++++---- hypr/hyprpaper.conf | 7 +++---- hypr/scripts/random_wallpaper.sh | 32 ++++++++++++++++++++++++++++++++ 3 files changed, 42 insertions(+), 8 deletions(-) create mode 100755 hypr/scripts/random_wallpaper.sh diff --git a/hypr/hyprland.conf b/hypr/hyprland.conf index 9078ee1..f6fe8c2 100644 --- a/hypr/hyprland.conf +++ b/hypr/hyprland.conf @@ -27,9 +27,12 @@ $privateBrowser = zen-browser --private-window # Autostart necessary processes (like notifications daemons, status bars, etc.) # Or execute your favorite apps at launch like this: -exec-once = waybar & hyprpaper & hypridle & -exec-once = systemctl --user startexec-once=dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP hyprpaper.service -exec-once = hyprsunset +# Le essential hyprland crap +exec-once = hyprpaper & waybar & hypridle & hyprsunset & +exec-once = sleep 1 && ~/.config/hypr/scripts/random_wallpaper.sh + + +# exec-once = systemctl --user startexec-once=dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP hyprpaper.service exec-once = libinput-gestures exec-once = copyq --start-server exec-once = /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1 & @@ -85,7 +88,7 @@ general { border_size = 3 # https://wiki.hyprland.org/Configuring/Variables/#variable-types for info about colors - col.active_border = rgba(E96375ff) rgba(EB75DDff) 45deg + col.active_border = rgba(E96375ff) rgba(9E2238ff) 45deg col.inactive_border = rgba(4B535Bff) # rgba(595959aa) # Set to true enable resizing windows by clicking and dragging on borders and gaps diff --git a/hypr/hyprpaper.conf b/hypr/hyprpaper.conf index 7c87514..68e9a49 100644 --- a/hypr/hyprpaper.conf +++ b/hypr/hyprpaper.conf @@ -1,5 +1,4 @@ -preload = /home/greg/Pictures/Wallpapers/art-sakura-sea-volcano-pink.jpg -wallpaper = eDP-1,/home/greg/Pictures/Wallpapers/art-sakura-sea-volcano-pink.jpg -wallpaper = HDMI-A-1,/home/greg/Pictures/Wallpapers/art-sakura-sea-volcano-pink.jpg -ipc = off +wallpaper = eDP-1,/home/greg/Pictures/Wallpapers/japanese-seashore-house-fullmoon-pink.jpeg +wallpaper = HDMI-A-1,/home/greg/Pictures/Wallpapers/japanese-seashore-house-fullmoon-pink.jpeg +ipc = on diff --git a/hypr/scripts/random_wallpaper.sh b/hypr/scripts/random_wallpaper.sh new file mode 100755 index 0000000..5b9e8ea --- /dev/null +++ b/hypr/scripts/random_wallpaper.sh @@ -0,0 +1,32 @@ +#!/usr/bin/env bash + +WALLPAPER_DIR="$HOME/Pictures/Wallpapers/current/" +DELAY=5m + +random_wallpaper() { + # Check if folder is not empty + if [ -z "$(ls -A "$WALLPAPER_DIR")" ]; then + echo "Current wallpaper folder is empty, nothing to do" + exit 0 + fi + + CURRENT_WALL=$(hyprctl hyprpaper listloaded) + + # Get a random wallpaper that is not the current one + WALLPAPER=$(find "$WALLPAPER_DIR" -type l ! -name "$(basename "$CURRENT_WALL")" | shuf -n 1) + + # Apply the selected wallpaper + hyprctl hyprpaper unload all + hyprctl hyprpaper reload ,"$WALLPAPER" + + echo "Set random wallpaper to $WALLPAPER" +} + +loop() { + while true; do + random_wallpaper + sleep "$DELAY" + done +} + +loop