summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian T <julian@jtle.dk>2021-11-03 10:18:17 +0100
committerJulian T <julian@jtle.dk>2021-11-03 10:18:17 +0100
commitdd8e151ec5bb1914bb2a3a0af4fadce4279788b2 (patch)
treec1515ad803b747a55f9671c90182e0d151512da6
parent1a906f1cfd1db2e03f93a3f6102d66ddde4637ba (diff)
Add unset current to wallpaper script
-rwxr-xr-xscripts/Scripts/setwall18
1 files changed, 15 insertions, 3 deletions
diff --git a/scripts/Scripts/setwall b/scripts/Scripts/setwall
index 728243d..f7e3a0c 100755
--- a/scripts/Scripts/setwall
+++ b/scripts/Scripts/setwall
@@ -1,16 +1,23 @@
#!/usr/bin/env bash
-DEFPATH="$HOME/Pictures/defaultWall"
WALLFILE="$HOME/Pictures/wallconfig"
WALLLINK="$HOME/Pictures/current_wall"
BINNAME="setwall"
function unsetwalls() {
- echo unsetting $@
for wall in $@; do
- sed -i.bak "/$wall/d" $WALLFILE
+ echo unsetting $wall
+ sed -i.bak ":$wall:d" $WALLFILE
done
}
+function unsetcur() {
+ if [ -f "${WALLLINK}" ]; then
+ unsetwalls $(realpath --relative-to=$HOME $WALLLINK)
+ else
+ echo "could not resolve current wallpaper"
+ exit 1
+ fi
+}
function delete() {
echo deleting wallfile
rm $WALLFILE
@@ -57,6 +64,7 @@ function help() {
echo "unset options:"
echo " -a, --all clears wallconfig file"
echo " -d, --delete deleted wallconfig file"
+ echo " -c, --current unset currently applied wallpaper"
echo
echo "apply options:"
echo " -r, --reapply reapply last applied wallpaper"
@@ -98,6 +106,10 @@ while [[ $# -gt 0 ]]; do
delete
exit 0
;;
+ -c|--current)
+ unsetcur
+ exit 0
+ ;;
'-'*|'--'*)
unknown $key
;;