@kecan0406/ttheme 1.2.18 → 1.2.20
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 -7
- package/bin/ttheme.js +222 -220
- package/bin/ttheme.js.map +1 -1
- package/dist/manifest.json +1 -1
- package/package.json +11 -7
- package/shell/adapters/_bg.zsh +9 -5
- package/shell/adapters/_osc.zsh +20 -4
- package/shell/adapters/ghostty.zsh +1 -1
- package/shell/adapters/iterm2.zsh +6 -3
- package/shell/adapters/kitty.zsh +1 -1
- package/shell/adapters/konsole.zsh +1 -1
- package/shell/adapters/terminal-app.zsh +1 -1
- package/shell/adapters/warp.zsh +1 -1
- package/shell/adapters/wezterm.zsh +1 -1
- package/shell/preview.zsh +182 -40
- package/shell/ttheme.zsh +31 -13
package/dist/manifest.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kecan0406/ttheme",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.20",
|
|
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,
|
|
14
|
+
"description": "Character terminal palettes for Ghostty, iTerm2, kitty, Alacritty, WezTerm, Windows Terminal, Warp, Konsole and Terminal.app",
|
|
15
15
|
"license": "MIT",
|
|
16
16
|
"author": "kecan0406",
|
|
17
17
|
"repository": {
|
|
@@ -28,20 +28,24 @@
|
|
|
28
28
|
"alacritty",
|
|
29
29
|
"wezterm",
|
|
30
30
|
"iterm2",
|
|
31
|
-
"konsole"
|
|
31
|
+
"konsole",
|
|
32
|
+
"warp",
|
|
33
|
+
"windows-terminal"
|
|
32
34
|
],
|
|
33
35
|
"devDependencies": {
|
|
34
|
-
"@biomejs/biome": "^2.
|
|
35
|
-
"@clack/prompts": "^1.
|
|
36
|
+
"@biomejs/biome": "^2.5.15",
|
|
37
|
+
"@clack/prompts": "^1.8.1",
|
|
36
38
|
"@jsquash/jpeg": "^1.6.0",
|
|
37
39
|
"@material/material-color-utilities": "^0.4.0",
|
|
38
|
-
"@
|
|
40
|
+
"@oxlint/plugins": "1.87.0",
|
|
41
|
+
"@types/bun": "^1.4.2",
|
|
39
42
|
"@types/pngjs": "6.0.5",
|
|
40
43
|
"@xterm/headless": "6.0.0",
|
|
41
44
|
"fast-string-width": "^3.0.2",
|
|
45
|
+
"oxlint": "1.87.0",
|
|
42
46
|
"pngjs": "7.0.0",
|
|
43
47
|
"smol-toml": "^1.9.0",
|
|
44
|
-
"typescript": "^
|
|
48
|
+
"typescript": "^7.0.2",
|
|
45
49
|
"uqr": "^0.1.3"
|
|
46
50
|
},
|
|
47
51
|
"engines": {
|
package/shell/adapters/_bg.zsh
CHANGED
|
@@ -77,8 +77,8 @@ __tt_bg_load() {
|
|
|
77
77
|
bgimages[$name]=${bgimages[$pal]:-1}
|
|
78
78
|
elif [[ -r $dir/$file.conf ]]; then
|
|
79
79
|
lines=("${(@f)$(<$dir/$file.conf)}")
|
|
80
|
-
for line in ${(k)bgcolors[(I)${(b)pal}:*]}; do
|
|
81
|
-
unset "bgcolors[$line]"
|
|
80
|
+
for line in ${(k)bgcolors[(I)${(b)pal}:*]} ${(k)bgcred[(I)${(b)pal}:*]} ${(k)bgpage[(I)${(b)pal}:*]} ${(k)bgprof[(I)${(b)pal}:*]}; do
|
|
81
|
+
unset "bgcolors[$line]" "bgcred[$line]" "bgpage[$line]" "bgprof[$line]"
|
|
82
82
|
done
|
|
83
83
|
fi
|
|
84
84
|
for line in $lines; do
|
|
@@ -87,6 +87,9 @@ __tt_bg_load() {
|
|
|
87
87
|
'config-file = ?'*.off.conf) bgofff[$name]=${line#config-file = \?} ;;
|
|
88
88
|
'# image '*/<->) bgimages[$name]=${line##*/} bgact[$pal]=${${line#\# image }%% *} ;;
|
|
89
89
|
'# colors '*) pd=(${=line#\# colors }); [[ -n $key ]] || bgcolors[$pal:$pd[1]]=$pd[2] ;;
|
|
90
|
+
'# credit '*) [[ -n $key ]] || { line=${line#\# credit }; bgcred[$pal:${line%% *}]=${line#* } } ;;
|
|
91
|
+
'# source '*) [[ -n $key ]] || { line=${line#\# source }; bgpage[$pal:${line%% *}]="${line##* } ${${line#* }% *}" } ;;
|
|
92
|
+
'# profile '*) [[ -n $key ]] || { line=${line#\# profile }; bgprof[$pal:${line%% *}]+=${bgprof[$pal:${line%% *}]:+$'\n'}${line#* } } ;;
|
|
90
93
|
'# picture '*)
|
|
91
94
|
pd=(${=line#\# picture })
|
|
92
95
|
bgpic[$pal:$pd[1]]=${(j: :)pd[2,-1]}
|
|
@@ -476,7 +479,8 @@ __tt_pv_bg_find() {
|
|
|
476
479
|
__tt_bg_hide $name
|
|
477
480
|
err=$(__tt_cli find $name 2>&1 >/dev/tty)
|
|
478
481
|
rc=$?
|
|
479
|
-
printf %s "$pvmouse"
|
|
482
|
+
printf '\e[?2004h%s' "$pvmouse"
|
|
483
|
+
__tt_pv_size
|
|
480
484
|
for var in ${(k)parameters[(I)TTHEME_FIND_*]}; do
|
|
481
485
|
[[ ${parameters[$var]} == *export* ]] || unset $var
|
|
482
486
|
done
|
|
@@ -508,8 +512,8 @@ __tt_pv_bg_reset() {
|
|
|
508
512
|
for img in ${(k)bgsrc[(I)${(b)1}(|:*)]}; do
|
|
509
513
|
unset "bgsrc[$img]"
|
|
510
514
|
done
|
|
511
|
-
for img in ${(k)bgcolors[(I)${(b)1}:*]}; do
|
|
512
|
-
unset "bgcolors[$img]"
|
|
515
|
+
for img in ${(k)bgcolors[(I)${(b)1}:*]} ${(k)bgcred[(I)${(b)1}:*]} ${(k)bgpage[(I)${(b)1}:*]} ${(k)bgprof[(I)${(b)1}:*]}; do
|
|
516
|
+
unset "bgcolors[$img]" "bgcred[$img]" "bgpage[$img]" "bgprof[$img]"
|
|
513
517
|
done
|
|
514
518
|
unset "bgview[$1]" "bgswap[$1]"
|
|
515
519
|
}
|
package/shell/adapters/_osc.zsh
CHANGED
|
@@ -165,7 +165,7 @@ __tt_b64s() {
|
|
|
165
165
|
|
|
166
166
|
__tt_ask() {
|
|
167
167
|
setopt localoptions extendedglob
|
|
168
|
-
local fd saved="" buf="" chunk
|
|
168
|
+
local fd saved="" buf="" chunk seq
|
|
169
169
|
local -a match mbegin mend
|
|
170
170
|
REPLY=""
|
|
171
171
|
{ exec {fd}<>/dev/tty } 2>/dev/null || return 1
|
|
@@ -185,10 +185,26 @@ __tt_ask() {
|
|
|
185
185
|
[[ -n $saved ]] && stty "$saved" <&$fd 2>/dev/null
|
|
186
186
|
exec {fd}>&-
|
|
187
187
|
[[ $buf == *$'\e[0n'* ]] || __tt_owed
|
|
188
|
-
while [[ $buf
|
|
189
|
-
|
|
188
|
+
while [[ -n $buf ]]; do
|
|
189
|
+
if [[ $buf == (#b)([^$'\e']##)(*) ]]; then
|
|
190
|
+
TTHEME_TYPED+=$match[1] buf=$match[2]
|
|
191
|
+
elif [[ $buf == (#b)($'\e'[]P_^X][^$'\a\e']#($'\a'|$'\e\\'))(*) ]]; then
|
|
192
|
+
REPLY+=$match[1] buf=$match[-1]
|
|
193
|
+
elif [[ $buf == (#b)($'\e['[0-?]#[ -/]#[@-~])(*) ]]; then
|
|
194
|
+
seq=$match[1] buf=$match[-1]
|
|
195
|
+
if [[ $seq == *[nt] || $seq == $'\e['[?\>]*c || $seq == *'$y' ]]; then
|
|
196
|
+
REPLY+=$seq
|
|
197
|
+
else
|
|
198
|
+
TTHEME_TYPED+=$seq
|
|
199
|
+
fi
|
|
200
|
+
elif [[ $buf == (#b)($'\e'(O?|[^][P_^XO$'\e']))(*) ]]; then
|
|
201
|
+
TTHEME_TYPED+=$match[1] buf=$match[-1]
|
|
202
|
+
elif [[ $buf == $'\e\e'* ]]; then
|
|
203
|
+
TTHEME_TYPED+=$'\e' buf=${buf:1}
|
|
204
|
+
else
|
|
205
|
+
break
|
|
206
|
+
fi
|
|
190
207
|
done
|
|
191
|
-
[[ $buf == $'\e'* ]] || TTHEME_TYPED+=$buf
|
|
192
208
|
REPLY=${REPLY%$'\e[0n'}
|
|
193
209
|
}
|
|
194
210
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
source $TTHEME_HOME/adapters/_bg.zsh
|
|
1
|
+
source "$TTHEME_HOME/adapters/_bg.zsh"
|
|
2
2
|
|
|
3
3
|
typeset -g TTHEME_GHOSTTY_TABS=$TTHEME_STATE_DIR/ghostty TTHEME_GHOSTTY_FRONT="" TTHEME_GHOSTTY_BLUR="" TTHEME_GHOSTTY_HEARD="" TTHEME_GHOSTTY_CODE=""
|
|
4
4
|
typeset -gF TTHEME_GHOSTTY_ASKED=0 TTHEME_GHOSTTY_WANT=0 TTHEME_GHOSTTY_HUSH=0 TTHEME_GHOSTTY_TOLD=0 TTHEME_GHOSTTY_NONE_AT=0
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
source $TTHEME_HOME/adapters/_bg.zsh
|
|
1
|
+
source "$TTHEME_HOME/adapters/_bg.zsh"
|
|
2
2
|
|
|
3
3
|
zmodload -F zsh/datetime p:EPOCHREALTIME 2>/dev/null
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
() {
|
|
6
|
+
emulate -L zsh ${=${options[xtrace]:#off}:+-o xtrace}
|
|
7
|
+
(( ${+TTHEME_ITERM_SHOWN} )) && return 0
|
|
6
8
|
typeset -gx TTHEME_ITERM_SHOWN="" TTHEME_ITERM_DYED=0
|
|
7
9
|
[[ $ITERM_PROFILE == 'ttheme · '* ]] && TTHEME_ITERM_SHOWN=${ITERM_PROFILE#ttheme · }
|
|
8
|
-
|
|
10
|
+
return 0
|
|
11
|
+
}
|
|
9
12
|
|
|
10
13
|
__tt_keepable() { return 0 }
|
|
11
14
|
|
package/shell/adapters/kitty.zsh
CHANGED
package/shell/adapters/warp.zsh
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
source $TTHEME_HOME/adapters/_bg.zsh
|
|
1
|
+
source "$TTHEME_HOME/adapters/_bg.zsh"
|
|
2
2
|
|
|
3
3
|
typeset -g TTHEME_WARP_SETTINGS=$HOME/.warp/settings.toml TTHEME_WARP_THEMES=$HOME/.warp/themes TTHEME_WARP_WORN=""
|
|
4
4
|
typeset -g TTHEME_WARP_TABS=$TTHEME_STATE_DIR/warp TTHEME_WARP_DB="" TTHEME_WARP_ID="" TTHEME_WARP_LAST="" TTHEME_WARP_LOOK="" TTHEME_WARP_SEEN=""
|
package/shell/preview.zsh
CHANGED
|
@@ -288,15 +288,16 @@ __tt_pv_row() {
|
|
|
288
288
|
fi
|
|
289
289
|
name=${t##*/}
|
|
290
290
|
[[ -n ${TTHEME_CATALOG[$t]} && ${TTHEME_GROUP[$t]} == *@* ]] && ind=" "
|
|
291
|
+
(( ${TTHEME_TUNED[(Ie)$t]} )) && w=-2
|
|
292
|
+
(( ${(m)#name} > lw - 17 - ${#ind} + w )) && name="${name[1,lw-18-${#ind}+w]}…"
|
|
291
293
|
__tt_pv_hl "$name" "$base"
|
|
292
294
|
hl=$REPLY
|
|
293
|
-
if ((
|
|
295
|
+
if (( w )); then
|
|
294
296
|
(( color )) && hl+=" "$TTHEME_SGR[warn]"●"$TTHEME_SGR[/warn] || hl+=" ●"
|
|
295
|
-
w=-2
|
|
296
297
|
fi
|
|
297
298
|
extra=""
|
|
298
299
|
for part in "${(@s:|:)TTHEME_NATIVE_NAMES[$t]}" "${TTHEME_CHARACTER[$t]}" "${(@s:|:)TTHEME_ALIASES[$t]}"; do
|
|
299
|
-
__tt_pv_alias "$
|
|
300
|
+
__tt_pv_alias "${t##*/}" "$part"
|
|
300
301
|
[[ -n $REPLY ]] && { extra=$REPLY; break }
|
|
301
302
|
done
|
|
302
303
|
if (( color )); then
|
|
@@ -306,20 +307,97 @@ __tt_pv_row() {
|
|
|
306
307
|
(( w < 1 )) && w=1
|
|
307
308
|
REPLY=$gut$on"$ind$mark $base$hl$r$REPLY${(l:w:: :)}${tstrip[$t]} "$z
|
|
308
309
|
else
|
|
309
|
-
|
|
310
|
+
w=$(( w + lw - 4 - ${#ind} - ${#name} ))
|
|
311
|
+
__tt_pv_fit "$extra"
|
|
312
|
+
REPLY="$gut$ind$mark $hl$REPLY"
|
|
310
313
|
fi
|
|
311
314
|
}
|
|
312
315
|
|
|
316
|
+
__tt_pv_bg_pickkey() {
|
|
317
|
+
REPLY=${tpick#*:}
|
|
318
|
+
[[ $tpick == *:* ]] || REPLY=${bgact[$tune]}
|
|
319
|
+
}
|
|
320
|
+
|
|
313
321
|
__tt_pv_bg_credit() {
|
|
314
|
-
local by=${bgby[$tpick]} ref=${bgfrom[$tpick]} url=${bgurl[$tpick]}
|
|
322
|
+
local by=${bgby[$tpick]} ref=${bgfrom[$tpick]} url=${bgurl[$tpick]} page lab pu pmark="" smark="" sgr="" acc=""
|
|
315
323
|
local -i room=$1
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
[[
|
|
324
|
+
local -a items
|
|
325
|
+
__tt_pv_bg_pickkey
|
|
326
|
+
page=${bgpage[$tune:$REPLY]}
|
|
327
|
+
pu=${page%% *} lab=${page#* }
|
|
328
|
+
[[ $url == http(s|)://* ]] || url=""
|
|
329
|
+
if __tt_links; then
|
|
330
|
+
[[ -n $url ]] && pmark="⧉ "
|
|
331
|
+
[[ -n $pu ]] && smark="⧉ "
|
|
332
|
+
fi
|
|
333
|
+
items=(${by:+"by $by"} ${lab:+"$smark$lab"} ${ref:+"$pmark$ref"})
|
|
334
|
+
while (( ${#items} )) && (( ${#${(j: · :)items}} > room )); do
|
|
335
|
+
items[-1]=()
|
|
336
|
+
done
|
|
337
|
+
REPLY=${(j: · :)items}
|
|
338
|
+
if [[ -n $smark && $REPLY == *"$smark$lab"* ]]; then
|
|
339
|
+
(( color )) && acc=$ac
|
|
340
|
+
REPLY=${REPLY/"$smark$lab"/$acc⧉${acc:+$TTHEME_SGR[/accent]} $'\e]8;;'$pu$'\e\\'$lab$'\e]8;;\e\\'}
|
|
341
|
+
fi
|
|
342
|
+
[[ -n $pmark && $REPLY == *"$pmark$ref"* ]] || return 0
|
|
321
343
|
(( color )) && [[ -n ${TTHEME_SITE_ANSI[${ref%% *}]} ]] && sgr=$TTHEME_SGR[fg${TTHEME_SITE_ANSI[${ref%% *}]}]
|
|
322
|
-
REPLY=${REPLY/"$
|
|
344
|
+
REPLY=${REPLY/"$pmark$ref"/$sgr⧉${sgr:+$TTHEME_SGR[/fg]} $'\e]8;;'$url$'\e\\'$ref$'\e]8;;\e\\'}
|
|
345
|
+
return 0
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
__tt_pv_copy() {
|
|
349
|
+
if (( $+commands[pbcopy] )); then
|
|
350
|
+
print -rn -- $1 | LC_CTYPE=UTF-8 pbcopy
|
|
351
|
+
elif [[ -n $WAYLAND_DISPLAY ]] && (( $+commands[wl-copy] )); then
|
|
352
|
+
print -rn -- $1 | wl-copy
|
|
353
|
+
elif [[ -n $DISPLAY ]] && (( $+commands[xclip] )); then
|
|
354
|
+
print -rn -- $1 | xclip -selection clipboard
|
|
355
|
+
else
|
|
356
|
+
return 1
|
|
357
|
+
fi
|
|
358
|
+
} >/dev/null 2>&1
|
|
359
|
+
|
|
360
|
+
__tt_pv_bg_copy() {
|
|
361
|
+
local text
|
|
362
|
+
__tt_pv_bg_pickkey
|
|
363
|
+
text=${bgcred[$tune:$REPLY]}
|
|
364
|
+
if [[ -z $text ]]; then
|
|
365
|
+
msg="This picture names no artist and no page" msgt=300
|
|
366
|
+
return 0
|
|
367
|
+
fi
|
|
368
|
+
if [[ -n $SSH_CONNECTION$SSH_TTY ]] || ! __tt_pv_copy $text; then
|
|
369
|
+
__tt_b64s $text
|
|
370
|
+
__tt_out $'\e]52;c;'$REPLY$'\a'
|
|
371
|
+
fi
|
|
372
|
+
msg="Copied · $text" msgt=200
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
__tt_pv_bg_profiles() {
|
|
376
|
+
local k entry plain="" step piece acc="" lead
|
|
377
|
+
local -a ents e
|
|
378
|
+
local -i room=$1 i many
|
|
379
|
+
REPLY=""
|
|
380
|
+
__tt_links || return 0
|
|
381
|
+
__tt_pv_bg_pickkey
|
|
382
|
+
k=$REPLY REPLY=""
|
|
383
|
+
ents=(${(f)bgprof[$tune:$k]})
|
|
384
|
+
many=$(( ${#ents} > 1 ))
|
|
385
|
+
(( color )) && acc=$ac
|
|
386
|
+
for entry in $ents; do
|
|
387
|
+
e=(${=entry})
|
|
388
|
+
lead=""
|
|
389
|
+
[[ -n $plain ]] && lead=" · "
|
|
390
|
+
if (( many )); then
|
|
391
|
+
(( ${#plain} + ${#lead} + ${#e[1]} > room )) && return 0
|
|
392
|
+
plain+=$lead$e[1] REPLY+=$lead$e[1] lead=" "
|
|
393
|
+
fi
|
|
394
|
+
for (( i = 2; i < ${#e}; i += 2 )); do
|
|
395
|
+
step="⧉ $e[i]"
|
|
396
|
+
(( ${#plain} + ${#lead} + ${#step} > room )) && return 0
|
|
397
|
+
piece=$acc⧉${acc:+$TTHEME_SGR[/accent]}" "$'\e]8;;'$e[i+1]$'\e\\'$e[i]$'\e]8;;\e\\'
|
|
398
|
+
plain+=$lead$step REPLY+=$lead$piece lead=" "
|
|
399
|
+
done
|
|
400
|
+
done
|
|
323
401
|
return 0
|
|
324
402
|
}
|
|
325
403
|
|
|
@@ -350,10 +428,19 @@ __tt_pv_bar() {
|
|
|
350
428
|
}
|
|
351
429
|
|
|
352
430
|
__tt_pv_head() {
|
|
353
|
-
local b=$TTHEME_SGR[bold] d=$TTHEME_SGR[dim] z=$TTHEME_SGR[reset] right=$6
|
|
431
|
+
local b=$TTHEME_SGR[bold] d=$TTHEME_SGR[dim] z=$TTHEME_SGR[reset] title=$4 sub=$5 right=$6
|
|
432
|
+
local -i room=$(( $3 - $2 + 1 )) used
|
|
354
433
|
(( color )) || b= d= z=
|
|
355
|
-
|
|
356
|
-
|
|
434
|
+
if (( ${(m)#title} > room )); then
|
|
435
|
+
while [[ -n $title ]] && (( ${(m)#title} > room - 1 )); do title=${title[1,-2]}; done
|
|
436
|
+
title+=…
|
|
437
|
+
fi
|
|
438
|
+
used=${(m)#title}
|
|
439
|
+
(( used + 2 + ${(m)#sub} <= room )) || sub=""
|
|
440
|
+
[[ -n $sub ]] && (( used += 2 + ${(m)#sub} ))
|
|
441
|
+
(( used + 2 + ${(m)#right} <= room )) || right=""
|
|
442
|
+
out+=$'\e['$1';'$2'H'$b$gc$title$z
|
|
443
|
+
[[ -n $sub ]] && out+=" "$d$sub$z
|
|
357
444
|
[[ -n $right ]] && out+=$'\e['$(( $3 - ${(m)#right} + 1 ))'G'$d$right$z
|
|
358
445
|
return 0
|
|
359
446
|
}
|
|
@@ -412,6 +499,8 @@ __tt_pv_foot() {
|
|
|
412
499
|
kl[2]="image ×$REPLY"
|
|
413
500
|
(( REPLY > 1 )) || { kk[2]=() kl[2]=() }
|
|
414
501
|
__tt_pv_bg_findable $tune && { kk+=(f); kl+=(find) }
|
|
502
|
+
__tt_pv_bg_pickkey
|
|
503
|
+
[[ -n ${bgcred[$tune:$REPLY]} ]] && { kk+=(y); kl+=(credit) }
|
|
415
504
|
kk+=(D) kl+=(remove)
|
|
416
505
|
elif [[ -n $tune ]]; then
|
|
417
506
|
__tt_pv_bg_findable $tune && { kk+=(f); kl+=(find) }
|
|
@@ -423,6 +512,8 @@ __tt_pv_foot() {
|
|
|
423
512
|
kk+=('=' + ⇧←→) kl+=(reset "reset all" ×10)
|
|
424
513
|
fi
|
|
425
514
|
(( bgoff[$tpick] )) && { kk+=(space); kl+=(show) } || { kk+=(c space); kl+=(colors hide) }
|
|
515
|
+
__tt_pv_bg_pickkey
|
|
516
|
+
[[ -n ${bgcred[$tune:$REPLY]} ]] && { kk+=(y); kl+=(credit) }
|
|
426
517
|
__tt_pv_bg_images $tune
|
|
427
518
|
(( REPLY > 1 )) && { kk+=(', .' D); kl+=("image ×$REPLY" remove) }
|
|
428
519
|
else
|
|
@@ -498,6 +589,10 @@ __tt_pv_foot() {
|
|
|
498
589
|
break
|
|
499
590
|
fi
|
|
500
591
|
done
|
|
592
|
+
if (( lwid > end )); then
|
|
593
|
+
__tt_clip "$line" $end
|
|
594
|
+
line=$REPLY
|
|
595
|
+
fi
|
|
501
596
|
out+=$line$'\e[K'
|
|
502
597
|
[[ -n $right ]] && out+=$'\e['$(( end - rwid + 1 ))'G'$right
|
|
503
598
|
local -i zc=1 zw
|
|
@@ -537,7 +632,7 @@ __tt_pv_help() {
|
|
|
537
632
|
"Images ←→ , . pick one · D removes it · f finds one"
|
|
538
633
|
"enter on the empty frame · finds the first one"
|
|
539
634
|
"←→ step ⇧←→ ×10 1-9 place · = resets · + all"
|
|
540
|
-
"space hides · c colors"
|
|
635
|
+
"space hides · c colors · y copies who drew it"
|
|
541
636
|
"enter · tunes its colors full screen, keeps its own tone"
|
|
542
637
|
"? there lists its keys · esc leaves it"
|
|
543
638
|
"enter on Apply, or ⇧enter anywhere · saves, asks where"
|
|
@@ -599,7 +694,7 @@ __tt_pv_specimen() {
|
|
|
599
694
|
(( ${#sp} >= 20 )) || return 0
|
|
600
695
|
local z=$TTHEME_SGR[reset] d=$TTHEME_SGR[dim] cell hex fore line text piece role tabs="" built="" key="$applied|$painted|$scene|$sw|$sc|$ph"
|
|
601
696
|
local -A rs=(p "" d $TTHEME_SGR[dim] b $TTHEME_SGR[bold])
|
|
602
|
-
local -i i r=6 cw=4 k n=${#TTHEME_SCENES} at
|
|
697
|
+
local -i i r=6 cw=4 k n=${#TTHEME_SCENES} at room
|
|
603
698
|
(( n )) || return 0
|
|
604
699
|
if [[ $key == "$pvscene" ]]; then
|
|
605
700
|
out+=$pvscenes
|
|
@@ -660,11 +755,17 @@ __tt_pv_specimen() {
|
|
|
660
755
|
[[ $line == «n»* ]] && (( sw >= 44 )) && continue
|
|
661
756
|
(( r < ph )) || break
|
|
662
757
|
parts=("${(@s:«:)line}")
|
|
663
|
-
text=$parts[1]
|
|
758
|
+
text=$parts[1] room=$sw
|
|
759
|
+
while (( ${(m)#text} > room )); do text=${text[1,-2]}; done
|
|
760
|
+
(( room -= ${(m)#text} ))
|
|
664
761
|
for piece in "${(@)parts[2,-1]}"; do
|
|
762
|
+
(( room > 0 )) || break
|
|
665
763
|
role=${piece%%»*}
|
|
666
764
|
[[ $role == [wn] ]] && role=p
|
|
667
|
-
|
|
765
|
+
piece=${piece#*»}
|
|
766
|
+
while (( ${(m)#piece} > room )); do piece=${piece[1,-2]}; done
|
|
767
|
+
text+=$z${rs[${role:-p}]}$piece
|
|
768
|
+
(( room -= ${(m)#piece} ))
|
|
668
769
|
done
|
|
669
770
|
built+=$'\e['$r';'$sc'H'$text$z
|
|
670
771
|
(( ++r ))
|
|
@@ -701,6 +802,7 @@ __tt_pv_tune() {
|
|
|
701
802
|
',') __tt_pv_bg_pick -1 ;;
|
|
702
803
|
'.') __tt_pv_bg_pick 1 ;;
|
|
703
804
|
D) __tt_pv_bg_drop ;;
|
|
805
|
+
y) __tt_pv_bg_copy ;;
|
|
704
806
|
esac
|
|
705
807
|
return 0
|
|
706
808
|
}
|
|
@@ -1027,12 +1129,15 @@ __tt_pv_draw() {
|
|
|
1027
1129
|
fi
|
|
1028
1130
|
[[ $1 == hint ]] && (( ! wiped )) || pvz=()
|
|
1029
1131
|
if (( pw < 40 || ph < 12 )); then
|
|
1030
|
-
|
|
1031
|
-
(( color )) &&
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1132
|
+
local -a small=(ttheme "Needs 40×12 — now ${pw}×${ph}" "esc quits") paint=("" "" "")
|
|
1133
|
+
(( color )) && paint=($TTHEME_SGR[bold]$ac "" $TTHEME_SGR[dim])
|
|
1134
|
+
for (( k = 1; k <= 3 && k <= ph; k++ )); do
|
|
1135
|
+
line=${small[k]}
|
|
1136
|
+
while (( ${(m)#line} > pw )); do line=${line[1,-2]}; done
|
|
1137
|
+
(( k > 1 )) && out+=$'\n'
|
|
1138
|
+
out+=${paint[k]}$line${paint[k]:+$TTHEME_SGR[reset]}$'\e[K'
|
|
1139
|
+
done
|
|
1140
|
+
out+=$'\e[J'
|
|
1036
1141
|
__tt_pv_flush
|
|
1037
1142
|
return 0
|
|
1038
1143
|
fi
|
|
@@ -1100,7 +1205,7 @@ __tt_pv_draw() {
|
|
|
1100
1205
|
line=""
|
|
1101
1206
|
if (( k < h )); then
|
|
1102
1207
|
if (( ! N )); then
|
|
1103
|
-
(( k == 0 )) &&
|
|
1208
|
+
(( k == 0 )) && { __tt_clip " ${dd}No palettes match '$flt'$zz" $lw; line=$REPLY }
|
|
1104
1209
|
elif (( i <= N )); then
|
|
1105
1210
|
__tt_pv_row $i
|
|
1106
1211
|
line=$REPLY
|
|
@@ -1265,6 +1370,7 @@ __tt_pv_read() {
|
|
|
1265
1370
|
if [[ $REPLY != '[' && $REPLY != O ]]; then
|
|
1266
1371
|
key=nop
|
|
1267
1372
|
[[ $REPLY == c ]] && key=altc
|
|
1373
|
+
[[ $REPLY == [\]P_^X] ]] && __tt_pv_string
|
|
1268
1374
|
return 0
|
|
1269
1375
|
fi
|
|
1270
1376
|
while __tt_pv_getch 0.05; do
|
|
@@ -1286,10 +1392,33 @@ __tt_pv_read() {
|
|
|
1286
1392
|
Z) key=stab ;;
|
|
1287
1393
|
'<'<->';'<->';'<->[Mm]) __tt_pv_sgr $seq ;;
|
|
1288
1394
|
M) __tt_pv_x10 ;;
|
|
1395
|
+
"200~") __tt_pv_paste ;;
|
|
1289
1396
|
*) key=nop ;;
|
|
1290
1397
|
esac
|
|
1291
1398
|
}
|
|
1292
1399
|
|
|
1400
|
+
__tt_pv_string() {
|
|
1401
|
+
local prev=""
|
|
1402
|
+
while __tt_pv_getch 0.05; do
|
|
1403
|
+
[[ $REPLY == $'\a' || ( $prev == $'\e' && $REPLY == \\ ) ]] && return 0
|
|
1404
|
+
prev=$REPLY
|
|
1405
|
+
done
|
|
1406
|
+
}
|
|
1407
|
+
|
|
1408
|
+
__tt_pv_paste() {
|
|
1409
|
+
setopt localoptions extendedglob
|
|
1410
|
+
local text=""
|
|
1411
|
+
key=nop
|
|
1412
|
+
while __tt_pv_getch 0.5; do
|
|
1413
|
+
text+=$REPLY
|
|
1414
|
+
[[ $REPLY == '~' && $text == *$'\e[201~' ]] && break
|
|
1415
|
+
done
|
|
1416
|
+
text=${${text%$'\e[201~'}//[$'\r\n\t']##/ }
|
|
1417
|
+
pasted=${text//[[:cntrl:]]/}
|
|
1418
|
+
[[ -n $pasted ]] && key=paste
|
|
1419
|
+
return 0
|
|
1420
|
+
}
|
|
1421
|
+
|
|
1293
1422
|
__tt_pv_sgr() {
|
|
1294
1423
|
local -a p=(${(s:;:)${${1#<}%[Mm]}})
|
|
1295
1424
|
local -i b=$p[1]
|
|
@@ -1534,13 +1663,14 @@ __tt_pv_screen() {
|
|
|
1534
1663
|
to=$at
|
|
1535
1664
|
fi
|
|
1536
1665
|
done
|
|
1537
|
-
printf '\e[?2026h\e[?25l%s' "$pvmouse"
|
|
1666
|
+
printf '\e[?2026h\e[?25l\e[?2004h%s' "$pvmouse"
|
|
1538
1667
|
if [[ -n $applied ]]; then
|
|
1539
1668
|
__tt_pv_paint "$applied"
|
|
1540
1669
|
else
|
|
1541
1670
|
__tt_osc_reset
|
|
1542
1671
|
painted=""
|
|
1543
1672
|
fi
|
|
1673
|
+
__tt_pv_size
|
|
1544
1674
|
resized=1 bgname="" bgshown="" bgdim=()
|
|
1545
1675
|
return 0
|
|
1546
1676
|
}
|
|
@@ -1683,7 +1813,8 @@ __tt_te_edit() {
|
|
|
1683
1813
|
__tt_bg_hide $name
|
|
1684
1814
|
err=$(__tt_cli tone $name edit 2>&1 >/dev/tty)
|
|
1685
1815
|
rc=$?
|
|
1686
|
-
printf %s "$pvmouse"
|
|
1816
|
+
printf '\e[?2004h%s' "$pvmouse"
|
|
1817
|
+
__tt_pv_size
|
|
1687
1818
|
err=${${err//$'\n'/ }## #}
|
|
1688
1819
|
resized=1 bgname="" bgshown="" bgdim=()
|
|
1689
1820
|
if (( rc == 0 )); then
|
|
@@ -1969,7 +2100,7 @@ __tt_pv_te_panel() {
|
|
|
1969
2100
|
(( tewide == W )) || __tt_te_read $W
|
|
1970
2101
|
T=${#teframe} P=$(( ${#teframe} + 2 ))
|
|
1971
2102
|
__tt_te_image && pics=1
|
|
1972
|
-
(( pics &&
|
|
2103
|
+
(( pics && 19 <= R && (tfocus == 1 || 19 + P + 1 <= R) )) && I=19
|
|
1973
2104
|
V=$(( I + P + 1 ))
|
|
1974
2105
|
if (( V <= R || tfocus == 1 )); then
|
|
1975
2106
|
tetop=0
|
|
@@ -1990,23 +2121,25 @@ __tt_pv_te_panel() {
|
|
|
1990
2121
|
pvz+=("$(( y + i )) $col $end teimg")
|
|
1991
2122
|
done
|
|
1992
2123
|
fi
|
|
1993
|
-
if (( I ==
|
|
2124
|
+
if (( I == 19 )); then
|
|
1994
2125
|
if [[ -n $tune ]]; then
|
|
1995
2126
|
__tt_pv_bg_credit $(( ie - ix + 1 ))
|
|
1996
2127
|
[[ -n $REPLY ]] && out+=$'\e['$(( y + 1 ))';'$ix'H'$d$REPLY$z
|
|
2128
|
+
__tt_pv_bg_profiles $(( ie - ix + 1 ))
|
|
2129
|
+
[[ -n $REPLY ]] && out+=$'\e['$(( y + 2 ))';'$ix'H'$d$REPLY$z
|
|
1997
2130
|
fi
|
|
1998
|
-
__tt_pv_te_images $(( y +
|
|
2131
|
+
__tt_pv_te_images $(( y + 3 )) $ix $ie
|
|
1999
2132
|
if [[ -n $tune ]]; then
|
|
2000
|
-
bgstrip="$(( y +
|
|
2133
|
+
bgstrip="$(( y + 3 )) $ix $ie"
|
|
2001
2134
|
(( tfocus == 1 )) || tf=0
|
|
2002
|
-
__tt_pv_bg_panel $tpick $(( y +
|
|
2135
|
+
__tt_pv_bg_panel $tpick $(( y + 10 )) $ix $ie
|
|
2003
2136
|
tf=$tfs
|
|
2004
2137
|
else
|
|
2005
|
-
__tt_pv_te_tile $(( y +
|
|
2006
|
-
for (( i =
|
|
2138
|
+
__tt_pv_te_tile $(( y + 4 )) $ix
|
|
2139
|
+
for (( i = 4; i <= 8; i++ )); do
|
|
2007
2140
|
pvz+=("$(( y + i )) $ix $(( ix + 30 )) tefind")
|
|
2008
2141
|
done
|
|
2009
|
-
__tt_pv_te_ghost $(( y +
|
|
2142
|
+
__tt_pv_te_ghost $(( y + 10 )) $ix $ie
|
|
2010
2143
|
fi
|
|
2011
2144
|
elif (( pics )); then
|
|
2012
2145
|
__tt_pv_te_images $(( y + 1 )) $ix $ie
|
|
@@ -2052,7 +2185,7 @@ __tt_pv_te_panel() {
|
|
|
2052
2185
|
else
|
|
2053
2186
|
(( color )) && out+=" "$b" Apply "$z || out+=" Apply "
|
|
2054
2187
|
fi
|
|
2055
|
-
out+=" "$d$note$z
|
|
2188
|
+
(( ${#note} <= end - ix - 10 )) && out+=" "$d$note$z
|
|
2056
2189
|
return 0
|
|
2057
2190
|
}
|
|
2058
2191
|
|
|
@@ -2222,6 +2355,15 @@ __tt_pv_handle() {
|
|
|
2222
2355
|
__tt_pv_rows
|
|
2223
2356
|
__tt_pv_first "$name"
|
|
2224
2357
|
;;
|
|
2358
|
+
paste)
|
|
2359
|
+
__tt_pv_lw
|
|
2360
|
+
name=""
|
|
2361
|
+
[[ ${rtype[cur]} == thm ]] && name=${rval[cur]}
|
|
2362
|
+
flt+=${(L)pasted}
|
|
2363
|
+
while [[ -n $flt ]] && (( ${(m)#flt} > reply[1] - 12 )); do flt=${flt[1,-2]}; done
|
|
2364
|
+
__tt_pv_rows
|
|
2365
|
+
__tt_pv_first "$name"
|
|
2366
|
+
;;
|
|
2225
2367
|
esac
|
|
2226
2368
|
return 0
|
|
2227
2369
|
}
|
|
@@ -2242,13 +2384,13 @@ __tt_preview() {
|
|
|
2242
2384
|
local -i scene=0
|
|
2243
2385
|
local -a bgorder=()
|
|
2244
2386
|
local -A bgfrom=() bgurl=() bgby=() bgsent=() bgcost=() bgdim=() bgsrc=() bgfill=() bgfocus=() bgsize=() bgpos=() bgop=() bgdef=() bgoff=() bgbase=() bgload=() bgshot=() bgshotkey=() bgedit=() bgtunef=() bgofff=() bgimages=()
|
|
2245
|
-
local -A bgpic=() bgpics=() bgact=() bgview=() bgswap=() bgthumb=() tsnaps=() pvseek=() bgcolors=() bgprep=() TTHEME_ALIASES=()
|
|
2387
|
+
local -A bgpic=() bgpics=() bgact=() bgview=() bgswap=() bgthumb=() tsnaps=() pvseek=() bgcolors=() bgcred=() bgpage=() bgprof=() bgprep=() TTHEME_ALIASES=()
|
|
2246
2388
|
local conf=0 cf=1
|
|
2247
2389
|
local -a plabel=(" Default " " This tab ") pkeys=() reach=() csnap=() teframe=()
|
|
2248
2390
|
local te=0 tfocus=0 tetop=0 tewide=0 tbtn=0 tearm=0 tename=""
|
|
2249
2391
|
local -i pvgone=0 bgprepid=0 mrow=0 mcol=0 mclick=0 mwheel=0 mlwheel=0 mlrow=0 mlcol=0
|
|
2250
2392
|
local -F mlast=0
|
|
2251
|
-
local mact="" mzone="" pvmouse=""
|
|
2393
|
+
local mact="" mzone="" pvmouse="" pasted=""
|
|
2252
2394
|
local -a pvz=()
|
|
2253
2395
|
local -a cvars=(TTHEME_TAB_PALETTE TTHEME_ANNOUNCE TTHEME_FX TTHEME_SORT TTHEME_MOUSE TTHEME_BG_BLUR TTHEME_BG_COLORS) clabel=("New tabs" Announce "Search fx" Sort Mouse Blur Colors)
|
|
2254
2396
|
local -a cchoice=("off seq" "1 0" "typewriter decode glitch" "abc series" "on off" "0 1 2 3 4" "tone original") cshow=("off seq" "on off" "typewriter decode glitch" "abc series" "on off" "off 1px 2px 3px 4px" "tone original")
|
|
@@ -2283,7 +2425,7 @@ __tt_preview() {
|
|
|
2283
2425
|
tty=$(stty -g 2>/dev/null) && stty -echo -icanon -ixon min 1 time 0 2>/dev/null || tty=""
|
|
2284
2426
|
TTHEME_RAW=$(( ${#tty} > 0 ))
|
|
2285
2427
|
__tt_pv_bg_open
|
|
2286
|
-
printf '\e[?2026h\e[?1049h\e[?7l\e[?25l'
|
|
2428
|
+
printf '\e[?2026h\e[?1049h\e[?7l\e[?25l\e[?2004h'
|
|
2287
2429
|
__tt_pv_pointer
|
|
2288
2430
|
while :; do
|
|
2289
2431
|
printf '\e[?2026h'
|
|
@@ -2316,7 +2458,7 @@ __tt_preview() {
|
|
|
2316
2458
|
__tt_pv_unpaint
|
|
2317
2459
|
fi
|
|
2318
2460
|
__tt_pv_pointer off
|
|
2319
|
-
printf '\e[?7h'
|
|
2461
|
+
printf '\e[?2004l\e[?7h'
|
|
2320
2462
|
(( hubleft )) || printf '\e[?1049l'
|
|
2321
2463
|
printf '\e[?25h\e[?2026l'
|
|
2322
2464
|
[[ -n $tty ]] && stty "$tty" 2>/dev/null
|