@kecan0406/ttheme 1.1.6 → 1.2.1
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 +10 -9
- package/bin/ttheme.js +189 -179
- package/bin/ttheme.js.map +1 -1
- package/dist/manifest.json +1 -1
- package/package.json +4 -3
- package/shell/adapters/_bg.zsh +68 -18
- package/shell/adapters/_osc.zsh +6 -0
- package/shell/adapters/_wired.zsh +55 -0
- package/shell/adapters/ghostty.zsh +2 -0
- package/shell/adapters/kitty.zsh +2 -0
- package/shell/adapters/konsole.zsh +45 -0
- package/shell/adapters/warp.zsh +5 -0
- package/shell/adapters/windows-terminal.zsh +2 -0
- package/shell/ttheme.zsh +45 -47
package/dist/manifest.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kecan0406/ttheme",
|
|
3
|
-
"version": "1.1
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"ttheme": "bin/ttheme.js"
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"shell",
|
|
12
12
|
"!shell/check.zsh"
|
|
13
13
|
],
|
|
14
|
-
"description": "Character terminal palettes for Ghostty, kitty, Alacritty, WezTerm, iTerm2, Windows Terminal and
|
|
14
|
+
"description": "Character terminal palettes for Ghostty, kitty, Alacritty, WezTerm, iTerm2, Windows Terminal, Warp and Konsole",
|
|
15
15
|
"license": "MIT",
|
|
16
16
|
"author": "kecan0406",
|
|
17
17
|
"repository": {
|
|
@@ -27,7 +27,8 @@
|
|
|
27
27
|
"kitty",
|
|
28
28
|
"alacritty",
|
|
29
29
|
"wezterm",
|
|
30
|
-
"iterm2"
|
|
30
|
+
"iterm2",
|
|
31
|
+
"konsole"
|
|
31
32
|
],
|
|
32
33
|
"devDependencies": {
|
|
33
34
|
"@biomejs/biome": "^2.3.0",
|
package/shell/adapters/_bg.zsh
CHANGED
|
@@ -1,19 +1,8 @@
|
|
|
1
1
|
typeset -ga TTHEME_BG_POSITIONS=(top-left top-center top-right center-left center center-right bottom-left bottom-center bottom-right)
|
|
2
2
|
|
|
3
|
-
__tt_ghostty_shown() {
|
|
4
|
-
local f=${TTHEME_CONFIG:h}/backgrounds/shown.conf
|
|
5
|
-
REPLY=""
|
|
6
|
-
[[ -r $f ]] || return 1
|
|
7
|
-
REPLY=${${"$(<$f)"}##*\?}
|
|
8
|
-
REPLY=${REPLY%.conf}
|
|
9
|
-
REPLY=${${REPLY/--/@}/--//}
|
|
10
|
-
}
|
|
11
|
-
|
|
12
3
|
__tt_bg_saved() {
|
|
13
|
-
|
|
14
|
-
(( ${TTHEME_TERMINALS[(Ie)iterm2]} )) && __tt_cli image $1 tuned
|
|
4
|
+
__tt_pictured "$@"
|
|
15
5
|
__tt_bg_refresh "$@"
|
|
16
|
-
__tt_ghostty_shown && (( ${@[(Ie)$REPLY]} )) && __tt_reload
|
|
17
6
|
return 0
|
|
18
7
|
}
|
|
19
8
|
|
|
@@ -21,8 +10,6 @@ __tt_bg_refresh() { : }
|
|
|
21
10
|
|
|
22
11
|
__tt_bg_lasting() { : }
|
|
23
12
|
|
|
24
|
-
__tt_bg_aligns() { (( ! ${TTHEME_TERMINALS[(Ie)iterm2]} )) }
|
|
25
|
-
|
|
26
13
|
__tt_bg_frame() {
|
|
27
14
|
local -i iw=$1 ih=$2 W=$3 H=$4 s=$5 ax=$(( ($6 - 1) % 3 )) ay=$(( ($6 - 1) / 3 )) f=${8:--1} wide dw dh ox oy
|
|
28
15
|
wide=$(( W * ih >= H * iw ))
|
|
@@ -88,12 +75,16 @@ __tt_bg_load() {
|
|
|
88
75
|
bgimages[$name]=${bgimages[$pal]:-1}
|
|
89
76
|
elif [[ -r $dir/$file.conf ]]; then
|
|
90
77
|
lines=("${(@f)$(<$dir/$file.conf)}")
|
|
78
|
+
for line in ${(k)bgcolors[(I)${(b)pal}:*]}; do
|
|
79
|
+
unset "bgcolors[$line]"
|
|
80
|
+
done
|
|
91
81
|
fi
|
|
92
82
|
for line in $lines; do
|
|
93
83
|
case $line in
|
|
94
84
|
'config-file = ?'*.tune.conf) bgtunef[$name]=${line#config-file = \?} ;;
|
|
95
85
|
'config-file = ?'*.off.conf) bgofff[$name]=${line#config-file = \?} ;;
|
|
96
86
|
'# image '*/<->) bgimages[$name]=${line##*/} bgact[$pal]=${${line#\# image }%% *} ;;
|
|
87
|
+
'# colors '*) pd=(${=line#\# colors }); [[ -n $key ]] || bgcolors[$pal:$pd[1]]=$pd[2] ;;
|
|
97
88
|
'# picture '*)
|
|
98
89
|
pd=(${=line#\# picture })
|
|
99
90
|
bgpic[$pal:$pd[1]]=${(j: :)pd[2,-1]}
|
|
@@ -144,6 +135,12 @@ __tt_bg_load() {
|
|
|
144
135
|
fi
|
|
145
136
|
}
|
|
146
137
|
|
|
138
|
+
__tt_bg_coloring() {
|
|
139
|
+
local key=${1##*:}
|
|
140
|
+
[[ $1 == *:* ]] || key=${bgact[$1]}
|
|
141
|
+
REPLY=${bgcolors[${1%:*}:$key]:-tone}
|
|
142
|
+
}
|
|
143
|
+
|
|
147
144
|
__tt_bg_image() {
|
|
148
145
|
REPLY=${bgsrc[$1]}
|
|
149
146
|
[[ ${bgsize[$1]} == fill ]] && REPLY=${bgfill[$1]}
|
|
@@ -485,6 +482,9 @@ __tt_pv_bg_reset() {
|
|
|
485
482
|
for img in ${(k)bgsrc[(I)${(b)1}(|:*)]}; do
|
|
486
483
|
unset "bgsrc[$img]"
|
|
487
484
|
done
|
|
485
|
+
for img in ${(k)bgcolors[(I)${(b)1}:*]}; do
|
|
486
|
+
unset "bgcolors[$img]"
|
|
487
|
+
done
|
|
488
488
|
unset "bgview[$1]" "bgswap[$1]"
|
|
489
489
|
}
|
|
490
490
|
|
|
@@ -545,15 +545,48 @@ __tt_pv_bg_drop() {
|
|
|
545
545
|
__tt_pv_tune_open $name
|
|
546
546
|
}
|
|
547
547
|
|
|
548
|
+
__tt_pv_bg_recolor() {
|
|
549
|
+
local name=$tune was=$tpick key=${tpick##*:} want err REPLY
|
|
550
|
+
local -i rc row=$tf
|
|
551
|
+
[[ $tpick == *:* ]] || key=${bgact[$name]}
|
|
552
|
+
__tt_bg_coloring $tpick
|
|
553
|
+
want=original
|
|
554
|
+
[[ $REPLY == original ]] && want=tone
|
|
555
|
+
__tt_pv_tune_keep
|
|
556
|
+
__tt_pv_bg_commit $name
|
|
557
|
+
msg="Drawing in its own colors"
|
|
558
|
+
[[ $want == tone ]] && msg="Drawing in the palette's tone"
|
|
559
|
+
msgt=300
|
|
560
|
+
printf '\e[?2026h'
|
|
561
|
+
__tt_pv_draw
|
|
562
|
+
__tt_pv_bg_close
|
|
563
|
+
err=$(__tt_cli image $name $want $key 2>&1)
|
|
564
|
+
rc=$?
|
|
565
|
+
err=${${err//$'\n'/ }## #}
|
|
566
|
+
resized=1 bgname="" bgshown="" bgdim=()
|
|
567
|
+
__tt_pv_bg_reset $name
|
|
568
|
+
__tt_bg_load $name
|
|
569
|
+
bgload[$name]="" bgedit[$name]=1
|
|
570
|
+
msg=${err:-"Background · $name"} msgt=$(( rc ? 300 : 200 ))
|
|
571
|
+
[[ -r ${TTHEME_CONFIG:h}/backgrounds/${${name/@/--}/\//--}.conf ]] || return 0
|
|
572
|
+
__tt_pv_tune_open $name
|
|
573
|
+
if [[ $was != "$tpick" ]]; then
|
|
574
|
+
tpick=$was
|
|
575
|
+
__tt_bg_load $tpick
|
|
576
|
+
tsnaps[$tpick]="${bgsize[$tpick]} ${bgpos[$tpick]} ${bgop[$tpick]} ${bgoff[$tpick]}"
|
|
577
|
+
fi
|
|
578
|
+
tf=$row
|
|
579
|
+
}
|
|
580
|
+
|
|
548
581
|
__tt_pv_bg_panel() {
|
|
549
|
-
local name=$1 z=$'\e[0m' b=$'\e[1m' d=$'\e[2m' c=$ac val sty mark REPLY
|
|
550
|
-
local -a labs=(Size Position Opacity) at=(0 3 6) def=(${=bgdef[$1]})
|
|
582
|
+
local name=$1 z=$'\e[0m' b=$'\e[1m' d=$'\e[2m' c=$ac val sty mark choice REPLY
|
|
583
|
+
local -a labs=(Size Position Opacity Colors) at=(0 3 6 7) def=(${=bgdef[$1]})
|
|
551
584
|
local -i r0=$2 col=$3 end=$4 off=${bgoff[$1]} T=$(( $4 - $3 - 21 )) lo=100 hi=100 k i r knob pos=${bgpos[$1]} o tuned
|
|
552
585
|
(( color )) || z= b= d= c=
|
|
553
586
|
(( T < 8 )) && T=8
|
|
554
587
|
(( $+commands[sips] )) && lo=20
|
|
555
588
|
__tt_pv_bg_fs $name && (( REPLY > hi )) && hi=$REPLY
|
|
556
|
-
for k in 1 2 3; do
|
|
589
|
+
for k in 1 2 3 4; do
|
|
557
590
|
r=$(( r0 + at[k] ))
|
|
558
591
|
sty=$d
|
|
559
592
|
(( tf == k && ! off )) && sty=$b
|
|
@@ -564,6 +597,23 @@ __tt_pv_bg_panel() {
|
|
|
564
597
|
out+=" "
|
|
565
598
|
fi
|
|
566
599
|
out+=$sty$labs[k]$z
|
|
600
|
+
if (( k == 4 )); then
|
|
601
|
+
__tt_bg_coloring $name
|
|
602
|
+
val=$REPLY
|
|
603
|
+
out+=$'\e['$r';'$(( col + 12 ))'H'
|
|
604
|
+
for choice in tone original; do
|
|
605
|
+
if (( ! color )); then
|
|
606
|
+
if [[ $choice == $val ]]; then out+="[$choice] "; else out+=" $choice "; fi
|
|
607
|
+
elif [[ $choice != $val ]]; then
|
|
608
|
+
out+=$d" $choice "$z" "
|
|
609
|
+
elif (( tf == k && ! off )); then
|
|
610
|
+
out+=$'\e[7;1m'$c" $choice "$z" "
|
|
611
|
+
else
|
|
612
|
+
out+=$sty" $choice "$z" "
|
|
613
|
+
fi
|
|
614
|
+
done
|
|
615
|
+
continue
|
|
616
|
+
fi
|
|
567
617
|
if (( k == 2 )); then
|
|
568
618
|
for (( i = 1; i <= 9; i++ )); do
|
|
569
619
|
out+=$'\e['$(( r0 + 2 + (i - 1) / 3 ))';'$(( col + 12 + (i - 1) % 3 * 3 ))'H'
|
|
@@ -611,7 +661,7 @@ __tt_pv_bg_panel() {
|
|
|
611
661
|
out+=$'\e['$r';'$end'H'$mark"↺"$z
|
|
612
662
|
fi
|
|
613
663
|
done
|
|
614
|
-
(( split )) && bgstrip="$(( r0 +
|
|
664
|
+
(( split )) && bgstrip="$(( r0 + 9 )) $col $end"
|
|
615
665
|
}
|
|
616
666
|
|
|
617
667
|
__tt_pv_bg_strip() {
|
package/shell/adapters/_osc.zsh
CHANGED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
typeset -g TTHEME_GHOSTTY_PID=""
|
|
2
|
+
|
|
3
|
+
__tt_reload() {
|
|
4
|
+
local wired
|
|
5
|
+
for wired in $TTHEME_TERMINALS; do
|
|
6
|
+
(( $+functions[__tt_reload_$wired] )) && __tt_reload_$wired
|
|
7
|
+
done
|
|
8
|
+
return 0
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
__tt_pictured() {
|
|
12
|
+
local wired
|
|
13
|
+
for wired in $TTHEME_TERMINALS; do
|
|
14
|
+
(( $+functions[__tt_pictured_$wired] )) && __tt_pictured_$wired "$@"
|
|
15
|
+
done
|
|
16
|
+
return 0
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
__tt_reload_ghostty() {
|
|
20
|
+
local pid=$PPID ppid comm owner=$TTHEME_GHOSTTY_PID
|
|
21
|
+
(( TTHEME_TMUX )) && { pid=$(tmux display -p '#{client_pid}' 2>/dev/null) owner="" }
|
|
22
|
+
if [[ -z $owner ]]; then
|
|
23
|
+
owner=0
|
|
24
|
+
while (( pid > 1 )); do
|
|
25
|
+
read -r ppid comm <<< "$(ps -o ppid=,comm= -p $pid)"
|
|
26
|
+
if [[ ${comm:t} == ghostty ]]; then
|
|
27
|
+
owner=$pid
|
|
28
|
+
break
|
|
29
|
+
fi
|
|
30
|
+
pid=$ppid
|
|
31
|
+
done
|
|
32
|
+
(( TTHEME_TMUX )) || TTHEME_GHOSTTY_PID=$owner
|
|
33
|
+
fi
|
|
34
|
+
(( owner )) && kill -USR2 $owner 2>/dev/null && return
|
|
35
|
+
pkill -USR2 -x ghostty 2>/dev/null
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
__tt_ghostty_shown() {
|
|
39
|
+
local f=${TTHEME_CONFIG:h}/backgrounds/shown.conf
|
|
40
|
+
REPLY=""
|
|
41
|
+
[[ -r $f ]] || return 1
|
|
42
|
+
REPLY=${${"$(<$f)"}##*\?}
|
|
43
|
+
REPLY=${REPLY%.conf}
|
|
44
|
+
REPLY=${${REPLY/--/@}/--//}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
__tt_pictured_ghostty() {
|
|
48
|
+
local REPLY
|
|
49
|
+
__tt_ghostty_shown && (( ${@[(Ie)$REPLY]} )) && __tt_reload_ghostty
|
|
50
|
+
return 0
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
__tt_pictured_iterm2() { __tt_cli image $1 tuned }
|
|
54
|
+
|
|
55
|
+
__tt_bg_aligns() { (( ! ${TTHEME_TERMINALS[(Ie)iterm2]} )) }
|
package/shell/adapters/kitty.zsh
CHANGED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
__tt_paints() { (( ${TTHEME_TERMINALS[(Ie)konsole]} )) }
|
|
2
|
+
|
|
3
|
+
__tt_unpainted() {
|
|
4
|
+
print -u2 "ttheme: Konsole draws a palette's 16 colors only from the color schemes init writes — wire it with \`npx @kecan0406/ttheme@latest init\`"
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
__tt_keepable() { __tt_paints }
|
|
8
|
+
|
|
9
|
+
__tt_scheme() {
|
|
10
|
+
local -a p=(${=TTHEME_PALETTE[$1]})
|
|
11
|
+
REPLY="ColorScheme=ttheme-${${1/@/--}/\//--};UseCustomCursorColor=true;customCursorColor=$p[3]"
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
__tt_osc_apply() {
|
|
15
|
+
local -a p=(${=1})
|
|
16
|
+
(( ${#p} >= 20 )) || return 1
|
|
17
|
+
local REPLY
|
|
18
|
+
__tt_name_of "$1"
|
|
19
|
+
if __tt_paints && [[ -n ${TTHEME_PALETTE[$REPLY]} ]]; then
|
|
20
|
+
__tt_scheme $REPLY
|
|
21
|
+
__tt_out $'\e]50;'$REPLY$'\a'
|
|
22
|
+
elif [[ $p[1] == - ]]; then
|
|
23
|
+
__tt_out $'\e]10;'$p[2]$'\e\\'
|
|
24
|
+
else
|
|
25
|
+
__tt_out $'\e]11;'$p[1]$'\e\\\e]10;'$p[2]$'\e\\'
|
|
26
|
+
fi
|
|
27
|
+
export TTHEME_PAINTED=1
|
|
28
|
+
(( TTHEME_TMUX )) && tmux set -q @ttheme_bg "$p[1]" 2>/dev/null
|
|
29
|
+
__tt_worn "$1"
|
|
30
|
+
return 0
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
__tt_osc_reset() {
|
|
34
|
+
local REPLY=$TTHEME_KONSOLE_BASE
|
|
35
|
+
if __tt_paints; then
|
|
36
|
+
[[ -n $TTHEME_STARTUP && -n ${TTHEME_PALETTE[$TTHEME_STARTUP]} ]] && __tt_scheme $TTHEME_STARTUP
|
|
37
|
+
__tt_out $'\e]50;'$REPLY$'\a'
|
|
38
|
+
else
|
|
39
|
+
__tt_out $'\e]110;\e\\\e]111;\e\\'
|
|
40
|
+
fi
|
|
41
|
+
unset TTHEME_PAINTED
|
|
42
|
+
(( TTHEME_TMUX )) && tmux set -qu @ttheme_bg 2>/dev/null
|
|
43
|
+
__tt_worn ""
|
|
44
|
+
return 0
|
|
45
|
+
}
|
package/shell/ttheme.zsh
CHANGED
|
@@ -95,6 +95,8 @@ __tt_pins_load
|
|
|
95
95
|
|
|
96
96
|
: ${TTHEME_BG_BLUR:=0}
|
|
97
97
|
|
|
98
|
+
: ${TTHEME_BG_COLORS:=tone}
|
|
99
|
+
|
|
98
100
|
typeset -g TTHEME_STATE_DIR=${XDG_STATE_HOME:-$HOME/.local/state}/ttheme
|
|
99
101
|
|
|
100
102
|
() {
|
|
@@ -109,6 +111,8 @@ typeset -g TTHEME_STATE_DIR=${XDG_STATE_HOME:-$HOME/.local/state}/ttheme
|
|
|
109
111
|
typeset -g TTHEME_ADAPTER=wezterm
|
|
110
112
|
elif [[ -n $ALACRITTY_WINDOW_ID ]]; then
|
|
111
113
|
typeset -g TTHEME_ADAPTER=alacritty
|
|
114
|
+
elif [[ -n $KONSOLE_VERSION ]]; then
|
|
115
|
+
typeset -g TTHEME_ADAPTER=konsole
|
|
112
116
|
elif [[ -n $ITERM_SESSION_ID || $TERM_PROGRAM == iTerm.app ]]; then
|
|
113
117
|
typeset -g TTHEME_ADAPTER=iterm2
|
|
114
118
|
elif [[ $TERM_PROGRAM == Apple_Terminal ]]; then
|
|
@@ -122,27 +126,7 @@ typeset -g TTHEME_STATE_DIR=${XDG_STATE_HOME:-$HOME/.local/state}/ttheme
|
|
|
122
126
|
fi
|
|
123
127
|
}
|
|
124
128
|
|
|
125
|
-
typeset -g
|
|
126
|
-
|
|
127
|
-
__tt_reload() {
|
|
128
|
-
(( ${TTHEME_TERMINALS[(Ie)ghostty]} )) || return 0
|
|
129
|
-
local pid=$PPID ppid comm owner=$TTHEME_GHOSTTY_PID
|
|
130
|
-
(( TTHEME_TMUX )) && { pid=$(tmux display -p '#{client_pid}' 2>/dev/null) owner="" }
|
|
131
|
-
if [[ -z $owner ]]; then
|
|
132
|
-
owner=0
|
|
133
|
-
while (( pid > 1 )); do
|
|
134
|
-
read -r ppid comm <<< "$(ps -o ppid=,comm= -p $pid)"
|
|
135
|
-
if [[ ${comm:t} == ghostty ]]; then
|
|
136
|
-
owner=$pid
|
|
137
|
-
break
|
|
138
|
-
fi
|
|
139
|
-
pid=$ppid
|
|
140
|
-
done
|
|
141
|
-
(( TTHEME_TMUX )) || TTHEME_GHOSTTY_PID=$owner
|
|
142
|
-
fi
|
|
143
|
-
(( owner )) && kill -USR2 $owner 2>/dev/null && return
|
|
144
|
-
pkill -USR2 -x ghostty 2>/dev/null
|
|
145
|
-
}
|
|
129
|
+
typeset -g TTHEME_TMUX=0 TTHEME_MUXED=0
|
|
146
130
|
|
|
147
131
|
__tt_tmux() {
|
|
148
132
|
[[ $(tmux if -t "$TMUX_PANE" -F '#{==:#{allow-passthrough},off}' 'set -p allow-passthrough on' \; set -sq focus-events on \; display -p '#{client_control_mode}' 2>/dev/null) == 1 ]] && return 0
|
|
@@ -152,7 +136,7 @@ __tt_tmux() {
|
|
|
152
136
|
__tt_active() {
|
|
153
137
|
[[ -o interactive ]] || return 1
|
|
154
138
|
(( ${#TTHEME_PALETTE} )) || return 1
|
|
155
|
-
[[ $TTHEME_ADAPTER !=
|
|
139
|
+
[[ -n $TTHEME_FORCE ]] || { [[ $TTHEME_ADAPTER != unknown ]] && __tt_paints }
|
|
156
140
|
}
|
|
157
141
|
|
|
158
142
|
typeset -g TTHEME_HEARD=""
|
|
@@ -231,6 +215,7 @@ __tt_recheck() {
|
|
|
231
215
|
}
|
|
232
216
|
|
|
233
217
|
source $TTHEME_HOME/adapters/_osc.zsh
|
|
218
|
+
source $TTHEME_HOME/adapters/_wired.zsh
|
|
234
219
|
[[ -r $TTHEME_HOME/adapters/$TTHEME_ADAPTER.zsh ]] &&
|
|
235
220
|
source $TTHEME_HOME/adapters/$TTHEME_ADAPTER.zsh
|
|
236
221
|
|
|
@@ -1662,9 +1647,9 @@ __tt_pv_foot() {
|
|
|
1662
1647
|
printf -v y '\e[38;2;%d;%d;%dm' $((16#${hex:0:2})) $((16#${hex:2:2})) $((16#${hex:4:2}))
|
|
1663
1648
|
fi
|
|
1664
1649
|
if (( help )); then
|
|
1665
|
-
badge=
|
|
1650
|
+
badge=HELP right=$b"? esc"$z$d" close"$z
|
|
1666
1651
|
elif [[ -n $pick ]]; then
|
|
1667
|
-
badge=APPLY lead="$pick →"
|
|
1652
|
+
badge='PREVIEW (APPLY)' lead="$pick →"
|
|
1668
1653
|
for (( i = 1; i <= ${#plabel}; i++ )); do
|
|
1669
1654
|
if (( i != pk )); then
|
|
1670
1655
|
lead+=" "$d${plabel[i]}$z
|
|
@@ -1675,7 +1660,7 @@ __tt_pv_foot() {
|
|
|
1675
1660
|
fi
|
|
1676
1661
|
done
|
|
1677
1662
|
if [[ $mode == pin ]]; then
|
|
1678
|
-
badge=PIN
|
|
1663
|
+
badge='PREVIEW (PIN)'
|
|
1679
1664
|
__tt_pin_base "${pkeys[pk]}"
|
|
1680
1665
|
__tt_dir_label "$REPLY"
|
|
1681
1666
|
note=$REPLY
|
|
@@ -1687,14 +1672,19 @@ __tt_pv_foot() {
|
|
|
1687
1672
|
kk=(enter) kl=(confirm)
|
|
1688
1673
|
right=$b"esc"$z$d" back"$z
|
|
1689
1674
|
elif [[ -n $tune ]]; then
|
|
1690
|
-
badge=
|
|
1675
|
+
badge='IMAGE EDIT' kk=(↑↓ ←→ '=' +) kl=(field step reset "reset all")
|
|
1691
1676
|
if (( tf == 2 )); then
|
|
1692
1677
|
kl[2]=move kk+=(1-9) kl+=(place)
|
|
1678
|
+
elif (( tf == 4 )); then
|
|
1679
|
+
kl[2]=switch kk=(${kk:#'='}) kl=("${(@)kl[1,2]}" "reset all")
|
|
1693
1680
|
else
|
|
1694
1681
|
kk+=(⇧←→) kl+=(×10)
|
|
1695
1682
|
fi
|
|
1696
|
-
|
|
1697
|
-
|
|
1683
|
+
if (( bgoff[$tpick] )); then
|
|
1684
|
+
kk+=(space enter) kl+=(show keep)
|
|
1685
|
+
else
|
|
1686
|
+
kk+=(c space enter) kl+=(colors hide keep)
|
|
1687
|
+
fi
|
|
1698
1688
|
__tt_pv_bg_images $tune
|
|
1699
1689
|
(( REPLY > 1 )) && { kk+=(', .' D); kl+=("image ×$REPLY" remove) }
|
|
1700
1690
|
__tt_pv_bg_findable $tune && { kk+=(f); kl+=(find) }
|
|
@@ -1703,7 +1693,8 @@ __tt_pv_foot() {
|
|
|
1703
1693
|
badge=CONFIG kk=(↑↓ ←→ enter) kl=(setting value save)
|
|
1704
1694
|
right=$b"esc"$z$d" undo"$z
|
|
1705
1695
|
else
|
|
1706
|
-
|
|
1696
|
+
badge=PREVIEW
|
|
1697
|
+
[[ -n $flt ]] && badge='PREVIEW (FILTER)'
|
|
1707
1698
|
if (( ! ${#rval} )); then
|
|
1708
1699
|
kk=(bksp) kl=(edit)
|
|
1709
1700
|
elif [[ ${rtype[cur]} == (hdr|cat) ]]; then
|
|
@@ -1789,8 +1780,8 @@ __tt_pv_help() {
|
|
|
1789
1780
|
"enter · esc restores $back"
|
|
1790
1781
|
)
|
|
1791
1782
|
if (( bgcw )); then
|
|
1792
|
-
hk+=("Tune bg" "" "" "" "" "")
|
|
1793
|
-
hv+=("tab · finds one on the boorus, or takes your own, if none" "↑↓ field ←→ step ⇧←→ ×10 1-9 place" "= resets a field · + resets all" "space hides · enter keeps · esc undoes" ", . other pictures · D removes one" "f adds one from the boorus or your own")
|
|
1783
|
+
hk+=("Tune bg" "" "" "" "" "" "")
|
|
1784
|
+
hv+=("tab · finds one on the boorus, or takes your own, if none" "↑↓ field ←→ step ⇧←→ ×10 1-9 place" "= resets a field · + resets all" "space hides · enter keeps · esc undoes" "c tone ↔ the picture's own colors" ", . other pictures · D removes one" "f adds one from the boorus or your own")
|
|
1794
1785
|
fi
|
|
1795
1786
|
hk+=(Config "")
|
|
1796
1787
|
hv+=("alt-c · ↑↓ setting ←→ value" "enter saves · esc undoes")
|
|
@@ -1810,7 +1801,7 @@ __tt_pv_help() {
|
|
|
1810
1801
|
x=$(( (pw - w) / 2 + 1 )) y=$(( (ph - hh) / 2 ))
|
|
1811
1802
|
(( y < 4 )) && y=4
|
|
1812
1803
|
blank=${(l:w:: :)}
|
|
1813
|
-
out+=$'\e['$y';'$x'H'"╭─
|
|
1804
|
+
out+=$'\e['$y';'$x'H'"╭─ Help ${(l:$(( w - 9 ))::─:)}╮"
|
|
1814
1805
|
for (( r = y + 1; r < y + hh - 1; r++ )); do
|
|
1815
1806
|
out+=$'\e['$r';'$x'H'$blank$'\e['$r';'$x'H│'$'\e['$r';'$(( x + w - 1 ))'H│'
|
|
1816
1807
|
done
|
|
@@ -1906,9 +1897,14 @@ __tt_pv_tune() {
|
|
|
1906
1897
|
local name
|
|
1907
1898
|
case $key in
|
|
1908
1899
|
$'\x03') return 1 ;;
|
|
1909
|
-
up) tf=$(( tf > 1 ? tf - 1 :
|
|
1910
|
-
down) tf=$(( tf <
|
|
1900
|
+
up) tf=$(( tf > 1 ? tf - 1 : 4 )) ;;
|
|
1901
|
+
down) tf=$(( tf < 4 ? tf + 1 : 1 )) ;;
|
|
1902
|
+
c) (( bgoff[$tpick] )) || __tt_pv_bg_recolor ;;
|
|
1911
1903
|
left|right|sleft|sright)
|
|
1904
|
+
if (( tf == 4 )); then
|
|
1905
|
+
(( bgoff[$tpick] )) || __tt_pv_bg_recolor
|
|
1906
|
+
return 0
|
|
1907
|
+
fi
|
|
1912
1908
|
[[ $key == *left ]] && n=-1
|
|
1913
1909
|
[[ $key == s* ]] && (( tf != 2 )) && n=$(( n * 10 ))
|
|
1914
1910
|
__tt_pv_bg_adjust ${fields[tf]} $n
|
|
@@ -1918,7 +1914,7 @@ __tt_pv_tune() {
|
|
|
1918
1914
|
__tt_pv_bg_adjust at $key
|
|
1919
1915
|
;;
|
|
1920
1916
|
' ') __tt_pv_bg_adjust on ;;
|
|
1921
|
-
'=') __tt_pv_bg_adjust def $tf ;;
|
|
1917
|
+
'=') (( tf == 4 )) || __tt_pv_bg_adjust def $tf ;;
|
|
1922
1918
|
'+') __tt_pv_bg_adjust def ;;
|
|
1923
1919
|
',') __tt_pv_bg_pick -1 ;;
|
|
1924
1920
|
'.') __tt_pv_bg_pick 1 ;;
|
|
@@ -2287,7 +2283,7 @@ __tt_pv_draw() {
|
|
|
2287
2283
|
__tt_pv_foot $(( split ? se : pw ))
|
|
2288
2284
|
if (( split )); then
|
|
2289
2285
|
if (( help && sw >= 48 )); then
|
|
2290
|
-
__tt_pv_head 1 $sc $se
|
|
2286
|
+
__tt_pv_head 1 $sc $se Help
|
|
2291
2287
|
__tt_pv_help
|
|
2292
2288
|
elif (( ${#reach} )); then
|
|
2293
2289
|
__tt_pv_head 1 $sc $se "$pick" "$rsub"
|
|
@@ -2328,11 +2324,11 @@ __tt_pv_draw() {
|
|
|
2328
2324
|
src=" · $k/${#held}"
|
|
2329
2325
|
fi
|
|
2330
2326
|
__tt_pv_bg_title $(( lw - ${#tune} - 6 )) "$src"
|
|
2331
|
-
__tt_pv_head $(( ph -
|
|
2332
|
-
__tt_pv_bg_panel $tpick $(( ph -
|
|
2327
|
+
__tt_pv_head $(( ph - 10 )) 1 $lw $tune "$REPLY" $state
|
|
2328
|
+
__tt_pv_bg_panel $tpick $(( ph - 9 )) 1 $lw
|
|
2333
2329
|
elif (( conf )); then
|
|
2334
|
-
__tt_pv_head $(( ph -
|
|
2335
|
-
__tt_pv_conf_panel $(( ph -
|
|
2330
|
+
__tt_pv_head $(( ph - 8 )) 1 $lw Config
|
|
2331
|
+
__tt_pv_conf_panel $(( ph - 7 )) 1 $lw
|
|
2336
2332
|
fi
|
|
2337
2333
|
(( help )) && __tt_pv_help
|
|
2338
2334
|
fi
|
|
@@ -2627,11 +2623,11 @@ __tt_preview() {
|
|
|
2627
2623
|
local -i scene=0
|
|
2628
2624
|
local -a bgorder=()
|
|
2629
2625
|
local -A bgfrom=() bgurl=() bgby=() bgsent=() bgcost=() bgdim=() bgsrc=() bgfill=() bgfocus=() bgsize=() bgpos=() bgop=() bgdef=() bgoff=() bgbase=() bgload=() bgshot=() bgshotkey=() bgedit=() bgtunef=() bgofff=() bgimages=()
|
|
2630
|
-
local -A bgpic=() bgpics=() bgact=() bgview=() bgswap=() bgthumb=() tsnaps=() pvseek=()
|
|
2626
|
+
local -A bgpic=() bgpics=() bgact=() bgview=() bgswap=() bgthumb=() tsnaps=() pvseek=() bgcolors=()
|
|
2631
2627
|
local conf=0 cf=1
|
|
2632
2628
|
local -a plabel=(" This tab " " Default ") pkeys=() reach=() csnap=()
|
|
2633
|
-
local -a cvars=(TTHEME_TAB_PALETTE TTHEME_ANNOUNCE TTHEME_FX TTHEME_SORT TTHEME_BG_BLUR) clabel=("New tabs" Announce "Search fx" Sort Blur)
|
|
2634
|
-
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")
|
|
2629
|
+
local -a cvars=(TTHEME_TAB_PALETTE TTHEME_ANNOUNCE TTHEME_FX TTHEME_SORT TTHEME_BG_BLUR TTHEME_BG_COLORS) clabel=("New tabs" Announce "Search fx" Sort Blur Colors)
|
|
2630
|
+
local -a cchoice=("off seq" "1 0" "typewriter decode glitch" "abc series" "0 1 2 3 4" "tone original") cshow=("off seq" "on off" "typewriter decode glitch" "abc series" "off 1px 2px 3px 4px" "tone original")
|
|
2635
2631
|
local -A cnote=(
|
|
2636
2632
|
TTHEME_TAB_PALETTE:seq "New tabs rotate through palettes" TTHEME_TAB_PALETTE:off "New tabs keep the terminal theme"
|
|
2637
2633
|
TTHEME_ANNOUNCE:1 "Shows the palette notice" TTHEME_ANNOUNCE:0 "Silences the palette notice"
|
|
@@ -2640,6 +2636,8 @@ __tt_preview() {
|
|
|
2640
2636
|
TTHEME_BG_BLUR:0 "Pictures stay sharp" TTHEME_BG_BLUR:1 "Pictures soften a little behind the text"
|
|
2641
2637
|
TTHEME_BG_BLUR:2 "Pictures soften behind the text" TTHEME_BG_BLUR:3 "Pictures blur behind the text"
|
|
2642
2638
|
TTHEME_BG_BLUR:4 "Pictures blur well behind the text"
|
|
2639
|
+
TTHEME_BG_COLORS:tone "New pictures are tinted in one color of the palette"
|
|
2640
|
+
TTHEME_BG_COLORS:original "New pictures keep their own colors"
|
|
2643
2641
|
)
|
|
2644
2642
|
[[ $mode == pin ]] && __tt_pin_scopes "$pdir"
|
|
2645
2643
|
[[ $mode == init ]] && pkdef=2
|
|
@@ -2735,8 +2733,8 @@ ttheme() {
|
|
|
2735
2733
|
print -u2 "ttheme: unknown command '$1' — see \`ttheme help\`"
|
|
2736
2734
|
return 1
|
|
2737
2735
|
fi
|
|
2738
|
-
if
|
|
2739
|
-
|
|
2736
|
+
if ! __tt_paints && (( ! $# || ${TTHEME_TAB_VERBS[(Ie)$1]} )); then
|
|
2737
|
+
__tt_unpainted
|
|
2740
2738
|
return 1
|
|
2741
2739
|
fi
|
|
2742
2740
|
if (( ! $# )); then
|
|
@@ -2836,7 +2834,7 @@ fi
|
|
|
2836
2834
|
add-zsh-hook preexec __tt_mux
|
|
2837
2835
|
add-zsh-hook precmd __tt_unmux
|
|
2838
2836
|
fi
|
|
2839
|
-
if
|
|
2837
|
+
if __tt_follows_focus || (( TTHEME_TMUX )); then
|
|
2840
2838
|
add-zsh-hook precmd __tt_precmd
|
|
2841
2839
|
add-zsh-hook preexec __tt_preexec
|
|
2842
2840
|
__tt_bind_focus
|
|
@@ -2849,7 +2847,7 @@ fi
|
|
|
2849
2847
|
() {
|
|
2850
2848
|
emulate -L zsh ${=${options[xtrace]:#off}:+-o xtrace}
|
|
2851
2849
|
local f
|
|
2852
|
-
for f in $TTHEME_HOME/ttheme.zsh $TTHEME_HOME/palettes.zsh $TTHEME_HOME/adapters/_osc.zsh $TTHEME_HOME/adapters/_bg.zsh $TTHEME_HOME/adapters/$TTHEME_ADAPTER.zsh; do
|
|
2850
|
+
for f in $TTHEME_HOME/ttheme.zsh $TTHEME_HOME/palettes.zsh $TTHEME_HOME/adapters/_osc.zsh $TTHEME_HOME/adapters/_wired.zsh $TTHEME_HOME/adapters/_bg.zsh $TTHEME_HOME/adapters/$TTHEME_ADAPTER.zsh; do
|
|
2853
2851
|
[[ -r $f && ! $f.zwc -nt $f ]] || continue
|
|
2854
2852
|
zcompile -UR -- $f.$$.zwc $f 2>/dev/null && command mv -f -- $f.$$.zwc $f.zwc 2>/dev/null
|
|
2855
2853
|
[[ ! -e $f.$$.zwc ]] || command rm -f -- $f.$$.zwc
|