blob: 7a2b28c3f378cc7270184132391c476a189fbb9d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
#!/usr/bin/env bash
function hc () { herbstclient "$@"; }
function random-wallpaper() {
local rootinfo=$(xwininfo -root)
local width=$(echo $rootinfo | grep 'Width:' | sed 's/.*Width: \([[:digit:]]\+\).*/\1/')
local height=$(echo $rootinfo | grep 'Height:' | sed 's/.*Height: \([[:digit:]]\+\).*/\1/')
find ~/pictures/wallpaper -type f \
\( -wholename "*/${width}x${height}/*" -o -wholename '*/patterns/*' \) \
-not -name '*.org' \
| shuf -n 1
}
wallpaper=$(random-wallpaper)
if ! hc attr my_wallpaper >/dev/null 2>&1
then hc new_attr string my_wallpaper
fi
feh --bg-tile "$wallpaper" && hc set_attr my_wallpaper "$wallpaper"
|