big changes: themed up, sorted up, some fixes and libs

This commit is contained in:
2025-10-06 17:15:47 +02:00
parent 7afe0d8f34
commit dc45f26299
18 changed files with 997 additions and 740 deletions

View File

@@ -83,6 +83,21 @@ MODE_INSERT="show"
# Load keys
. "sh/keys.sh"
# Load configuration
. "sh/config.sh"
# Load sorting methods
. "sh/sort.sh"
# Load theme
. "sh/theme.sh"
# Load tools
. "sh/tools.sh"
# Load AWK scripts
. "sh/awk.sh"
# Command-line options that may only be used internally.
# --lines
# --playback
@@ -126,6 +141,7 @@ case "${1:-}" in
# @argument $3: MusicBrainz ID of current object
# @argument $4: MusicBrainz ID of selected object
# @argument $5: Path to decoration file
info "call to $*"
shift
playback "$@"
exit 0
@@ -350,18 +366,6 @@ case "${1:-}" in
;;
esac
# Load configuration
. "sh/config.sh"
# Load theme
. "sh/theme.sh"
# Load tools
. "sh/tools.sh"
# Load AWK scripts
. "sh/awk.sh"
# Non-interactive user commands intended to the user. These commands do not
# require temporary files, fzf, nor the mpv instance.
case "${1:-}" in
@@ -565,11 +569,11 @@ while true; do
--border="bold" \
--border-label="Select artist" \
--preview-window="right,25%,border-left,wrap,<30(hidden)" \
--preview="$0 --preview $VIEW_SELECT_ARTIST {3}" \
--preview="$0 --preview $VIEW_SELECT_ARTIST {4}" \
--delimiter="\t" \
--prompt="$SEARCH_PROMPT" \
--margin="5%,20%" \
--accept-nth="{3}" \
--accept-nth="{4}" \
--with-nth="{1}" || true
)
lines=$(echo "$sel" | wc -l)
@@ -599,20 +603,20 @@ while true; do
--bind="$KEYS_N_BOT:last" \
--bind="$KEYS_N_TOP:first" \
--bind="$KEYS_OUT,$KEYS_N_OUT,$KEYS_QUIT,$KEYS_N_QUIT:print($LASTVIEW)+print($LASTARG)+print($VIEW_PLAYLIST)+print()+accept" \
--bind="$KEYS_SELECT_ARTIST:transform:$0 --action-gotoartist $MODE_NORMAL $VIEW_PLAYLIST {2} {3}" \
--bind="$KEYS_SELECT_ARTIST:transform:$0 --action-gotoartist $MODE_NORMAL $VIEW_PLAYLIST {3} {4}" \
--bind="$KEYS_LIST_ARTISTS:print($VIEW_LIST_ARTISTS)+accept" \
--bind="$KEYS_LIST_ALBUMS:print($VIEW_LIST_ALBUMS)+accept" \
--bind="$KEYS_SEARCH_ARTIST:print($VIEW_SEARCH_ARTIST)+accept" \
--bind="$KEYS_SEARCH_ALBUM:print($VIEW_SEARCH_ALBUM)+accept" \
--bind="$KEYS_BROWSE:execute-silent:open \"https://musicbrainz.org/\track/{r3}\"" \
--bind="$KEYS_OPEN:execute-silent:open \"\$(dirname {4})\"" \
--bind="$KEYS_N_YANK:execute-silent:printf {3} | $CLIP)" \
--bind="$KEYS_YANK_CURRENT:execute-silent:printf {2} | $CLIP" \
--bind="$KEYS_OPEN:execute-silent:open \"\$(dirname {5})\"" \
--bind="$KEYS_N_YANK:execute-silent:printf {4} | $CLIP)" \
--bind="$KEYS_YANK_CURRENT:execute-silent:printf {3} | $CLIP" \
--bind="$KEYS_KEYBINDINGS:preview:$0 --show-keybindings $VIEW_PLAYLIST" \
--bind="$KEYS_SCROLL_PREVIEW_DOWN:preview-down" \
--bind="$KEYS_SCROLL_PREVIEW_UP:preview-up" \
--bind="$KEYS_PREVIEW_CLOSE:hide-preview" \
--bind="$KEYS_PLAYBACK,$KEYS_N_PLAYBACK:transform($0 --playback $VIEW_PLAYLIST {2} {3} {4})+$FZF_RELOAD_PLAYLIST+$FZF_POS_PLAYLIST" \
--bind="$KEYS_PLAYBACK,$KEYS_N_PLAYBACK:transform($0 --playback $VIEW_PLAYLIST {3} {4} {5})+$FZF_RELOAD_PLAYLIST+$FZF_POS_PLAYLIST" \
--bind="$KEYS_PLAYLIST_RELOAD:$FZF_RELOAD_PLAYLIST+$FZF_POS_PLAYLIST" \
--bind="$KEYS_PLAYLIST_REMOVE:execute-silent($0 --playlist $PLAYLIST_CMD_REMOVE)+$FZF_RELOAD_PLAYLIST" \
--bind="$KEYS_PLAYLIST_UP:execute-silent($0 --playlist $PLAYLIST_CMD_UP)+up+$FZF_RELOAD_PLAYLIST" \
@@ -625,7 +629,7 @@ while true; do
--bind="$KEYS_PLAYLIST_GOTO_RELEASE:print($VIEW_RELEASE)+accept" \
--delimiter="\t" \
--with-nth="{1}" \
--accept-nth="{2}" || true
--accept-nth="{3}" || true
)
VIEW="$(echo "$sel" | head -1)"
ARGS="$(echo "$sel" | head -2 | tail -1)"
@@ -667,11 +671,11 @@ while true; do
--bind="$KEYS_N_UP:transform:$IN_NORMAL_MODE && echo up || $PUT_FZF_KEY_LOGIC" \
--bind="$KEYS_N_BOT:transform:$IN_NORMAL_MODE && echo last || $PUT_FZF_KEY_LOGIC" \
--bind="$KEYS_N_TOP:transform:$IN_NORMAL_MODE && echo first || $PUT_FZF_KEY_LOGIC" \
--bind="$KEYS_IN:transform:[ {3} ] && $0 --action-draw $FZF_CURRENT_MODE $FZF_CURRENT_VIEW {3} \"+1\"" \
--bind="$KEYS_OUT:transform:[ {2} ] && $0 --action-draw $FZF_CURRENT_MODE $FZF_CURRENT_VIEW {2} \"-1\"" \
--bind="$KEYS_N_IN:transform:$IN_NORMAL_MODE && ([ {3} ] && $0 --action-draw $FZF_CURRENT_MODE $FZF_CURRENT_VIEW {3} \"+1\") || $PUT_FZF_KEY_LOGIC" \
--bind="$KEYS_N_OUT:transform:$IN_NORMAL_MODE && ([ {2} ] && $0 --action-draw $FZF_CURRENT_MODE $FZF_CURRENT_VIEW {2} \"-1\") || $PUT_FZF_KEY_LOGIC" \
--bind="$KEYS_SELECT_ARTIST:transform:$0 --action-gotoartist $FZF_CURRENT_MODE $FZF_CURRENT_VIEW {2} {3}" \
--bind="$KEYS_IN:transform:[ {4} ] && $0 --action-draw $FZF_CURRENT_MODE $FZF_CURRENT_VIEW {4} \"+1\"" \
--bind="$KEYS_OUT:transform:[ {3} ] && $0 --action-draw $FZF_CURRENT_MODE $FZF_CURRENT_VIEW {3} \"-1\"" \
--bind="$KEYS_N_IN:transform:$IN_NORMAL_MODE && ([ {4} ] && $0 --action-draw $FZF_CURRENT_MODE $FZF_CURRENT_VIEW {4} \"+1\") || $PUT_FZF_KEY_LOGIC" \
--bind="$KEYS_N_OUT:transform:$IN_NORMAL_MODE && ([ {3} ] && $0 --action-draw $FZF_CURRENT_MODE $FZF_CURRENT_VIEW {3} \"-1\") || $PUT_FZF_KEY_LOGIC" \
--bind="$KEYS_SELECT_ARTIST:transform:$0 --action-gotoartist $FZF_CURRENT_MODE $FZF_CURRENT_VIEW {3} {4}" \
--bind="$KEYS_LIST_ARTISTS:transform:$0 --action-draw \$FZF_INPUT_STATE $VIEW_LIST_ARTISTS" \
--bind="$KEYS_LIST_ALBUMS:transform:$0 --action-draw \$FZF_INPUT_STATE $VIEW_LIST_ALBUMS" \
--bind="$KEYS_SEARCH_ARTIST:transform:$0 --action-draw $MODE_INSERT $VIEW_SEARCH_ARTIST" \
@@ -690,7 +694,7 @@ $VIEW_SEARCH_ALBUM) $0 --action-draw $MODE_NORMAL $VIEW_LIST_ALBUMS ;;
esac" \
--bind="$KEYS_FILTER:transform:$0 --action-filter $FZF_CURRENT_MODE $FZF_CURRENT_VIEW" \
--bind="$KEYS_BROWSE:execute-silent:
[ {3} ] || exit 0
[ {4} ] || exit 0
case $FZF_CURRENT_VIEW in
$VIEW_LIST_ARTISTS | $VIEW_SEARCH_ARTIST) t=artist ;;
$VIEW_ARTIST | $VIEW_SEARCH_ALBUM | $VIEW_LIST_ALBUMS) t=release-group ;;
@@ -699,25 +703,24 @@ case $FZF_CURRENT_VIEW in
esac
open \"https://musicbrainz.org/\$t/{r3}\"" \
--bind="$KEYS_OPEN:execute-silent:
[ {4} ] || exit 0
open \"\$(dirname {4})\"" \
--bind="$KEYS_N_YANK:transform:$IN_NORMAL_MODE && echo \"execute-silent(printf {3} | $CLIP)\" || $PUT_FZF_KEY_LOGIC" \
--bind="$KEYS_YANK_CURRENT:execute-silent:printf {2} | $CLIP" \
--bind="$KEYS_SHOW_PLAYLIST:transform:echo \"print($VIEW_PLAYLIST)+print()+print($FZF_CURRENT_VIEW)+print({2})+accept\"" \
[ {5} ] || exit 0
open \"\$(dirname {5})\"" \
--bind="$KEYS_N_YANK:transform:$IN_NORMAL_MODE && echo \"execute-silent(printf {4} | $CLIP)\" || $PUT_FZF_KEY_LOGIC" \
--bind="$KEYS_YANK_CURRENT:execute-silent:printf {3} | $CLIP" \
--bind="$KEYS_SHOW_PLAYLIST:transform:echo \"print($VIEW_PLAYLIST)+print()+print($FZF_CURRENT_VIEW)+print({3})+accept\"" \
--bind="$KEYS_KEYBINDINGS:preview:$0 --show-keybindings $FZF_CURRENT_VIEW" \
--bind="$KEYS_REFRESH:execute-silent($0 --remove-from-cache $FZF_CURRENT_VIEW {2} {3})+transform:$0 --action-draw $FZF_CURRENT_MODE $FZF_CURRENT_VIEW {2}" \
--bind="$KEYS_REFRESH:execute-silent($0 --remove-from-cache $FZF_CURRENT_VIEW {3} {4})+transform:$0 --action-draw $FZF_CURRENT_MODE $FZF_CURRENT_VIEW {3}" \
--bind="$KEYS_QUIT:print($VIEW_QUIT)+accept" \
--bind="$KEYS_N_QUIT:transform:$IN_NORMAL_MODE && ($IN_LIST_ARTISTS_VIEW && echo \"print($VIEW_QUIT)+accept\" || $0 --action-draw $MODE_NORMAL $VIEW_LIST_ARTISTS) || $PUT_FZF_KEY_LOGIC" \
--bind="$KEYS_SCROLL_PREVIEW_DOWN:preview-down" \
--bind="$KEYS_SCROLL_PREVIEW_UP:preview-up" \
--bind="$KEYS_PREVIEW_OPEN:show-preview" \
--bind="$KEYS_PREVIEW_CLOSE:hide-preview" \
--bind="$KEYS_PLAYBACK:transform:$0 --playback $FZF_CURRENT_VIEW {2} {3} {4}" \
--bind="$KEYS_N_PLAYBACK:transform:$IN_NORMAL_MODE && $0 --playback $FZF_CURRENT_VIEW {2} {3} {4} || $PUT_FZF_KEY_LOGIC" \
--bind="W:execute-silent:echo 1 >> /tmp/foo; echo $FZF_CURRENT_VIEW >> /tmp/foo; echo 2 >> /tmp/foo" \
--bind="$KEYS_PLAYBACK:transform:$0 --playback $FZF_CURRENT_VIEW {3} {4} {5}" \
--bind="$KEYS_N_PLAYBACK:transform:$IN_NORMAL_MODE && $0 --playback $FZF_CURRENT_VIEW {3} {4} {5} || $PUT_FZF_KEY_LOGIC" \
--bind="change:execute-silent($0 --mbsearch $FZF_CURRENT_VIEW &)+reload:$0 --lines $FZF_CURRENT_VIEW" \
--preview-window="right,25%,border-left,wrap,<30(hidden)" \
--preview="$0 --preview $FZF_CURRENT_VIEW {3}" \
--preview="$0 --preview $FZF_CURRENT_VIEW {4}" \
--delimiter="\t" \
--with-nth="{1}" || true
)