X-Git-Url: https://git.xandkar.net/?a=blobdiff_plain;f=home%2Fbin%2Fwallpaper_review;h=66d7e4f71a535212cf5af38e58751787b4c50733;hb=d1d9daef1cd092c0029e2bce2bc2c719616dffab;hp=a821bf3766a1b02534ce79448a335b19b3ee2855;hpb=5b897004a8d36b7af4cf582f99064fb18986a7d2;p=khome.git diff --git a/home/bin/wallpaper_review b/home/bin/wallpaper_review index a821bf3..66d7e4f 100755 --- a/home/bin/wallpaper_review +++ b/home/bin/wallpaper_review @@ -42,6 +42,7 @@ read_command() { 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 @@ -108,7 +109,7 @@ paths_preview() { (( 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}') @@ -119,12 +120,40 @@ paths_preview() { 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 <&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;; @@ -136,7 +165,7 @@ main() { printf 'Error: unknown source "%s"\n' "$1" >&2 exit 1;; esac - + help_print paths_preview }