blob: b9e2754f69f5697fa14ad3409512c28a6545c229 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
#!/usr/bin/env bash
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
|