@kecan0406/ttheme 1.0.43 → 1.0.45
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 +55 -15
- package/bin/ttheme.js +199 -172
- package/bin/ttheme.js.map +1 -1
- package/dist/manifest.json +1 -1
- package/package.json +1 -1
- package/shell/adapters/_bg.zsh +6 -6
- package/shell/adapters/ghostty.zsh +2 -2
- package/shell/adapters/iterm2.zsh +1 -1
- package/shell/ttheme.zsh +35 -21
package/dist/manifest.json
CHANGED
package/package.json
CHANGED
package/shell/adapters/_bg.zsh
CHANGED
|
@@ -6,7 +6,7 @@ __tt_ghostty_shown() {
|
|
|
6
6
|
[[ -r $f ]] || return 1
|
|
7
7
|
REPLY=${${"$(<$f)"}##*\?}
|
|
8
8
|
REPLY=${REPLY%.conf}
|
|
9
|
-
REPLY=${REPLY/--//}
|
|
9
|
+
REPLY=${${REPLY/--/@}/--//}
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
__tt_put() {
|
|
@@ -92,7 +92,7 @@ __tt_bg_path() {
|
|
|
92
92
|
}
|
|
93
93
|
|
|
94
94
|
__tt_bg_load() {
|
|
95
|
-
local name=$1 file=${1/\//--} dir=${TTHEME_CONFIG:h}/backgrounds img="" fit=contain op=1 pos=center f line stem="" size=100 REPLY
|
|
95
|
+
local name=$1 file=${${1/@/--}/\//--} dir=${TTHEME_CONFIG:h}/backgrounds img="" fit=contain op=1 pos=center f line stem="" size=100 REPLY
|
|
96
96
|
local -i at=5
|
|
97
97
|
local -a fills lines
|
|
98
98
|
(( ${+bgsrc[$name]} )) && return 0
|
|
@@ -189,7 +189,7 @@ __tt_bg_bake() {
|
|
|
189
189
|
}
|
|
190
190
|
|
|
191
191
|
__tt_bg_include() {
|
|
192
|
-
local file=${1/\//--}
|
|
192
|
+
local file=${${1/@/--}/\//--}
|
|
193
193
|
local conf=${TTHEME_CONFIG:h}/backgrounds/$file.conf line
|
|
194
194
|
local -a lines=() add=()
|
|
195
195
|
[[ -r $conf ]] && lines=("${(@f)$(<$conf)}")
|
|
@@ -205,7 +205,7 @@ __tt_bg_write() {
|
|
|
205
205
|
local pos=${TTHEME_BG_POSITIONS[${bgpos[$1]}]}
|
|
206
206
|
local -i W=$(( (pw + 2 * bgmx) * bgcw )) H=$(( (ph + 2 * bgmy) * bgch ))
|
|
207
207
|
local -a wh fr
|
|
208
|
-
[[ -r $dir/${name/\//--}.conf ]] || return 0
|
|
208
|
+
[[ -r $dir/${${name/@/--}/\//--}.conf ]] || return 0
|
|
209
209
|
__tt_bg_include $name || return 1
|
|
210
210
|
if [[ "$size ${bgpos[$1]} ${bgop[$1]}" == "${bgdef[$1]}" ]]; then
|
|
211
211
|
rm -f -- $dir/${bgtunef[$1]}
|
|
@@ -449,7 +449,7 @@ __tt_pv_bg_image() {
|
|
|
449
449
|
__tt_bg_load $name
|
|
450
450
|
bgload[$name]="" bgedit[$name]=1
|
|
451
451
|
msg=${err:-"background · $name"} msgt=$(( rc ? 300 : 200 ))
|
|
452
|
-
[[ -r ${TTHEME_CONFIG:h}/backgrounds/${name/\//--}.conf ]] || return 0
|
|
452
|
+
[[ -r ${TTHEME_CONFIG:h}/backgrounds/${${name/@/--}/\//--}.conf ]] || return 0
|
|
453
453
|
tune=$name tf=1 tsnap="${bgsize[$name]} ${bgpos[$name]} ${bgop[$name]} ${bgoff[$name]}"
|
|
454
454
|
}
|
|
455
455
|
|
|
@@ -527,7 +527,7 @@ __tt_pv_bg_save() {
|
|
|
527
527
|
continue
|
|
528
528
|
fi
|
|
529
529
|
saved+=($name)
|
|
530
|
-
if [[ ! -r ${TTHEME_CONFIG:h}/backgrounds/${name/\//--}.conf ]]; then
|
|
530
|
+
if [[ ! -r ${TTHEME_CONFIG:h}/backgrounds/${${name/@/--}/\//--}.conf ]]; then
|
|
531
531
|
msg="background · $name none"
|
|
532
532
|
elif (( bgoff[$name] )); then
|
|
533
533
|
msg="background · $name off"
|
|
@@ -22,9 +22,9 @@ __tt_shown() {
|
|
|
22
22
|
__tt_bg_shown
|
|
23
23
|
was=$REPLY
|
|
24
24
|
[[ $was == $1 ]] && return 1
|
|
25
|
-
[[ -r $dir/${1/\//--}.conf || ( -n $was && -r $dir/${was/\//--}.conf ) ]] || return 1
|
|
25
|
+
[[ -r $dir/${${1/@/--}/\//--}.conf || ( -n $was && -r $dir/${${was/@/--}/\//--}.conf ) ]] || return 1
|
|
26
26
|
[[ -d $dir ]] || mkdir -p $dir || return 1
|
|
27
|
-
__tt_put $dir/shown.conf "config-file = ?${1/\//--}.conf"
|
|
27
|
+
__tt_put $dir/shown.conf "config-file = ?${${1/@/--}/\//--}.conf"
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
__tt_bg_cells() {
|
|
@@ -20,7 +20,7 @@ __tt_shown() {
|
|
|
20
20
|
__tt_bg_shown
|
|
21
21
|
was=$REPLY
|
|
22
22
|
[[ $2 != force && $was == $1 ]] && return 1
|
|
23
|
-
[[ -r $dir/${1/\//--}.conf || ( -n $was && -r $dir/${was/\//--}.conf ) ]] || (( TTHEME_MUXED )) || return 1
|
|
23
|
+
[[ -r $dir/${${1/@/--}/\//--}.conf || ( -n $was && -r $dir/${${was/@/--}/\//--}.conf ) ]] || (( TTHEME_MUXED )) || return 1
|
|
24
24
|
(( ${TTHEME_ORDER[(Ie)$1]} )) || return 1
|
|
25
25
|
__tt_out $'\e]1337;SetProfile=ttheme · '$1$'\a'
|
|
26
26
|
TTHEME_ITERM_SHOWN=$1
|
package/shell/ttheme.zsh
CHANGED
|
@@ -404,6 +404,7 @@ __tt_menu() {
|
|
|
404
404
|
for k in $reply; do
|
|
405
405
|
grp=${TTHEME_GROUP[$k]:-Other}
|
|
406
406
|
if [[ $grp != $last_grp ]]; then
|
|
407
|
+
[[ $grp == *@* && $last_grp != *@* && -n $last_grp ]] && printf '\033[2m── markets ──────────\033[0m\n'
|
|
407
408
|
printf '\033[1m%s\033[0m' "$grp"
|
|
408
409
|
[[ -n ${TTHEME_NATIVE[$k]} ]] && printf ' \033[2m%s\033[0m' "${TTHEME_NATIVE[$k]}"
|
|
409
410
|
printf '\n'
|
|
@@ -417,17 +418,11 @@ __tt_menu() {
|
|
|
417
418
|
}
|
|
418
419
|
|
|
419
420
|
__tt_help() {
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
print
|
|
426
|
-
else
|
|
427
|
-
print -r -- " ${(r:16:)${:-ttheme $v}}$TTHEME_VERB_ABOUT[$v]"
|
|
428
|
-
fi
|
|
429
|
-
done
|
|
430
|
-
print -r -- $'\nttheme <command> --help describes one command · ttheme --version prints the version'
|
|
421
|
+
if [[ $1 == all ]]; then
|
|
422
|
+
print -r -- $TTHEME_HELP_ALL
|
|
423
|
+
else
|
|
424
|
+
print -r -- $TTHEME_HELP
|
|
425
|
+
fi
|
|
431
426
|
}
|
|
432
427
|
|
|
433
428
|
__tt_usage() {
|
|
@@ -435,7 +430,9 @@ __tt_usage() {
|
|
|
435
430
|
}
|
|
436
431
|
|
|
437
432
|
__tt_verb_help() {
|
|
438
|
-
if
|
|
433
|
+
if [[ -z $1 || $1 == all ]]; then
|
|
434
|
+
__tt_help $1
|
|
435
|
+
elif (( ${TTHEME_SHELL_VERBS[(Ie)$1]} )); then
|
|
439
436
|
__tt_usage $1
|
|
440
437
|
elif [[ -n $1 && -n ${TTHEME_VERB_ABOUT[$1]} ]]; then
|
|
441
438
|
__tt_cli $1 --help
|
|
@@ -472,7 +469,7 @@ __tt_cli() {
|
|
|
472
469
|
__tt_catalog() {
|
|
473
470
|
local was
|
|
474
471
|
__tt_cli "$@" || return
|
|
475
|
-
[[ $1 == (list|share|
|
|
472
|
+
[[ $1 == (list|share|market) ]] && return 0
|
|
476
473
|
[[ -r $TTHEME_HOME/palettes.zsh ]] || return 0
|
|
477
474
|
was="$TTHEME_STARTUP ${TTHEME_PALETTE[$TTHEME_STARTUP]}"
|
|
478
475
|
__tt_palettes_load && __tt_reloaded
|
|
@@ -593,7 +590,7 @@ __tt_rotate() {
|
|
|
593
590
|
|
|
594
591
|
__tt_pv_rows() {
|
|
595
592
|
rtype=() rval=() rcnt=()
|
|
596
|
-
local g t gm
|
|
593
|
+
local g t gm ruled=""
|
|
597
594
|
local -a ts
|
|
598
595
|
for g in $groups; do
|
|
599
596
|
ts=()
|
|
@@ -603,6 +600,10 @@ __tt_pv_rows() {
|
|
|
603
600
|
[[ -z $flt || -n $gm || $t == *$flt* ]] && ts+=($t)
|
|
604
601
|
done
|
|
605
602
|
[[ -n $flt ]] && (( ! ${#ts} )) && continue
|
|
603
|
+
if [[ $g == *@* && -z $ruled ]]; then
|
|
604
|
+
ruled=1
|
|
605
|
+
(( ${#rtype} )) && { rtype+=(rule); rval+=(''); rcnt+=(0) }
|
|
606
|
+
fi
|
|
606
607
|
rtype+=(hdr); rval+=($g); rcnt+=(${#ts})
|
|
607
608
|
if [[ -n $flt || -n ${exp[$g]} ]]; then
|
|
608
609
|
for t in $ts; do rtype+=(thm); rval+=($t); rcnt+=(0); done
|
|
@@ -737,6 +738,11 @@ __tt_pv_row() {
|
|
|
737
738
|
local -i w
|
|
738
739
|
(( color )) || b= d= r= z= lead=
|
|
739
740
|
(( $1 == cur && color )) && on=$sb
|
|
741
|
+
if [[ ${rtype[$1]} == rule ]]; then
|
|
742
|
+
name='── markets '
|
|
743
|
+
REPLY=$d$name${(l:lw - 2 - ${#name}::─:)}$z
|
|
744
|
+
return 0
|
|
745
|
+
fi
|
|
740
746
|
if [[ ${rtype[$1]} == hdr ]]; then
|
|
741
747
|
[[ -n $flt || -n ${exp[$t]} ]] && arrow=▾
|
|
742
748
|
name=$t
|
|
@@ -1483,8 +1489,8 @@ __tt_pv_handle() {
|
|
|
1483
1489
|
__tt_pv_toggle
|
|
1484
1490
|
fi
|
|
1485
1491
|
;;
|
|
1486
|
-
up) (( cur > 1 )) && cur=$(( cur - 1 )) ;;
|
|
1487
|
-
down) (( cur < ${#rval} )) && cur=$(( cur + 1 )) ;;
|
|
1492
|
+
up) (( cur > 1 )) && cur=$(( cur - 1 )); [[ ${rtype[cur]} == rule ]] && cur=$(( cur - 1 )) ;;
|
|
1493
|
+
down) (( cur < ${#rval} )) && cur=$(( cur + 1 )); [[ ${rtype[cur]} == rule ]] && cur=$(( cur + 1 )) ;;
|
|
1488
1494
|
right) [[ ${rtype[cur]} == hdr && -z ${exp[${rval[cur]}]} ]] && __tt_pv_toggle ;;
|
|
1489
1495
|
left) __tt_pv_left ;;
|
|
1490
1496
|
home) cur=1 ;;
|
|
@@ -1492,11 +1498,13 @@ __tt_pv_handle() {
|
|
|
1492
1498
|
pgup)
|
|
1493
1499
|
cur=$(( cur - ph + 5 ))
|
|
1494
1500
|
(( cur < 1 )) && cur=1
|
|
1501
|
+
[[ ${rtype[cur]} == rule ]] && cur=$(( cur - 1 ))
|
|
1495
1502
|
;;
|
|
1496
1503
|
pgdn)
|
|
1497
1504
|
cur=$(( cur + ph - 5 ))
|
|
1498
1505
|
(( cur > ${#rval} )) && cur=${#rval}
|
|
1499
1506
|
(( cur < 1 )) && cur=1
|
|
1507
|
+
[[ ${rtype[cur]} == rule ]] && cur=$(( cur + 1 ))
|
|
1500
1508
|
;;
|
|
1501
1509
|
' ') [[ ${rtype[cur]} == hdr ]] && __tt_pv_toggle ;;
|
|
1502
1510
|
$'\t')
|
|
@@ -1635,7 +1643,7 @@ ttheme() {
|
|
|
1635
1643
|
print -u2 "ttheme: unknown command '$1' — see \`ttheme help\`"
|
|
1636
1644
|
return 1
|
|
1637
1645
|
fi
|
|
1638
|
-
if [[ $TTHEME_ADAPTER == warp && $1 != (browse|list|add|remove|update|new|edit|check|share|
|
|
1646
|
+
if [[ $TTHEME_ADAPTER == warp && $1 != (browse|list|add|remove|update|market|new|edit|check|share|config|default|on|off) ]]; then
|
|
1639
1647
|
print -u2 "ttheme: Warp wears one theme app-wide and paints no tab background of its own — \`ttheme default <palette>\` puts one on every Warp window"
|
|
1640
1648
|
return 1
|
|
1641
1649
|
fi
|
|
@@ -1646,7 +1654,7 @@ ttheme() {
|
|
|
1646
1654
|
fi
|
|
1647
1655
|
|
|
1648
1656
|
case $1 in
|
|
1649
|
-
browse|list|add|remove|update|new|edit|check|share
|
|
1657
|
+
browse|list|add|remove|update|market|new|edit|check|share) __tt_catalog "$@"; return ;;
|
|
1650
1658
|
on|off) __tt_switch "$@"; return ;;
|
|
1651
1659
|
esac
|
|
1652
1660
|
__tt_arity "$@" || return
|
|
@@ -1676,13 +1684,19 @@ if (( $+functions[compdef] )); then
|
|
|
1676
1684
|
__tt_complete() {
|
|
1677
1685
|
local -a reply
|
|
1678
1686
|
if (( CURRENT == 2 )); then
|
|
1679
|
-
compadd -- $
|
|
1680
|
-
elif [[ $words[2] == remove || ( $words[2] == (use|default|edit|check|share
|
|
1687
|
+
compadd -- $TTHEME_VERBS help
|
|
1688
|
+
elif [[ $words[2] == remove || ( $words[2] == (use|default|edit|check|share) && CURRENT == 3 ) ]]; then
|
|
1681
1689
|
compadd -- $TTHEME_ORDER
|
|
1682
1690
|
elif [[ $words[2] == new && $words[CURRENT-1] == --from ]]; then
|
|
1683
1691
|
compadd -- $TTHEME_ORDER
|
|
1692
|
+
elif [[ $words[2] == new && $words[CURRENT-1] == --in ]]; then
|
|
1693
|
+
_files -/
|
|
1684
1694
|
elif [[ $words[2] == new ]]; then
|
|
1685
|
-
compadd -- --from
|
|
1695
|
+
compadd -- --from --in
|
|
1696
|
+
elif [[ $words[2] == market && CURRENT == 3 ]]; then
|
|
1697
|
+
compadd -- add remove search init
|
|
1698
|
+
elif [[ $words[2] == market && $words[3] == (add|init) && CURRENT == 4 ]]; then
|
|
1699
|
+
_files -/
|
|
1686
1700
|
elif [[ $words[2] == add ]]; then
|
|
1687
1701
|
reply=(${${${(M)${(f)"$(__tt_cli list --json 2>/dev/null)"}:#*\"name\": *}#*\"name\": \"}%%\"*})
|
|
1688
1702
|
compadd -- ${reply:|TTHEME_ORDER}
|