[herbstluftwm] Update ‘random-wallpaper’ to use screen size
Instead of assuming that the screen is 3840x1080, check the size of the ‘root’ window.
This commit is contained in:
parent
b45249f00b
commit
3f26b4d138
1 changed files with 6 additions and 2 deletions
|
@ -11,8 +11,12 @@ function hc() { herbstclient "$@"; }
|
|||
|
||||
# This function picks a random wallpaper from a list collection.
|
||||
function random-wallpaper() {
|
||||
find ~/pictures/wallpapers -type f \
|
||||
-wholename '*/3840x1080/*' -o -wholename '*/patterns/*' \
|
||||
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/*' \
|
||||
| shuf -n 1
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue