From b1ca6e75e07e067ff44947f18415974fcfdb0e05 Mon Sep 17 00:00:00 2001 From: Julian T Date: Wed, 27 May 2020 19:02:06 +0200 Subject: Added cool setwall script --- scripts/Scripts/setwall | 66 ++++++++++++++++++++++++++++++++++++++++++++++++- xinit/Scripts/xlaunchrc | 2 +- 2 files changed, 66 insertions(+), 2 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 + diff --git a/xinit/Scripts/xlaunchrc b/xinit/Scripts/xlaunchrc index af9da47..9d031c3 100755 --- a/xinit/Scripts/xlaunchrc +++ b/xinit/Scripts/xlaunchrc @@ -16,7 +16,7 @@ xmodmap .Xmodmap nm-applet & # set wallpaper -~/Scripts/setwall +~/Scripts/setwall -r dunst & play ~/Winsounds/login.wav -q & -- cgit v1.2.3