-
Notifications
You must be signed in to change notification settings - Fork 1
/
bwp
executable file
·54 lines (43 loc) · 1.31 KB
/
bwp
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
#!/bin/bash
: "${BWP_DIR:=$HOME/.cache/wallpapers}"
: "${BWP_GEOMETRY:=}"
: "${BWP_COMMAND:=feh --no-fehbg --bg-fill}"
: "${BWP_LOCK_OPTIONS:=}"
: "${BWP_LOCK_IMAGE_OPTIONS:=}"
main() {
_wdir="$BWP_DIR/walls"
_history="$BWP_DIR/history"
[[ -d $_wdir ]] || {
mkdir -p "$_wdir"
mkdir -p "$BWP_DIR/blurs"
ERM "BWP_DIR created at: $BWP_DIR"
}
# add is the only action that takes directories
# as an argument.
[[ -d "$*" ]] && _o[add]=1
((_o[add] == 1)) && {
add_to_library "$*" > /dev/null
exit
}
if [[ -n ${_o[rename]} ]] || ((_o[delete] == 1)); then
((_o[random]+_o[next]+_o[prev] > 0)) && ERH \
"-r -n -p is not allowed when deleting or renaming."
elif ! ((_o[wallpaper]+_o[blur]+_o[lock] > 0)); then
# if no action is specified, defualt to wallpaper
_o[wallpaper]=1
fi
_curpth="$(readlink "$BWP_DIR/currentwall")"
_curnam="${_curpth##*/}"
_wall="$(get_wall "$@")"
if ((_o[delete] == 1)); then
delete_wall "$_wall"
elif [[ -n ${_o[rename]} ]]; then
rename_wall "${_o[rename]}" "$_wall"
elif ((_o[lock] ==1)); then
set_lock "$_wall"
elif ((_o[wallpaper] == 1)) || ((_o[blur] == 1)); then
set_wall "$_wall"
fi
}
__dir=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")") #bashbud
source "$__dir/_init.sh" #bashbud