about summary refs log tree commit diff stats
path: root/bin/xbg
diff options
context:
space:
mode:
authorEnsa <psychoticfervor@tuta.io>2019-12-20 00:14:09 -0800
committerEnsa <psychoticfervor@tuta.io>2019-12-20 00:14:09 -0800
commit4684d80b6271dd775cd23dabf2b91d6ce56fa33a (patch)
treeddb6c6219e213132b8500e016b1ce238aa71029d /bin/xbg
parentf733ca7c8041866df27752c8e0c2610e0ecef6a7 (diff)
downloadcfg-4684d80b6271dd775cd23dabf2b91d6ce56fa33a.tar.gz
first significant commit
see README.md for information
Diffstat (limited to 'bin/xbg')
-rwxr-xr-xbin/xbg14
1 files changed, 14 insertions, 0 deletions
diff --git a/bin/xbg b/bin/xbg
new file mode 100755
index 0000000..bde015d
--- /dev/null
+++ b/bin/xbg
@@ -0,0 +1,14 @@
+#!/bin/sh
+# checks to see if .fehbg exists. if so, sources it and exits.
+# if there is an argument, forcibly symlink it to $PICPATH and set $PICPATH to the background using xwallpaper.
+# if there is not an argument, set the wallpaper through the aforementioned method without setting the symlink.
+# $PICPATH is by default $XDG_PICTURES_DIR/bg.png, determined by xdg-user-dir if available or assumed to be ~/Pictures/bg.png if unavailable. $PICPATH can be set by the user in shrc if they wish to use a different background location.
+[ -e "$HOME/.fehbg" ]&&. "$HOME/.fehbg"&&exit
+
+if command -v xdg-user-dir >/dev/null; then
+	PICPATH=${PICPATH:="$(xdg-user-dir PICTURES)/bg.png"}
+else
+	PICPATH=${PICPATH:="$HOME/Pictures/bg.png"}
+fi
+[ -n "$1" ]&&ln -sf "$1" "$PICPATH"
+xwallpaper --zoom "$PICPATH"