diff options
author | Benjamin Chausse <benjamin@chausse.xyz> | 2023-10-13 10:43:49 -0400 |
---|---|---|
committer | Benjamin Chausse <benjamin@chausse.xyz> | 2023-10-13 10:43:49 -0400 |
commit | a66988a6e884273b13a12a85ab80dd08e8a7ce4a (patch) | |
tree | da3373a6e92b203c132eeb9e61cbeca53915d710 /.local/bin/makewall | |
parent | 1d1039dfd58c3295c03f98a1890fb67f1bf98a46 (diff) |
Lots of changes
Diffstat (limited to '.local/bin/makewall')
-rwxr-xr-x | .local/bin/makewall | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/.local/bin/makewall b/.local/bin/makewall new file mode 100755 index 0000000..f0fc854 --- /dev/null +++ b/.local/bin/makewall @@ -0,0 +1,28 @@ +#!/bin/sh + +wallDir="$XDG_CONFIG_HOME/wallpapers" + +# Acquire the list of connected displays +displays=$(xrandr | grep " connected" | sed 's/^\([a-Z,0-9,-]*\).*/\1/') + +# If there is a wallpaper with a filename matching the display +# name, set it as the wallpaper for that display. +# ex: DP-1.jpg and DP-1.png are both valid filenames +# Otherwise, set the wallpaper to the default wallpaper +# (default.png or default.jpg) +setDisplay() { + case $(ls $wallDir) in + *"$1"*) + wall=$(ls $wallDir | grep "$1" | head -n 1) + xwallpaper --output $1 --zoom $wallDir/$wall ;; + *) + wall=$(ls $wallDir | grep "default" | head -n 1) + xwallpaper --output $1 --zoom $wallDir/$wall ;; + esac +} + +# Set the wallpaper for each display +for display in $displays; do + setDisplay $display +done + |