summaryrefslogtreecommitdiffstats
path: root/.local/bin
diff options
context:
space:
mode:
authorappeasementPolitik <108810900+appeasementPolitik@users.noreply.github.com>2023-08-16 13:55:59 +0000
committerGitHub <noreply@github.com>2023-08-16 13:55:59 +0000
commit44cb5f12e6c28aaada521d8b2918be9735c402c0 (patch)
tree209be883808d5c8e19dac963c6c6c9215f2cb206 /.local/bin
parentd8a8970715070f73bcb6333e3fe851b6802ac702 (diff)
downloadeibhear-44cb5f12e6c28aaada521d8b2918be9735c402c0.tar.gz
eibhear-44cb5f12e6c28aaada521d8b2918be9735c402c0.tar.zst
eibhear-44cb5f12e6c28aaada521d8b2918be9735c402c0.zip
Give setbg parameter to make notifications silent (#1350)
Diffstat (limited to '.local/bin')
-rwxr-xr-x.local/bin/setbg13
1 files changed, 10 insertions, 3 deletions
diff --git a/.local/bin/setbg b/.local/bin/setbg
index b72dc7d..c288895 100755
--- a/.local/bin/setbg
+++ b/.local/bin/setbg
@@ -13,11 +13,18 @@ bgloc="${XDG_DATA_HOME:-$HOME/.local/share}/bg"
dunstconf="${XDG_CONFIG_HOME:-$HOME/.config}/dunst/dunstrc"
zathuraconf="${XDG_CONFIG_HOME:-$HOME/.config}/zathura/zathurarc"
+# Give -s as parameter to make notifications silent.
+while getopts "s" o; do case "${o}" in
+ s) silent='1' ;;
+esac done
+
+shift $((OPTIND - 1))
+
trueloc="$(readlink -f "$1")" &&
case "$(file --mime-type -b "$trueloc")" in
- image/* ) ln -sf "$(readlink -f "$1")" "$bgloc" && notify-send -i "$bgloc" "Changing wallpaper..." ;;
- inode/directory ) ln -sf "$(find "$trueloc" -iregex '.*.\(jpg\|jpeg\|png\|gif\)' -type f | shuf -n 1)" "$bgloc" && notify-send -i "$bgloc" "Random Wallpaper chosen." ;;
- *) notify-send "🖼️ Error" "Not a valid image or directory." ; exit 1;;
+ image/* ) ln -sf "$trueloc" "$bgloc" && [ -z "$silent" ] && notify-send -i "$bgloc" "Changing wallpaper..." ;;
+ inode/directory ) ln -sf "$(find "$trueloc" -iregex '.*.\(jpg\|jpeg\|png\|gif\)' -type f | shuf -n 1)" "$bgloc" && [ -z "$silent" ] && notify-send -i "$bgloc" "Random Wallpaper chosen." ;;
+ *) [ -z "$silent" ] && notify-send "🖼️ Error" "Not a valid image or directory." ; exit 1;;
esac
# If pywal is installed, use it.