Set wallpaper in sway

This commit is contained in:
Rodolphe Bréard 2020-12-21 18:32:41 +01:00
parent d31f971717
commit ad890cc43f
3 changed files with 20 additions and 2 deletions

View file

@ -22,7 +22,9 @@ set $menu dmenu_path | dmenu | xargs swaymsg exec
### Output configuration ### Output configuration
# #
# Default wallpaper (more resolutions are available in /usr/share/backgrounds/sway/) # Default wallpaper (more resolutions are available in /usr/share/backgrounds/sway/)
output * bg /usr/share/backgrounds/sway/Sway_Wallpaper_Blue_1920x1080.png fill # output * bg /usr/share/backgrounds/sway/Sway_Wallpaper_Blue_1920x1080.png fill
exec_always set_wallpaper sway
# #
# Example configuration: # Example configuration:
# #

View file

@ -7,4 +7,4 @@
hash xcompmgr 2>/dev/null && xcompmgr & hash xcompmgr 2>/dev/null && xcompmgr &
hash xscreensaver 2>/dev/null && xscreensaver -no-splash & hash xscreensaver 2>/dev/null && xscreensaver -no-splash &
hash gpg-agent 2>/dev/null && eval $(gpg-agent --daemon --enable-ssh-support) hash gpg-agent 2>/dev/null && eval $(gpg-agent --daemon --enable-ssh-support)
hash feh 2>/dev/null && feh --bg-scale "$(find 'pictures/wallpapers/enabled/' -type l -print | shuf | head -n 1)" hash set_wallpaper 2>/dev/null && set_wallpaper feh

16
bin/set_wallpaper Executable file
View file

@ -0,0 +1,16 @@
#!/bin/sh
set -euo pipefail
IFS=$'\n\t'
WALLPAPER_DIRECTORY="$HOME/pictures/wallpapers/enabled"
WALLPAPER_FILE="$(find "$WALLPAPER_DIRECTORY" -type l -print | shuf | head -n 1)"
case "$1" in
sway)
swaymsg --quiet output "*" bg "$WALLPAPER_FILE" fill
;;
*)
hash feh 2>/dev/null && feh --bg-scale "$WALLPAPER_FILE"
;;
esac