f | F) _command='CMD_FAVORITE_ADD';;
r | R) _command='CMD_FAVORITE_REMOVE';;
s | S) _command='CMD_SET_CURRENT';;
+ z | Z) _command='CMD_FZF';;
:) read_command_goto;;
*)
printf 'Error: unknown command: %s\n' "$char" >&2
(( i = (i + 1) % n ));;
CMD_FAVORITE_ADD)
printf 'Adding to favorites set: "%s"\n' "$path" >&2
- wallpaper_fav;;
+ wallpaper_fav "$path";;
CMD_FAVORITE_REMOVE)
printf 'Removing from favorites set: "%s"\n' "$path" >&2
digest=$(sha256sum "$path" | awk '{print $1}')
CMD_SET_CURRENT)
printf 'Setting as current: "%s"\n' "$path" >&2
echo "$path" > "$FILE_WALLPAPER_CURR";;
+ CMD_FZF)
+ i=$(
+ for j in "${!paths[@]}"; do
+ printf '%d %s\n' "$((j + 1))" "${paths[j]}"
+ done \
+ | fzf -e \
+ | awk '{print $1 - 1}'
+ );;
CMD_UKNOWN)
continue;;
esac
done
}
+help_print() {
+ cat <<EOF >&2
+
+Navigation help:
+
+key | action
+----+----------------------------------------------
+ q | quit
+ h | move back
+ l | move forward
+ f | add to favorites
+ r | remove from favorites
+ s | set current
+ z | fuzzy search for next file path
+ :N | goto Nth image
+----+----------------------------------------------
+
+EOF
+}
+
main() {
case "$1" in
f | fav) paths_set_from_favs;;
printf 'Error: unknown source "%s"\n' "$1" >&2
exit 1;;
esac
-
+ help_print
paths_preview
}