faster but quite buggy; no disc state storage

This commit is contained in:
2025-09-04 15:10:16 +02:00
parent b15848887b
commit 8c37cb2fea
7 changed files with 368 additions and 81 deletions

View File

@@ -1,37 +1,60 @@
# Key bindings
# See comment in `src/main.sh` on key bindings.
#
# Some key-bindings are used exclusively in the normal mode, others exclusively
# in the insert mode, others in both modes.
# Some key-bindings are universal in the sense that they do not depend on the
# state of the player (view, mode, arguments), others are not universal.
# Mode selection:
# - $KEYS_I_NORMAL: Switch to normal mode (insert mode)
# - $KEYS_N_INSERT: Switch to insert mode (normal mode)
#
# For fast processing, we propose the following.
# The mode (normal or insert) is stored in the FZF_INPUT_STATE variable. All
# key-bindings that are independent of the `view` and of the `arguments` are
# directly processed using a `--bind` with inline transform element. Keys that
# depend on `view` or `arguments` are processed through `$0 --fzf-key`. In a
# future step, we may also store the `view` part of the state as hidden fields
# in the list (the list generator makes that). Then, it may be possible to
# completely get rid of the state files. Even beter, we may store the view part
# in FZF_HEADER_LABEL.
# Vertical navigation:
# - $KEYS_DOWN: Move cursor to the next line
# - $KEYS_UP: Move cursor to the previous line
# - $KEYS_HALFPAGE_UP: Move cursor half a page up
# - $KEYS_HALFPAGE_DOWN: Move cursor half a page up
# - $KEYS_N_DOWN: Move cursor to the next line (normal mode)
# - $KEYS_N_UP: Move cursor to the previous line (normal mode)
# - $KEYS_N_BOT: Move cursor to the last line (normal mode)
# - $KEYS_N_TOP: Move cursor to the first line (normal mode)
#
# Switching between the modes (normal <-> insert) is done using two fzf `--bind`
# arguments. We make sure that only one is active.
# Horizontal navigation:
# - $KEYS_IN: Enter into selected item, down the hierarchy
# - $KEYS_OUT: Leave current item, up the hierarchy
#
# Filtering:
#
# Playback:
#
# Extras:
# - $KEYS_BROWSE: Open MusicBrainz webpage of the selected item
# - $KEYS_OPEN: Open file manager in the directory of the selected item
# Mode selection:
KEYS_I_NORMAL="${KEYS_I_NORMAL:-"esc"}"
KEYS_N_INSERT="${KEYS_N_INSERT:-"a,i,/"}"
# Vertical navigation:
KEYS_DOWN="${KEYS_DOWN:-"ctrl-j,down"}"
KEYS_UP="${KEYS_UP:-"ctrl-k,up"}"
KEYS_HALFPAGE_DOWN="${KEYS_HALFPAGE_DOWN:-"ctrl-d"}"
KEYS_HALFPAGE_UP="${KEYS_HALFPAGE_UP:-"ctrl-u"}"
KEYS_N_DOWN="${KEYS_N_DOWN:-"j"}"
KEYS_N_UP="${KEYS_N_UP:-"k"}"
KEYS_N_BOT="${KEYS_N_BOT:-"G"}"
KEYS_N_TOP="${KEYS_N_TOP:-"1"}"
# Horizontal navigation:
KEYS_IN="${KEYS_IN:-"ctrl-l"}"
KEYS_OUT="${KEYS_OUT:-"ctrl-h"}"
## Not yet characterized
KEYS_N_QUIT="${KEYS_N_QUIT:-"q"}"
KEYS_INPUT_SINGLE='0,1,2,3,4,5,6,7,8,9,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,!,",#,$,%,&,\,(,),*,+,,,-,.,/,:,;,<,=,>,?,@,[,\,\,],^,_,`,{,|,},~'
KEYS_INPUT_SINGLE="$KEYS_INPUT_SINGLE,'"
KEYS_INPUT_SPECIAL="space,backspace,delete,left,right"
export KEYS_INPUT_SINGLE KEYS_INPUT_SPECIAL
# Normal and insert mode
KEYS_HALFPAGE_DOWN="${KEYS_HALFPAGE_DOWN:-"ctrl-d"}"
KEYS_HALFPAGE_UP="${KEYS_HALFPAGE_UP:-"ctrl-u"}"
KEYS_BROWSE="${KEYS_BROWSE:-"alt-b"}"
KEYS_OPEN="${KEYS_OPEN:-"alt-o"}"
KEYS_OUT="${KEYS_OUT:-"ctrl-h"}"
KEYS_IN="${KEYS_IN:-"ctrl-l"}"
KEYS_SELECT_ARTIST="${KEYS_SELECT_ARTIST:-"ctrl-a"}"
KEYS_FILTER_LOCAL="${KEYS_FILTER_LOCAL:-"alt-l"}"
KEYS_FILTER_1="${KEYS_FILTER_1:-"alt-1"}"
@@ -47,13 +70,8 @@ KEYS_NI="$KEYS_HALFPAGE_DOWN,$KEYS_HALFPAGE_UP,$KEYS_BROWSE,$KEYS_OPEN,$KEYS_OUT
export KEYS_NI
# Keys in normal mode only
KEYS_N_DOWN="${KEYS_N_DOWN:-"j"}"
KEYS_N_UP="${KEYS_N_UP:-"k"}"
KEYS_N_OUT="${KEYS_N_OUT:-"h"}"
KEYS_N_IN="${KEYS_N_IN:-"l"}"
KEYS_N_TOP="${KEYS_N_TOP:-"1"}"
KEYS_N_BOT="${KEYS_N_BOT:-"G"}"
KEYS_N_QUIT="${KEYS_N_QUIT:-"q"}"
KEYS_N_INSERT="${KEYS_N_INSERT:-"a,i,/"}"
KEYS_N_TOGGLE_PLAY_PAUSE="${KEYS_N_TOGGLE_PLAY_PAUSE:-"space"}"
KEYS_N_PLAY_NEXT="${KEYS_N_PLAY_NEXT:-"right"}"