summaryrefslogtreecommitdiffstats
path: root/.local/bin/setbg
diff options
context:
space:
mode:
authorkrisdoodle45 <86745210+krisdoodle45@users.noreply.github.com>2022-02-17 18:13:14 +0100
committerGitHub <noreply@github.com>2022-02-17 18:13:14 +0100
commitc16d6fd3b04670b2ae1315cfbc5dd6b53d44d0c5 (patch)
tree21b640553e5efd77b05cb63dbb30496867ce224d /.local/bin/setbg
parent9ad912fe4eaf8c1b9c844780829aaea693c1e6de (diff)
parent82b70e3a8e3aed45998c38024e8c3e16f9680cff (diff)
downloadeibhear-c16d6fd3b04670b2ae1315cfbc5dd6b53d44d0c5.tar.gz
eibhear-c16d6fd3b04670b2ae1315cfbc5dd6b53d44d0c5.tar.zst
eibhear-c16d6fd3b04670b2ae1315cfbc5dd6b53d44d0c5.zip
Merge branch 'LukeSmithxyz:master' into patch-4
Diffstat (limited to '.local/bin/setbg')
-rwxr-xr-x.local/bin/setbg12
1 files changed, 8 insertions, 4 deletions
diff --git a/.local/bin/setbg b/.local/bin/setbg
index 7f997b7..b0938fd 100755
--- a/.local/bin/setbg
+++ b/.local/bin/setbg
@@ -9,6 +9,10 @@
# Location of link to wallpaper link.
bgloc="${XDG_DATA_HOME:-$HOME/.local/share/}/bg"
+# Configuration files of applications that have their themes changed by pywal.
+dunstconf="${XDG_CONFIG_HOME:-$HOME/.config}/dunst/dunstrc"
+zathuraconf="${XDG_CONFIG_HOME:-$HOME/.config}/zathura/zathurarc"
+
trueloc="$(readlink -f "$1")" &&
case "$(file --mime-type -b "$trueloc")" in
image/* ) ln -sf "$(readlink -f "$1")" "$bgloc" && notify-send -i "$bgloc" "Changing wallpaper..." ;;
@@ -18,12 +22,12 @@ esac
# If pywal is installed, use it.
if command -v wal >/dev/null 2>&1 ; then
- wal -i "$(readlink -f $bgloc)" -o "${XDG_CONFIG_HOME:-$HOME/.config}/wal/postrun" >/dev/null 2>&1 &&
- pidof dwm >/dev/null && xdotool key super+F12
+ wal -i "$(readlink -f $bgloc)" -o "${XDG_CONFIG_HOME:-$HOME/.config}/wal/postrun" >/dev/null 2>&1 &&
+ pidof dwm >/dev/null && xdotool key super+F12
# If pywal is removed, return config files to normal.
else
- [ -f "${XDG_CONFIG_HOME:-$HOME/.config}/dunst/dunstrc.bak" ] && unlink "${XDG_CONFIG_HOME:-$HOME/.config}/dunst/dunstrc" && mv "${XDG_CONFIG_HOME:-$HOME/.config}/dunst/dunstrc.bak" "${XDG_CONFIG_HOME:-$HOME/.config}/dunst/dunstrc"
- [ -f "${XDG_CONFIG_HOME:-$HOME/.config}/zathura/zathurarc.bak" ] && unlink "${XDG_CONFIG_HOME:-$HOME/.config}/zathura/zathurarc" && mv "${XDG_CONFIG_HOME:-$HOME/.config}/zathura/zathurarc.bak" "${XDG_CONFIG_HOME:-$HOME/.config}/zathura/zathurarc"
+ [ -f "$dunstconf.bak" ] && unlink "$dunstconf" && mv "$dunstconf.bak" "$dunstconf"
+ [ -f "$zathuraconf.bak" ] && unlink "$zathuraconf" && mv "$zathuraconf.bak" "$zathuraconf"
fi
xwallpaper --zoom "$bgloc"