diff options
author | Julian T <julian@jtle.dk> | 2020-05-27 19:02:06 +0200 |
---|---|---|
committer | Julian T <julian@jtle.dk> | 2020-05-27 19:17:47 +0200 |
commit | b1ca6e75e07e067ff44947f18415974fcfdb0e05 (patch) | |
tree | 06742b4ef3aec2d86a63aca9a66563a96bea41e8 /scripts | |
parent | 05b5a55e01683fa7d2b47327143073d539ecd735 (diff) |
Added cool setwall script
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/Scripts/setwall | 66 |
1 files changed, 65 insertions, 1 deletions
diff --git a/scripts/Scripts/setwall b/scripts/Scripts/setwall index cb47f61..b9e2754 100755 --- a/scripts/Scripts/setwall +++ b/scripts/Scripts/setwall @@ -1,3 +1,67 @@ #!/usr/bin/env bash -feh --bg-fill Pictures/defaultWall.* +DEFPATH="$HOME/Pictures/defaultWall" +BINNAME="setwall" + +function unsetwall() { + rm ${DEFPATH}.* +} + +function setwall() { + feh --bg-fill $1 +} + +function help() { + echo "Wallpaper mangement script" + echo + echo "Syntax: ${BINNAME} OPTIONS" + echo "options:" + echo " -r, --refresh reapply the wallpaper" + echo " -u, --unset unset the current wallpaper" + echo " -s PATH, --set PATH set a new default wallpaper" + echo " -p PATH, --preview PATH set a wallpaper" +} + +if [[ $# -eq 0 ]] +then + echo "${BINNAME}: no arguments given" 1>&2 + help + exit 1 +fi + +while [[ $# -gt 0 ]] +do + key="$1" + case $key in + -r|--refresh) + setwall "${DEFPATH}.*" + shift + ;; + -u|--unset) + unsetwall + shift + ;; + -s|--set) + unsetwall + EXTENSION=`echo "$2" | cut -d'.' -f2` + ln -s $(pwd)/$2 "$DEFPATH.$EXTENSION" + setwall "${DEFPATH}.*" + shift + shift + ;; + -p|--preview) + setwall "$2" + shift + shift + ;; + -h|--help) + help + shift + exit 0 + ;; + *) + echo "${BINNAME}: unknown option $key" 1>&2 + exit 1 + esac +done + |