Now use waypaper instead of custom bash script for setting wallpapers

This commit is contained in:
2025-05-09 01:38:13 +02:00
parent 3dd4d7b0eb
commit a862269756
4 changed files with 25 additions and 29 deletions

View File

@@ -1,26 +0,0 @@
#!/usr/bin/env bash
# You can run this script with the random parameter to select a random wallpaper
# from the active wallpaper directory. Otherwise a prompt will appear asking
# for a wallpaper
WALLPAPER_DIR="$HOME/.config/hypr/wallpapers/"
CURRENT_WALL=$(hyprctl hyprpaper listloaded)
if [[ $1 == "random" ]];then
# Get a random wallpaper that is not the current one
WALLPAPER=$(find "$WALLPAPER_DIR" -maxdepth 1 -type f ! -name "$(basename "$CURRENT_WALL")" | shuf -n 1)
else
CHOICE=$(find $WALLPAPER_DIR -maxdepth 1 -type f -printf "%f\n" | sort | rofi -dmenu -p "Wallpaper: ")
WALLPAPER="$WALLPAPER_DIR$CHOICE"
# if we quit rofi then WALLPAPER == WALLPAPER_DIR then we need to quit without
# changing the wallpaper
if [[ $WALLPAPER_DIR == $WALLPAPER ]];then
exit 0
fi
fi
# Apply the selected wallpaper
hyprctl hyprpaper reload ,"$WALLPAPER"
# set background for hyprlock
ln -sf $WALLPAPER $HOME/.config/hypr/wallpapers/background.jpg

View File

@@ -24,7 +24,7 @@ monitor=eDP-1,1920x1200,auto,1.25
exec-once = uwsm app -- waybar
exec-once= uwsm app -- /usr/lib/polkit-kde-authentication-agent-1
# select a random wallpaper
exec-once = uwsm app -- uwsm app -- sh -c '$(xdg-user-dir HOME)/.config/hypr/change_wallpaper.sh random'
exec-once = uwsm app -- uwsm app -- waypaper --state-file ~/.config/waypaper/state.ini --folder ~/.config/hypr/wallpapers --restore
exec-once = uwsm app -- dunst
exec-once = uwsm app -- batsignal -b -e -w 30 -c 20 -d 10 -f 100
exec-once = uwsm app -- nm-applet
@@ -150,7 +150,7 @@ bind = $mainMod, C, killactive,
bind = $mainMod, M, exec, uwsm stop
bind = $mainMod, E, exec, uwsm app -- nemo
bind = $mainMod, W, exec, uwsm app -- zen-browser
bind = $mainMod SHIFT, W, exec, uwsm app -- sh -c '$(xdg-user-dir HOME)/.config/hypr/change_wallpaper.sh'
bind = $mainMod SHIFT, W, exec, uwsm app -- waypaper --state-file ~/.config/waypaper/state.ini --folder ~/.config/hypr/wallpapers
bind = $mainMod, T, togglefloating,
bind = $mainMod, S, exec, uwsm app -- sh -c 'IMG=$(xdg-user-dir PICTURES)/Screenshots/$(date +'%s_grim.png') && grim $IMG && wl-copy < $IMG' # screenshot
bind = $mainMod SHIFT, S, exec, uwsm app -- sh -c 'IMG=$(xdg-user-dir PICTURES)/Screenshots/$(date +'%s_grim.png') && grim -g "$(slurp)" $IMG && wl-copy < $IMG' # screenshot only a part of the screen

View File

@@ -1,6 +1,6 @@
background {
monitor =
path = ~/.config/hypr/wallpapers/background.jpg
path = ~/.config/hypr/wallpapers/.current-background.jpg
color = rgba(25, 20, 20, 1.0)
# all these options are taken from hyprland, see https://wiki.hyprland.org/Configuring/Variables/#blur for explanations

View File

@@ -0,0 +1,22 @@
[Settings]
language = en
show_path_in_tooltip = True
backend = hyprpaper
fill = fill
sort = name
color = #ffffff
subfolders = False
all_subfolders = False
show_hidden = False
show_gifs_only = False
post_command = ln -sf $wallpaper $HOME/.config/hypr/wallpapers/.current-background.jpg
number_of_columns = 3
swww_transition_type = any
swww_transition_step = 90
swww_transition_angle = 0
swww_transition_duration = 2
swww_transition_fps = 60
mpvpaper_sound = False
mpvpaper_options =
use_xdg_state = True