872751766beccd4b80a5945a6d35eab2e0bdf8de
3 ### XXX Chose not to 'set -e' because arithmetic evaluation can cause a non-zero exit.
4 ### XXX Chose not to 'set -u' because unset params ($1, $2, ...) cause failures.
5 ### Solutions to the above are ugly.
15 q | Q
) echo 'CMD_QUIT';;
16 h | H
) echo 'CMD_MOVE_BACK';;
17 l | L
) echo 'CMD_MOVE_FORWARD';;
18 f | F
) echo 'CMD_FAVORITE';;
19 *) echo 'CMD_UKNOWN';;
28 if file "$path" |
grep 'image data' > /dev
/null
31 # \r jumps to the beginning of the line:
32 printf '\rFound %d images.' "$n" >&2
33 paths
["$(( n - 1 ))"]="$path"
39 paths_set_from_dir_find
() {
40 paths_set
< <(find "$1" -type f
)
43 paths_set_from_favs
() {
44 paths_set
< <(sort -k 2 "$FILE_WALLPAPER_FAVS" |
awk '{sub("^" $1 " +", ""); print}')
51 printf '%d of %d %s\n' "$(( i + 1 ))" "$n" "$path"
52 feh
--bg-scale "$path"
57 local path
="${paths[$i]}"
59 set_wallpaper
"$i" "$path"
63 if [[ "${paths[$i]}" != "$path" ]]
66 set_wallpaper
"$i" "$path"
69 case "$(read_command)" in
73 (( i
= i
== 0 ?
(n
- 1) : i
- 1));;
75 (( i
= (i
+ 1) % n
));;
86 f | fav
) paths_set_from_favs
;;
87 d | dir
) paths_set_from_dir_find
"$2";;
88 a | all
) paths_set_from_dir_find
"$DIR_WALLPAPERS";;
90 paths_set_from_dir_find
"$DIR_WALLPAPERS";;
92 printf 'Error: unknown source "%s"\n' "$1" >&2
This page took 0.066351 seconds and 3 git commands to generate.