aboutsummaryrefslogtreecommitdiffstats
path: root/herbstluftwm
diff options
context:
space:
mode:
authorGravatar Tom Willemse2021-11-06 01:05:20 -0700
committerGravatar Tom Willemse2021-11-06 01:05:20 -0700
commit3f26b4d1388ec8fd88e691113e0eee757c853be9 (patch)
treeea778ed3a9f2b89116f89f139f66084ef76da14d /herbstluftwm
parentb45249f00b70c67ce848d6981bf38c87117e3f5e (diff)
downloadnew-dotfiles-3f26b4d1388ec8fd88e691113e0eee757c853be9.tar.gz
new-dotfiles-3f26b4d1388ec8fd88e691113e0eee757c853be9.zip
[herbstluftwm] Update ‘random-wallpaper’ to use screen size
Instead of assuming that the screen is 3840x1080, check the size of the ‘root’ window.
Diffstat (limited to 'herbstluftwm')
-rwxr-xr-xherbstluftwm/.config/herbstluftwm/autostart8
1 files changed, 6 insertions, 2 deletions
diff --git a/herbstluftwm/.config/herbstluftwm/autostart b/herbstluftwm/.config/herbstluftwm/autostart
index bf011cd..d3709a1 100755
--- a/herbstluftwm/.config/herbstluftwm/autostart
+++ b/herbstluftwm/.config/herbstluftwm/autostart
@@ -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
}