From dd8e151ec5bb1914bb2a3a0af4fadce4279788b2 Mon Sep 17 00:00:00 2001 From: Julian T Date: Wed, 3 Nov 2021 10:18:17 +0100 Subject: Add unset current to wallpaper script --- scripts/Scripts/setwall | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'scripts') 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 ;; -- cgit v1.2.3