@kecan0406/ttheme 1.0.49 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +36 -27
- package/bin/ttheme.js +229 -235
- package/bin/ttheme.js.map +1 -1
- package/dist/manifest.json +94 -5
- package/package.json +2 -1
- package/shell/adapters/_bg.zsh +8 -8
- package/shell/ttheme.zsh +141 -78
package/shell/ttheme.zsh
CHANGED
|
@@ -4,7 +4,7 @@ zmodload -F zsh/stat b:zstat 2>/dev/null
|
|
|
4
4
|
|
|
5
5
|
__tt_palettes_load() {
|
|
6
6
|
local -a at
|
|
7
|
-
unset TTHEME_PALETTE TTHEME_GROUP TTHEME_NATIVE TTHEME_SRC
|
|
7
|
+
unset TTHEME_PALETTE TTHEME_GROUP TTHEME_CATALOG TTHEME_NATIVE TTHEME_SRC
|
|
8
8
|
source $TTHEME_HOME/palettes.zsh || return 1
|
|
9
9
|
zstat -F %s.%N -A at +mtime -- $TTHEME_HOME/palettes.zsh 2>/dev/null
|
|
10
10
|
TTHEME_PALETTES_AT=$at[1]
|
|
@@ -231,7 +231,7 @@ __tt_name_of() { REPLY=${${(k)TTHEME_PALETTE[(re)$1]}:-custom} }
|
|
|
231
231
|
__tt_color() { [[ -t 1 && -z $NO_COLOR && $TERM != dumb ]] }
|
|
232
232
|
|
|
233
233
|
__tt_palette_line() {
|
|
234
|
-
local name=$1 width=$2 on=$3 hex cell="" bar=""
|
|
234
|
+
local name=$1 width=$2 on=$3 label=${4:-$1} hex cell="" bar=""
|
|
235
235
|
local -a p=(${=TTHEME_PALETTE[$name]}) sw=(${=TTHEME_SWATCH[$name]})
|
|
236
236
|
(( ${#p} >= 20 )) || return 1
|
|
237
237
|
for hex in $sw; do
|
|
@@ -243,9 +243,9 @@ __tt_palette_line() {
|
|
|
243
243
|
printf -v ac '\e[38;2;%d;%d;%dm' $((16#${cur:0:2})) $((16#${cur:2:2})) $((16#${cur:4:2}))
|
|
244
244
|
printf -v bar '\e[48;2;%d;%d;%d;38;2;%d;%d;%dm' \
|
|
245
245
|
$((16#${sel:0:2})) $((16#${sel:2:2})) $((16#${sel:4:2})) $((16#${fg:0:2})) $((16#${fg:2:2})) $((16#${fg:4:2}))
|
|
246
|
-
printf '%s▌\e[39m %s %s■\e[39m \e[1m%-*s\e[22m %s\e[0m\n' "$ac" "$bar" "$ac" "$width" "$
|
|
246
|
+
printf '%s▌\e[39m %s %s■\e[39m \e[1m%-*s\e[22m %s\e[0m\n' "$ac" "$bar" "$ac" "$width" "$label" "$cell"
|
|
247
247
|
else
|
|
248
|
-
printf ' %-*s %s\e[0m\n' "$width" "$
|
|
248
|
+
printf ' %-*s %s\e[0m\n' "$width" "$label" "$cell"
|
|
249
249
|
fi
|
|
250
250
|
}
|
|
251
251
|
|
|
@@ -402,9 +402,9 @@ __tt_pin_save() {
|
|
|
402
402
|
TTHEME_PIN=$key TTHEME_PIN_SPEC=${TTHEME_PALETTE[$name]}
|
|
403
403
|
__tt_tilde "$key"
|
|
404
404
|
if __tt_color; then
|
|
405
|
-
printf '\033[
|
|
405
|
+
printf '\033[2mPinned · %s → %s\033[0m\n' "$REPLY" "$name"
|
|
406
406
|
else
|
|
407
|
-
print -r -- "
|
|
407
|
+
print -r -- "Pinned · $REPLY → $name"
|
|
408
408
|
fi
|
|
409
409
|
}
|
|
410
410
|
|
|
@@ -420,9 +420,9 @@ __tt_unpin() {
|
|
|
420
420
|
__tt_dir_sync
|
|
421
421
|
__tt_tilde "$key"
|
|
422
422
|
if __tt_color; then
|
|
423
|
-
printf '\033[
|
|
423
|
+
printf '\033[2mUnpinned · %s\033[0m\n' "$REPLY"
|
|
424
424
|
else
|
|
425
|
-
print -r -- "
|
|
425
|
+
print -r -- "Unpinned · $REPLY"
|
|
426
426
|
fi
|
|
427
427
|
return 0
|
|
428
428
|
done
|
|
@@ -457,7 +457,7 @@ __tt_order() {
|
|
|
457
457
|
}
|
|
458
458
|
|
|
459
459
|
__tt_menu() {
|
|
460
|
-
local k cur="" grp last_grp="" REPLY
|
|
460
|
+
local k cur="" grp last_grp="" shelf last_shelf="" label REPLY
|
|
461
461
|
local -a reply
|
|
462
462
|
local -i width=0
|
|
463
463
|
__tt_order
|
|
@@ -469,18 +469,28 @@ __tt_menu() {
|
|
|
469
469
|
fi
|
|
470
470
|
[[ -n $TTHEME_SPEC ]] && __tt_name_of "$TTHEME_SPEC" && cur=$REPLY
|
|
471
471
|
for k in $reply; do
|
|
472
|
-
|
|
472
|
+
label=${k##*/}
|
|
473
|
+
[[ -n ${TTHEME_CATALOG[$k]} && ${TTHEME_GROUP[$k]} == *@* ]] && label=" $label"
|
|
474
|
+
(( ${#label} > width )) && width=${#label}
|
|
473
475
|
done
|
|
474
476
|
for k in $reply; do
|
|
475
477
|
grp=${TTHEME_GROUP[$k]:-Other}
|
|
476
478
|
if [[ $grp != $last_grp ]]; then
|
|
477
|
-
[[ $grp == *@* && $last_grp != *@* && -n $last_grp ]] && printf ' \033[2m──
|
|
479
|
+
[[ $grp == *@* && $last_grp != *@* && -n $last_grp ]] && printf ' \033[2m── Markets ──────────\033[0m\n'
|
|
478
480
|
printf ' \033[1m%s\033[0m' "$grp"
|
|
479
481
|
[[ -n ${TTHEME_NATIVE[$k]} ]] && printf ' \033[2m%s\033[0m' "${TTHEME_NATIVE[$k]}"
|
|
480
482
|
printf '\n'
|
|
481
|
-
last_grp=$grp
|
|
483
|
+
last_grp=$grp last_shelf=""
|
|
482
484
|
fi
|
|
483
|
-
|
|
485
|
+
shelf=""
|
|
486
|
+
[[ $grp == *@* ]] && shelf=${TTHEME_CATALOG[$k]}
|
|
487
|
+
if [[ -n $shelf && $shelf != "$last_shelf" ]]; then
|
|
488
|
+
printf ' \033[1m%s\033[0m\n' "$shelf"
|
|
489
|
+
last_shelf=$shelf
|
|
490
|
+
fi
|
|
491
|
+
label=${k##*/}
|
|
492
|
+
[[ -n $shelf ]] && label=" $label"
|
|
493
|
+
__tt_palette_line "$k" $width "${${(M)k:#$cur}:+1}" "$label"
|
|
484
494
|
done
|
|
485
495
|
printf '\n \033[2mttheme use <palette> paints this tab · ttheme preview · ttheme help\033[0m\n'
|
|
486
496
|
}
|
|
@@ -537,7 +547,7 @@ __tt_cli() {
|
|
|
537
547
|
__tt_catalog() {
|
|
538
548
|
local was
|
|
539
549
|
__tt_cli "$@" || return
|
|
540
|
-
[[ $1 == (list|share
|
|
550
|
+
[[ $1 == (list|share) ]] && return 0
|
|
541
551
|
[[ -r $TTHEME_HOME/palettes.zsh ]] || return 0
|
|
542
552
|
was="$TTHEME_STARTUP ${TTHEME_PALETTE[$TTHEME_STARTUP]}"
|
|
543
553
|
__tt_palettes_load && __tt_reloaded
|
|
@@ -572,7 +582,7 @@ __tt_config() {
|
|
|
572
582
|
blur=${(M)${(@f)"$(<$TTHEME_CONFIG)"}:#': ${TTHEME_BG_BLUR:='*}
|
|
573
583
|
${=${VISUAL:-${EDITOR:-vi}}} $TTHEME_CONFIG || return
|
|
574
584
|
[[ ${(M)${(@f)"$(<$TTHEME_CONFIG)"}:#': ${TTHEME_BG_BLUR:='*} == "$blur" ]] || __tt_redraw
|
|
575
|
-
print -r -- "
|
|
585
|
+
print -r -- "Settings apply in new tabs — $TTHEME_CONFIG"
|
|
576
586
|
}
|
|
577
587
|
|
|
578
588
|
__tt_redraw() {
|
|
@@ -639,11 +649,11 @@ __tt_resolve() {
|
|
|
639
649
|
return 0
|
|
640
650
|
elif (( ${#m} > 1 )); then
|
|
641
651
|
m=(${(o)m})
|
|
642
|
-
print -u2 "multiple palettes start with '$name': $m"
|
|
652
|
+
print -u2 "ttheme: multiple palettes start with '$name': $m"
|
|
643
653
|
elif m=(${(o)${(M)${(k)TTHEME_PALETTE}:#*$name*}}) && (( ${#m} )); then
|
|
644
|
-
print -u2 "unknown palette '$name' — did you mean: ${(j:, :)m[1,3]}?"
|
|
654
|
+
print -u2 "ttheme: unknown palette '$name' — did you mean: ${(j:, :)m[1,3]}?"
|
|
645
655
|
else
|
|
646
|
-
print -u2 "unknown palette '$name' — run \`ttheme\` to list palettes"
|
|
656
|
+
print -u2 "ttheme: unknown palette '$name' — run \`ttheme\` to list palettes"
|
|
647
657
|
fi
|
|
648
658
|
return 1
|
|
649
659
|
}
|
|
@@ -671,14 +681,14 @@ __tt_rotate() {
|
|
|
671
681
|
|
|
672
682
|
__tt_pv_rows() {
|
|
673
683
|
rtype=() rval=() rcnt=()
|
|
674
|
-
local g t gm ruled=""
|
|
675
|
-
local -a ts
|
|
684
|
+
local g t c gm ruled=""
|
|
685
|
+
local -a ts cs loose inside
|
|
676
686
|
for g in $groups; do
|
|
677
687
|
ts=()
|
|
678
688
|
gm=""
|
|
679
689
|
[[ -n $flt && ${(L)g} == *$flt* ]] && gm=1
|
|
680
690
|
for t in ${=gthemes[$g]}; do
|
|
681
|
-
[[ -z $flt || -n $gm || $t == *$flt* ]] && ts+=($t)
|
|
691
|
+
[[ -z $flt || -n $gm || $t == *$flt* || ${(L)TTHEME_CATALOG[$t]} == *$flt* ]] && ts+=($t)
|
|
682
692
|
done
|
|
683
693
|
[[ -n $flt ]] && (( ! ${#ts} )) && continue
|
|
684
694
|
if [[ $g == *@* && -z $ruled ]]; then
|
|
@@ -686,12 +696,38 @@ __tt_pv_rows() {
|
|
|
686
696
|
(( ${#rtype} )) && { rtype+=(rule); rval+=(''); rcnt+=(0) }
|
|
687
697
|
fi
|
|
688
698
|
rtype+=(hdr); rval+=($g); rcnt+=(${#ts})
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
699
|
+
[[ -n $flt || -n ${exp[$g]} ]] || continue
|
|
700
|
+
cs=() loose=()
|
|
701
|
+
for t in $ts; do
|
|
702
|
+
c=${TTHEME_CATALOG[$t]}
|
|
703
|
+
if [[ -n $c && $g == *@* ]]; then
|
|
704
|
+
(( ${cs[(Ie)$c]} )) || cs+=($c)
|
|
705
|
+
else
|
|
706
|
+
loose+=($t)
|
|
707
|
+
fi
|
|
708
|
+
done
|
|
709
|
+
for c in $cs; do
|
|
710
|
+
inside=()
|
|
711
|
+
for t in $ts; do
|
|
712
|
+
[[ ${TTHEME_CATALOG[$t]} == "$c" ]] && inside+=($t)
|
|
713
|
+
done
|
|
714
|
+
rtype+=(cat); rval+=("$g/$c"); rcnt+=(${#inside})
|
|
715
|
+
if [[ -n $flt || -n ${exp[$g/$c]} ]]; then
|
|
716
|
+
for t in $inside; do rtype+=(thm); rval+=($t); rcnt+=(0); done
|
|
717
|
+
fi
|
|
718
|
+
done
|
|
719
|
+
for t in $loose; do rtype+=(thm); rval+=($t); rcnt+=(0); done
|
|
692
720
|
done
|
|
693
721
|
}
|
|
694
722
|
|
|
723
|
+
__tt_pv_at() {
|
|
724
|
+
local i
|
|
725
|
+
for (( i = 1; i <= ${#rval}; i++ )); do
|
|
726
|
+
[[ ${rtype[i]} == (hdr|cat) && ${rval[i]} == "$1" ]] && { cur=$i; return 0 }
|
|
727
|
+
done
|
|
728
|
+
return 0
|
|
729
|
+
}
|
|
730
|
+
|
|
695
731
|
__tt_pv_first() {
|
|
696
732
|
local name=$1 i
|
|
697
733
|
cur=1 top=1
|
|
@@ -707,8 +743,9 @@ __tt_pv_first() {
|
|
|
707
743
|
}
|
|
708
744
|
|
|
709
745
|
__tt_pv_goto() {
|
|
710
|
-
local name=$1 i
|
|
711
|
-
exp[$
|
|
746
|
+
local name=$1 i g=${TTHEME_GROUP[$1]:-Other} c=${TTHEME_CATALOG[$1]}
|
|
747
|
+
exp[$g]=1
|
|
748
|
+
[[ -n $c && $g == *@* ]] && exp[$g/$c]=1
|
|
712
749
|
__tt_pv_rows
|
|
713
750
|
for (( i = 1; i <= ${#rval}; i++ )); do
|
|
714
751
|
[[ ${rtype[i]} == thm && ${rval[i]} == $name ]] && { cur=$i; return 0 }
|
|
@@ -738,16 +775,19 @@ __tt_pv_toggle() {
|
|
|
738
775
|
|
|
739
776
|
__tt_pv_left() {
|
|
740
777
|
[[ -n $flt ]] && return 0
|
|
741
|
-
if [[ ${rtype[cur]} == hdr ]]; then
|
|
742
|
-
[[ -n ${exp[${rval[cur]}]} ]]
|
|
778
|
+
if [[ ${rtype[cur]} == (hdr|cat) ]]; then
|
|
779
|
+
if [[ -n ${exp[${rval[cur]}]} ]]; then
|
|
780
|
+
__tt_pv_toggle
|
|
781
|
+
elif [[ ${rtype[cur]} == cat ]]; then
|
|
782
|
+
__tt_pv_at ${rval[cur]%%/*}
|
|
783
|
+
fi
|
|
743
784
|
return 0
|
|
744
785
|
fi
|
|
745
|
-
local g=${TTHEME_GROUP[${rval[cur]}]:-Other}
|
|
746
|
-
|
|
747
|
-
[[ ${rtype[i]} == hdr ]] && { cur=$i; break }
|
|
748
|
-
done
|
|
786
|
+
local g=${TTHEME_GROUP[${rval[cur]}]:-Other} c=${TTHEME_CATALOG[${rval[cur]}]}
|
|
787
|
+
[[ -n $c && $g == *@* ]] && g=$g/$c
|
|
749
788
|
exp[$g]=""
|
|
750
789
|
__tt_pv_rows
|
|
790
|
+
__tt_pv_at $g
|
|
751
791
|
}
|
|
752
792
|
|
|
753
793
|
typeset -gA TTHEME_GLYPHS=(
|
|
@@ -815,7 +855,7 @@ __tt_pv_hl() {
|
|
|
815
855
|
}
|
|
816
856
|
|
|
817
857
|
__tt_pv_row() {
|
|
818
|
-
local t=${rval[$1]} b=$'\e[1m' d=$'\e[2m' r=$'\e[22;24;39m' z=$'\e[0m' on="" gut=" " base="" lead=$'\e[2m' mark=" " name arrow=▸
|
|
858
|
+
local t=${rval[$1]} b=$'\e[1m' d=$'\e[2m' r=$'\e[22;24;39m' z=$'\e[0m' on="" gut=" " base="" lead=$'\e[2m' mark=" " name arrow=▸ ind=" "
|
|
819
859
|
local -i w
|
|
820
860
|
(( color )) || b= d= r= z= lead=
|
|
821
861
|
if (( $1 == cur )); then
|
|
@@ -823,7 +863,7 @@ __tt_pv_row() {
|
|
|
823
863
|
(( color )) && on=$sb
|
|
824
864
|
fi
|
|
825
865
|
if [[ ${rtype[$1]} == rule ]]; then
|
|
826
|
-
name='──
|
|
866
|
+
name='── Markets '
|
|
827
867
|
REPLY=" "$d$name${(l:lw - 4 - ${#name}::─:)}$z
|
|
828
868
|
return 0
|
|
829
869
|
fi
|
|
@@ -843,19 +883,37 @@ __tt_pv_row() {
|
|
|
843
883
|
REPLY=$gut$on" "$lead$arrow$r" "$base$REPLY$r${(l:w:: :)}$d${rcnt[$1]}$r" "$z
|
|
844
884
|
return 0
|
|
845
885
|
fi
|
|
886
|
+
if [[ ${rtype[$1]} == cat ]]; then
|
|
887
|
+
[[ -n $flt || -n ${exp[$t]} ]] && arrow=▾
|
|
888
|
+
name=${t#*/}
|
|
889
|
+
(( ${(m)#name} > lw - 12 )) && name="${name[1,lw-13]}…"
|
|
890
|
+
base=$b
|
|
891
|
+
if (( color )) && [[ $t == "$acat" ]]; then
|
|
892
|
+
base+=$ac lead=$ac
|
|
893
|
+
elif (( $1 == cur )); then
|
|
894
|
+
lead=""
|
|
895
|
+
fi
|
|
896
|
+
__tt_pv_hl "$name" "$base"
|
|
897
|
+
w=$(( lw - 8 - ${(m)#name} - ${#rcnt[$1]} ))
|
|
898
|
+
(( w < 1 )) && w=1
|
|
899
|
+
REPLY=$gut$on" "$lead$arrow$r" "$base$REPLY$r${(l:w:: :)}$d${rcnt[$1]}$r" "$z
|
|
900
|
+
return 0
|
|
901
|
+
fi
|
|
846
902
|
if (( $1 == cur )); then
|
|
847
903
|
mark=$ac"■"$r base=$b
|
|
848
904
|
elif [[ -n $cdot && $t == "$cn" ]]; then
|
|
849
905
|
mark=$cdot
|
|
850
906
|
fi
|
|
851
|
-
|
|
907
|
+
name=${t##*/}
|
|
908
|
+
[[ -n ${TTHEME_CATALOG[$t]} && ${TTHEME_GROUP[$t]} == *@* ]] && ind=" "
|
|
909
|
+
__tt_pv_hl "$name" "$base"
|
|
852
910
|
if (( color )); then
|
|
853
911
|
[[ -n ${tstrip[$t]} ]] || __tt_pv_strip $t
|
|
854
|
-
w=$(( lw -
|
|
912
|
+
w=$(( lw - 16 - ${#ind} - ${#name} ))
|
|
855
913
|
(( w < 1 )) && w=1
|
|
856
|
-
REPLY=$gut$on"
|
|
914
|
+
REPLY=$gut$on"$ind$mark $base$REPLY$r${(l:w:: :)}${tstrip[$t]} "$z
|
|
857
915
|
else
|
|
858
|
-
REPLY="$gut
|
|
916
|
+
REPLY="$gut$ind$mark $REPLY"
|
|
859
917
|
fi
|
|
860
918
|
}
|
|
861
919
|
|
|
@@ -893,9 +951,9 @@ __tt_pv_foot() {
|
|
|
893
951
|
note=$REPLY
|
|
894
952
|
(( pk == 2 )) && note+="/**"
|
|
895
953
|
elif (( pk == 1 )); then
|
|
896
|
-
note="
|
|
954
|
+
note="Until this tab closes"
|
|
897
955
|
else
|
|
898
|
-
note="
|
|
956
|
+
note="New tabs · the default palette"
|
|
899
957
|
fi
|
|
900
958
|
kk=(enter) kl=(confirm)
|
|
901
959
|
right=$b"esc"$z$d" back"$z
|
|
@@ -919,7 +977,7 @@ __tt_pv_foot() {
|
|
|
919
977
|
[[ -n $flt ]] && badge=FILTER
|
|
920
978
|
if (( ! ${#rval} )); then
|
|
921
979
|
kk=(bksp) kl=(edit)
|
|
922
|
-
elif [[ ${rtype[cur]} == hdr ]]; then
|
|
980
|
+
elif [[ ${rtype[cur]} == (hdr|cat) ]]; then
|
|
923
981
|
if [[ -z $flt && -n ${exp[${rval[cur]}]} ]]; then
|
|
924
982
|
kk=(←) kl=(close)
|
|
925
983
|
elif [[ -z $flt ]]; then
|
|
@@ -992,19 +1050,19 @@ __tt_pv_foot() {
|
|
|
992
1050
|
__tt_pv_help() {
|
|
993
1051
|
local back="the tab" z=$'\e[0m' b=$'\e[1m' blank
|
|
994
1052
|
[[ -n ${TTHEME_PALETTE[$cn]} ]] && back=$cn
|
|
995
|
-
local -a hk=(
|
|
1053
|
+
local -a hk=(Move Series Filter Apply) hv=(
|
|
996
1054
|
"↑↓ home end pgup pgdn"
|
|
997
1055
|
"←→ · enter or space on a series"
|
|
998
1056
|
"a-z 0-9 - · bksp · ctrl-u clears"
|
|
999
1057
|
"enter · esc restores $back"
|
|
1000
1058
|
)
|
|
1001
1059
|
if (( bgcw )); then
|
|
1002
|
-
hk+=("
|
|
1060
|
+
hk+=("Tune bg" "" "" "" "")
|
|
1003
1061
|
hv+=("tab · finds one on the boorus, or takes your own, if none" "↑↓ field ←→ step ⇧←→ ×10 1-9 place" "space hides · = default · f adds one from the boorus or your own" "enter keeps · esc undoes" ", . other saved images · D removes this one")
|
|
1004
1062
|
fi
|
|
1005
|
-
hk+=(
|
|
1063
|
+
hk+=(Config "")
|
|
1006
1064
|
hv+=("alt-c · ↑↓ setting ←→ value" "enter saves · esc undoes")
|
|
1007
|
-
hk+=(
|
|
1065
|
+
hk+=(Close)
|
|
1008
1066
|
hv+=("? esc")
|
|
1009
1067
|
(( color )) || z= b=
|
|
1010
1068
|
local -i i r x y w hh
|
|
@@ -1020,7 +1078,7 @@ __tt_pv_help() {
|
|
|
1020
1078
|
x=$(( (pw - w) / 2 + 1 )) y=$(( (ph - hh) / 2 ))
|
|
1021
1079
|
(( y < 4 )) && y=4
|
|
1022
1080
|
blank=${(l:w:: :)}
|
|
1023
|
-
out+=$'\e['$y';'$x'H'"╭─
|
|
1081
|
+
out+=$'\e['$y';'$x'H'"╭─ Keys ${(l:$(( w - 9 ))::─:)}╮"
|
|
1024
1082
|
for (( r = y + 1; r < y + hh - 1; r++ )); do
|
|
1025
1083
|
out+=$'\e['$r';'$x'H'$blank$'\e['$r';'$x'H│'$'\e['$r';'$(( x + w - 1 ))'H│'
|
|
1026
1084
|
done
|
|
@@ -1104,7 +1162,7 @@ __tt_pv_tune() {
|
|
|
1104
1162
|
;;
|
|
1105
1163
|
$'\r'|$'\n')
|
|
1106
1164
|
if [[ "${bgsize[$tune]} ${bgpos[$tune]} ${bgop[$tune]} ${bgoff[$tune]}" != "$tsnap" ]]; then
|
|
1107
|
-
bgedit[$tune]=1 msg="
|
|
1165
|
+
bgedit[$tune]=1 msg="Kept · saved when preview closes" msgt=200
|
|
1108
1166
|
fi
|
|
1109
1167
|
tune=""
|
|
1110
1168
|
;;
|
|
@@ -1184,11 +1242,11 @@ __tt_pv_conf_save() {
|
|
|
1184
1242
|
fi
|
|
1185
1243
|
__tt_tilde "$TTHEME_CONFIG"
|
|
1186
1244
|
if __tt_config_write "${pairs[@]}"; then
|
|
1187
|
-
conf=0 msg="
|
|
1245
|
+
conf=0 msg="Saved · $REPLY" msgt=200
|
|
1188
1246
|
(( ${pairs[(Ie)TTHEME_BG_BLUR]} )) && __tt_pv_redraw
|
|
1189
1247
|
else
|
|
1190
1248
|
__tt_pv_unconf
|
|
1191
|
-
msg="
|
|
1249
|
+
msg="Could not write $REPLY" msgt=200
|
|
1192
1250
|
fi
|
|
1193
1251
|
}
|
|
1194
1252
|
|
|
@@ -1200,7 +1258,7 @@ __tt_pv_redraw() {
|
|
|
1200
1258
|
done
|
|
1201
1259
|
fi
|
|
1202
1260
|
bgedit=()
|
|
1203
|
-
msg="
|
|
1261
|
+
msg="Drawing the background pictures again" msgt=300
|
|
1204
1262
|
printf '\e[?2026h'
|
|
1205
1263
|
__tt_pv_draw
|
|
1206
1264
|
__tt_pv_bg_close
|
|
@@ -1208,7 +1266,7 @@ __tt_pv_redraw() {
|
|
|
1208
1266
|
bgsrc=() resized=1 bgname="" bgshown="" bgdim=()
|
|
1209
1267
|
__tt_reload
|
|
1210
1268
|
(( $+functions[__tt_bg_refresh] )) && __tt_bg_refresh $TTHEME_ORDER
|
|
1211
|
-
msg=${${out//$'\n'/ }:-"
|
|
1269
|
+
msg=${${out//$'\n'/ }:-"Saved · no background pictures to draw"} msgt=300
|
|
1212
1270
|
}
|
|
1213
1271
|
|
|
1214
1272
|
__tt_pv_conf_panel() {
|
|
@@ -1270,7 +1328,7 @@ __tt_pv_flush() {
|
|
|
1270
1328
|
}
|
|
1271
1329
|
|
|
1272
1330
|
__tt_pv_draw() {
|
|
1273
|
-
local out line cnt ex ag="" ac="" sb="" dd="" zz="" state=on src="" REPLY
|
|
1331
|
+
local out line cnt ex ag="" acat="" ac="" sb="" dd="" zz="" state=on src="" REPLY
|
|
1274
1332
|
local -i lw sw split sc se=$(( pw - 2 )) h k i N=${#rval} mt=${#TTHEME_ORDER} wiped=0
|
|
1275
1333
|
__tt_pv_lw
|
|
1276
1334
|
lw=$reply[1] sw=$reply[2]
|
|
@@ -1291,7 +1349,10 @@ __tt_pv_draw() {
|
|
|
1291
1349
|
printf -v ac '\e[38;2;%d;%d;%dm' $((16#${acx:0:2})) $((16#${acx:2:2})) $((16#${acx:4:2}))
|
|
1292
1350
|
printf -v sb '\e[48;2;%d;%d;%dm' $((16#${sbx:0:2})) $((16#${sbx:2:2})) $((16#${sbx:4:2}))
|
|
1293
1351
|
fi
|
|
1294
|
-
[[ ${rtype[cur]} == thm ]]
|
|
1352
|
+
if [[ ${rtype[cur]} == thm ]]; then
|
|
1353
|
+
ag=${TTHEME_GROUP[${rval[cur]}]:-Other}
|
|
1354
|
+
[[ -n ${TTHEME_CATALOG[${rval[cur]}]} ]] && acat=$ag/${TTHEME_CATALOG[${rval[cur]}]}
|
|
1355
|
+
fi
|
|
1295
1356
|
fi
|
|
1296
1357
|
if [[ -n $flt ]]; then
|
|
1297
1358
|
local -a mm=(${(M)rtype:#thm})
|
|
@@ -1307,7 +1368,7 @@ __tt_pv_draw() {
|
|
|
1307
1368
|
if (( pw < 40 || ph < 12 )); then
|
|
1308
1369
|
line="ttheme preview"
|
|
1309
1370
|
(( color )) && line=$'\e[1m'$ac$line$'\e[0m'
|
|
1310
|
-
out+=$line$'\e[K\n'"
|
|
1371
|
+
out+=$line$'\e[K\n'"Needs 40×12 — now ${pw}×${ph}"$'\e[K\n'
|
|
1311
1372
|
line="esc quits"
|
|
1312
1373
|
(( color )) && line=$'\e[2m'$line$'\e[0m'
|
|
1313
1374
|
out+=$line$'\e[K\e[J'
|
|
@@ -1340,7 +1401,7 @@ __tt_pv_draw() {
|
|
|
1340
1401
|
ex="${ex[1,gkeep]}▏"
|
|
1341
1402
|
fi
|
|
1342
1403
|
fi
|
|
1343
|
-
line=" "$dd"
|
|
1404
|
+
line=" "$dd"Search… e.g. $ex"$zz
|
|
1344
1405
|
fi
|
|
1345
1406
|
local tail=$'\e['$(( lw - ${#cnt} ))'G'$dd$cnt$zz
|
|
1346
1407
|
[[ -n $flt ]] && tail=$'\e['$(( lw - ${#cnt} ))'G'$cnt
|
|
@@ -1357,7 +1418,7 @@ __tt_pv_draw() {
|
|
|
1357
1418
|
line=""
|
|
1358
1419
|
if (( k < h )); then
|
|
1359
1420
|
if (( ! N )); then
|
|
1360
|
-
(( k == 0 )) && line=" ${dd}
|
|
1421
|
+
(( k == 0 )) && line=" ${dd}No palettes match '$flt'$zz"
|
|
1361
1422
|
elif (( i <= N )); then
|
|
1362
1423
|
__tt_pv_row $i
|
|
1363
1424
|
line=$REPLY
|
|
@@ -1370,20 +1431,20 @@ __tt_pv_draw() {
|
|
|
1370
1431
|
__tt_pv_foot $(( split ? se : pw ))
|
|
1371
1432
|
if (( split )); then
|
|
1372
1433
|
if (( help && sw >= 48 )); then
|
|
1373
|
-
__tt_pv_head 1 $sc $se
|
|
1434
|
+
__tt_pv_head 1 $sc $se Keys
|
|
1374
1435
|
__tt_pv_help
|
|
1375
1436
|
elif [[ -n $tune ]]; then
|
|
1376
1437
|
(( bgoff[$tune] )) && state=off
|
|
1377
|
-
src=
|
|
1438
|
+
src=Background
|
|
1378
1439
|
[[ -n ${bgfrom[$tune]} ]] && src+=" · ${bgfrom[$tune]}"
|
|
1379
|
-
(( ${#tune} + ${#src} + 6 > sw )) && src=
|
|
1440
|
+
(( ${#tune} + ${#src} + 6 > sw )) && src=Background
|
|
1380
1441
|
__tt_pv_head 1 $sc $se $tune "$src" $state
|
|
1381
1442
|
__tt_pv_bg_panel $tune 4 $sc $se
|
|
1382
1443
|
elif (( conf )); then
|
|
1383
1444
|
__tt_tilde "$TTHEME_CONFIG"
|
|
1384
1445
|
src=$REPLY
|
|
1385
1446
|
(( 8 + ${#src} > sw )) && src=""
|
|
1386
|
-
__tt_pv_head 1 $sc $se
|
|
1447
|
+
__tt_pv_head 1 $sc $se Config "" "$src"
|
|
1387
1448
|
__tt_pv_conf_panel 4 $sc $se
|
|
1388
1449
|
else
|
|
1389
1450
|
[[ -n $an ]] && src=${TTHEME_SRC[$an]}
|
|
@@ -1395,13 +1456,13 @@ __tt_pv_draw() {
|
|
|
1395
1456
|
else
|
|
1396
1457
|
if [[ -n $tune ]]; then
|
|
1397
1458
|
(( bgoff[$tune] )) && state=off
|
|
1398
|
-
src=
|
|
1459
|
+
src=Background
|
|
1399
1460
|
[[ -n ${bgfrom[$tune]} ]] && src+=" · ${bgfrom[$tune]}"
|
|
1400
|
-
(( ${#tune} + ${#src} + 6 > lw )) && src=
|
|
1461
|
+
(( ${#tune} + ${#src} + 6 > lw )) && src=Background
|
|
1401
1462
|
__tt_pv_head $(( ph - 9 )) 1 $lw $tune "$src" $state
|
|
1402
1463
|
__tt_pv_bg_panel $tune $(( ph - 8 )) 1 $lw
|
|
1403
1464
|
elif (( conf )); then
|
|
1404
|
-
__tt_pv_head $(( ph - 7 )) 1 $lw
|
|
1465
|
+
__tt_pv_head $(( ph - 7 )) 1 $lw Config
|
|
1405
1466
|
__tt_pv_conf_panel $(( ph - 6 )) 1 $lw
|
|
1406
1467
|
fi
|
|
1407
1468
|
(( help )) && __tt_pv_help
|
|
@@ -1597,13 +1658,13 @@ __tt_pv_handle() {
|
|
|
1597
1658
|
sel=${rval[cur]}
|
|
1598
1659
|
return 1
|
|
1599
1660
|
fi
|
|
1600
|
-
elif [[ ${rtype[cur]} == hdr ]]; then
|
|
1661
|
+
elif [[ ${rtype[cur]} == (hdr|cat) ]]; then
|
|
1601
1662
|
__tt_pv_toggle
|
|
1602
1663
|
fi
|
|
1603
1664
|
;;
|
|
1604
1665
|
up) (( cur > 1 )) && cur=$(( cur - 1 )); [[ ${rtype[cur]} == rule ]] && cur=$(( cur - 1 )) ;;
|
|
1605
1666
|
down) (( cur < ${#rval} )) && cur=$(( cur + 1 )); [[ ${rtype[cur]} == rule ]] && cur=$(( cur + 1 )) ;;
|
|
1606
|
-
right) [[ ${rtype[cur]} == hdr && -z ${exp[${rval[cur]}]} ]] && __tt_pv_toggle ;;
|
|
1667
|
+
right) [[ ${rtype[cur]} == (hdr|cat) && -z ${exp[${rval[cur]}]} ]] && __tt_pv_toggle ;;
|
|
1607
1668
|
left) __tt_pv_left ;;
|
|
1608
1669
|
home) cur=1 ;;
|
|
1609
1670
|
end) (( ${#rval} )) && cur=${#rval} ;;
|
|
@@ -1618,7 +1679,7 @@ __tt_pv_handle() {
|
|
|
1618
1679
|
(( cur < 1 )) && cur=1
|
|
1619
1680
|
[[ ${rtype[cur]} == rule ]] && cur=$(( cur + 1 ))
|
|
1620
1681
|
;;
|
|
1621
|
-
' ') [[ ${rtype[cur]} == hdr ]] && __tt_pv_toggle ;;
|
|
1682
|
+
' ') [[ ${rtype[cur]} == (hdr|cat) ]] && __tt_pv_toggle ;;
|
|
1622
1683
|
$'\t')
|
|
1623
1684
|
[[ ${rtype[cur]} == thm ]] || return 0
|
|
1624
1685
|
name=${rval[cur]}
|
|
@@ -1627,7 +1688,7 @@ __tt_pv_handle() {
|
|
|
1627
1688
|
elif __tt_pv_bg_findable $name; then
|
|
1628
1689
|
:
|
|
1629
1690
|
elif (( bgcw )); then
|
|
1630
|
-
msg="
|
|
1691
|
+
msg="No background image for $name" msgt=200
|
|
1631
1692
|
fi
|
|
1632
1693
|
;;
|
|
1633
1694
|
altc)
|
|
@@ -1672,19 +1733,19 @@ __tt_preview() {
|
|
|
1672
1733
|
local -a bgorder=()
|
|
1673
1734
|
local -A bgfrom=() bgsent=() bgcost=() bgdim=() bgsrc=() bgfill=() bgfocus=() bgsize=() bgpos=() bgop=() bgdef=() bgoff=() bgbase=() bgload=() bgshot=() bgshotkey=() bgedit=() bgtunef=() bgofff=() bgimages=()
|
|
1674
1735
|
local conf=0 cf=1
|
|
1675
|
-
local -a plabel=("
|
|
1676
|
-
local -a cvars=(TTHEME_TAB_PALETTE TTHEME_ANNOUNCE TTHEME_FX TTHEME_SORT TTHEME_BG_BLUR) clabel=("
|
|
1736
|
+
local -a plabel=(" This tab " " Default ") csnap=()
|
|
1737
|
+
local -a cvars=(TTHEME_TAB_PALETTE TTHEME_ANNOUNCE TTHEME_FX TTHEME_SORT TTHEME_BG_BLUR) clabel=("New tabs" Announce "Search fx" Sort Blur)
|
|
1677
1738
|
local -a cchoice=("off seq" "1 0" "typewriter decode glitch" "abc series" "0 1 2 3 4") cshow=("off seq" "on off" "typewriter decode glitch" "abc series" "off 1px 2px 3px 4px")
|
|
1678
1739
|
local -A cnote=(
|
|
1679
|
-
TTHEME_TAB_PALETTE:seq "
|
|
1680
|
-
TTHEME_ANNOUNCE:1 "
|
|
1681
|
-
TTHEME_FX:typewriter "
|
|
1682
|
-
TTHEME_SORT:abc "
|
|
1683
|
-
TTHEME_BG_BLUR:0 "
|
|
1684
|
-
TTHEME_BG_BLUR:2 "
|
|
1685
|
-
TTHEME_BG_BLUR:4 "
|
|
1740
|
+
TTHEME_TAB_PALETTE:seq "New tabs rotate through palettes" TTHEME_TAB_PALETTE:off "New tabs keep the terminal theme"
|
|
1741
|
+
TTHEME_ANNOUNCE:1 "Shows the palette notice" TTHEME_ANNOUNCE:0 "Silences the palette notice"
|
|
1742
|
+
TTHEME_FX:typewriter "The search hint types itself" TTHEME_FX:decode "The search hint decodes" TTHEME_FX:glitch "The search hint glitches in"
|
|
1743
|
+
TTHEME_SORT:abc "Series and palettes by name" TTHEME_SORT:series "Series in the order added"
|
|
1744
|
+
TTHEME_BG_BLUR:0 "Pictures stay sharp" TTHEME_BG_BLUR:1 "Pictures soften a little behind the text"
|
|
1745
|
+
TTHEME_BG_BLUR:2 "Pictures soften behind the text" TTHEME_BG_BLUR:3 "Pictures blur behind the text"
|
|
1746
|
+
TTHEME_BG_BLUR:4 "Pictures blur well behind the text"
|
|
1686
1747
|
)
|
|
1687
|
-
[[ $mode == pin ]] && pkdef=2 plabel=("
|
|
1748
|
+
[[ $mode == pin ]] && pkdef=2 plabel=(" This directory " " And below ")
|
|
1688
1749
|
[[ $mode == init ]] && pkdef=2
|
|
1689
1750
|
__tt_pv_canpick
|
|
1690
1751
|
__tt_pv_size
|
|
@@ -1829,9 +1890,11 @@ if (( $+functions[compdef] )); then
|
|
|
1829
1890
|
compadd -- add remove search init
|
|
1830
1891
|
elif [[ $words[2] == market && $words[3] == (add|init) && CURRENT == 4 ]]; then
|
|
1831
1892
|
_files -/
|
|
1893
|
+
elif [[ $words[2] == add && $words[CURRENT-1] == --market ]]; then
|
|
1894
|
+
_files -/
|
|
1832
1895
|
elif [[ $words[2] == add ]]; then
|
|
1833
1896
|
reply=(${${${(M)${(f)"$(__tt_cli list --json 2>/dev/null)"}:#*\"name\": *}#*\"name\": \"}%%\"*})
|
|
1834
|
-
compadd -- ${reply:|TTHEME_ORDER}
|
|
1897
|
+
compadd -- --market ${reply:|TTHEME_ORDER}
|
|
1835
1898
|
fi
|
|
1836
1899
|
}
|
|
1837
1900
|
compdef __tt_complete ttheme
|