commit 1c2ba4e58aec3c003d02c6b7bb2ccc2eb89db4d0 parent 0748eb5a43a47be352cb0ae3d4855196bffd9d2c Author: Markus Hanetzok <markus@hanetzok.net> Date: Mon, 6 Oct 2025 14:41:02 +0200 add wallpaper script Diffstat:
A | .local/bin/setwallpaper | | | 19 | +++++++++++++++++++ |
1 file changed, 19 insertions(+), 0 deletions(-)
diff --git a/.local/bin/setwallpaper b/.local/bin/setwallpaper @@ -0,0 +1,19 @@ +#!/bin/bash + +bgfile="$1" +wplocation="$XDG_DATA_HOME"/wallpaper + +setbg() { + dpwidth="$(xrandr | grep '*' | awk '{print $1}' | sed 's/\(.*\)x.*/\1/')" + imgwidth="$(LANG=C exiv2 -q $1 | grep "Image size" | awk '{print $4$5$6}' | sed 's/\(.*\)x.*/\1/')" + if [ "$dpwidth" -gt "$imgwidth" ]; then + xwallpaper --center $wplocation + else + xwallpaper --zoom $wplocation + fi +} + +[[ ! -z "$bgfile" ]] && [[ -f "$bgfile" ]] && cp -f "$bgfile" "$wplocation" +[[ -f "$wplocation" ]] || { notify-send "No wallpaper file found!"; exit 1; } + +setbg $wplocation