@kecan0406/ttheme 1.2.19 → 1.2.21

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kecan0406/ttheme",
3
- "version": "1.2.19",
3
+ "version": "1.2.21",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "ttheme": "bin/ttheme.js"
@@ -37,10 +37,12 @@
37
37
  "@clack/prompts": "^1.8.1",
38
38
  "@jsquash/jpeg": "^1.6.0",
39
39
  "@material/material-color-utilities": "^0.4.0",
40
+ "@oxlint/plugins": "1.87.0",
40
41
  "@types/bun": "^1.4.2",
41
42
  "@types/pngjs": "6.0.5",
42
43
  "@xterm/headless": "6.0.0",
43
44
  "fast-string-width": "^3.0.2",
45
+ "oxlint": "1.87.0",
44
46
  "pngjs": "7.0.0",
45
47
  "smol-toml": "^1.9.0",
46
48
  "typescript": "^7.0.2",
@@ -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]}
@@ -509,8 +512,8 @@ __tt_pv_bg_reset() {
509
512
  for img in ${(k)bgsrc[(I)${(b)1}(|:*)]}; do
510
513
  unset "bgsrc[$img]"
511
514
  done
512
- for img in ${(k)bgcolors[(I)${(b)1}:*]}; do
513
- 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]"
514
517
  done
515
518
  unset "bgview[$1]" "bgswap[$1]"
516
519
  }
package/shell/preview.zsh CHANGED
@@ -4,7 +4,7 @@ __tt_pv_seek() {
4
4
  local t part key REPLY
5
5
  for t in ${(k)TTHEME_PALETTE}; do
6
6
  key=""
7
- for part in "$t" "${TTHEME_GROUP[$t]:-Other}" "${TTHEME_NATIVE[$t]}" "${TTHEME_CATALOG[$t]}" "${(@s:|:)TTHEME_NATIVE_NAMES[$t]}" "${TTHEME_CHARACTER[$t]}" "${(@s:|:)TTHEME_ALIASES[$t]}"; do
7
+ for part in "$t" "${TTHEME_MARKETPLACE[$t]}" "${TTHEME_NATIVE[$t]}" "${TTHEME_CATALOG[$t]}" "${(@s:|:)TTHEME_NATIVE_NAMES[$t]}" "${TTHEME_CHARACTER[$t]}" "${(@s:|:)TTHEME_ALIASES[$t]}"; do
8
8
  [[ -n $part ]] || continue
9
9
  __tt_pv_norm "$part"
10
10
  key+="|$REPLY"
@@ -33,9 +33,9 @@ __tt_pv_rows() {
33
33
  __tt_pv_norm "$flt"
34
34
  nflt=$REPLY
35
35
  fi
36
- for g in $groups; do
36
+ for g in $tops; do
37
37
  ts=()
38
- for t in ${=gthemes[$g]}; do
38
+ for t in ${=tmembers[$g]}; do
39
39
  [[ -z $flt || ${pvseek[$t]} == *$nflt* ]] && ts+=($t)
40
40
  done
41
41
  [[ -n $flt ]] && (( ! ${#ts} )) && continue
@@ -91,7 +91,7 @@ __tt_pv_first() {
91
91
  }
92
92
 
93
93
  __tt_pv_goto() {
94
- local name=$1 i g=${TTHEME_GROUP[$1]:-Other} c=${TTHEME_CATALOG[$1]}
94
+ local name=$1 i g=${TTHEME_MARKETPLACE[$1]:-${TTHEME_CATALOG[$1]:-Other}} c=${TTHEME_CATALOG[$1]}
95
95
  exp[$g]=1
96
96
  [[ -n $c && $g == *@* ]] && exp[$g/$c]=1
97
97
  __tt_pv_rows
@@ -143,7 +143,7 @@ __tt_pv_left() {
143
143
  fi
144
144
  return 0
145
145
  fi
146
- local g=${TTHEME_GROUP[${rval[cur]}]:-Other} c=${TTHEME_CATALOG[${rval[cur]}]}
146
+ local g=${TTHEME_MARKETPLACE[${rval[cur]}]:-${TTHEME_CATALOG[${rval[cur]}]:-Other}} c=${TTHEME_CATALOG[${rval[cur]}]}
147
147
  [[ -n $c && $g == *@* ]] && g=$g/$c
148
148
  exp[$g]=""
149
149
  __tt_pv_rows
@@ -241,7 +241,7 @@ __tt_pv_row() {
241
241
  (( color )) && on=$sb
242
242
  fi
243
243
  if [[ ${rtype[$1]} == rule ]]; then
244
- name='── Markets '
244
+ name='── Marketplaces '
245
245
  REPLY=" "$d$name${(l:lw - 4 - ${#name}::─:)}$z
246
246
  return 0
247
247
  fi
@@ -258,7 +258,7 @@ __tt_pv_row() {
258
258
  __tt_pv_hl "$name" "$base"
259
259
  hl=$REPLY
260
260
  w=$(( lw - 6 - ${(m)#name} - ${#rcnt[$1]} ))
261
- __tt_pv_alias "$t" "${TTHEME_NATIVE[${${=gthemes[$t]}[1]}]}"
261
+ __tt_pv_alias "$t" "${TTHEME_NATIVE[${${=tmembers[$t]}[1]}]}"
262
262
  __tt_pv_fit "$REPLY"
263
263
  extra=$REPLY
264
264
  (( w < 1 )) && w=1
@@ -287,7 +287,7 @@ __tt_pv_row() {
287
287
  mark=$ac$cdot$r
288
288
  fi
289
289
  name=${t##*/}
290
- [[ -n ${TTHEME_CATALOG[$t]} && ${TTHEME_GROUP[$t]} == *@* ]] && ind=" "
290
+ [[ -n ${TTHEME_CATALOG[$t]} && -n ${TTHEME_MARKETPLACE[$t]} ]] && ind=" "
291
291
  (( ${TTHEME_TUNED[(Ie)$t]} )) && w=-2
292
292
  (( ${(m)#name} > lw - 17 - ${#ind} + w )) && name="${name[1,lw-18-${#ind}+w]}…"
293
293
  __tt_pv_hl "$name" "$base"
@@ -313,16 +313,91 @@ __tt_pv_row() {
313
313
  fi
314
314
  }
315
315
 
316
+ __tt_pv_bg_pickkey() {
317
+ REPLY=${tpick#*:}
318
+ [[ $tpick == *:* ]] || REPLY=${bgact[$tune]}
319
+ }
320
+
316
321
  __tt_pv_bg_credit() {
317
- local by=${bgby[$tpick]} ref=${bgfrom[$tpick]} url=${bgurl[$tpick]} mark="" sgr=""
322
+ local by=${bgby[$tpick]} ref=${bgfrom[$tpick]} url=${bgurl[$tpick]} page lab pu pmark="" smark="" sgr="" acc=""
318
323
  local -i room=$1
319
- [[ -n $ref && $url == http(s|)://* ]] && __tt_links && mark="⧉ "
320
- REPLY=${by:+by $by}${by:+${ref:+ · }}${ref:+$mark$ref}
321
- (( ${#REPLY} > room )) && REPLY=${by:+by $by}
322
- (( ${#REPLY} > room )) && REPLY=""
323
- [[ -n $mark && $REPLY == *"$mark$ref"* ]] || return 0
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
324
343
  (( color )) && [[ -n ${TTHEME_SITE_ANSI[${ref%% *}]} ]] && sgr=$TTHEME_SGR[fg${TTHEME_SITE_ANSI[${ref%% *}]}]
325
- REPLY=${REPLY/"$mark$ref"/$sgr⧉${sgr:+$TTHEME_SGR[/fg]} $'\e]8;;'$url$'\e\\'$ref$'\e]8;;\e\\'}
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
326
401
  return 0
327
402
  }
328
403
 
@@ -424,6 +499,8 @@ __tt_pv_foot() {
424
499
  kl[2]="image ×$REPLY"
425
500
  (( REPLY > 1 )) || { kk[2]=() kl[2]=() }
426
501
  __tt_pv_bg_findable $tune && { kk+=(f); kl+=(find) }
502
+ __tt_pv_bg_pickkey
503
+ [[ -n ${bgcred[$tune:$REPLY]} ]] && { kk+=(y); kl+=(credit) }
427
504
  kk+=(D) kl+=(remove)
428
505
  elif [[ -n $tune ]]; then
429
506
  __tt_pv_bg_findable $tune && { kk+=(f); kl+=(find) }
@@ -435,6 +512,8 @@ __tt_pv_foot() {
435
512
  kk+=('=' + ⇧←→) kl+=(reset "reset all" ×10)
436
513
  fi
437
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) }
438
517
  __tt_pv_bg_images $tune
439
518
  (( REPLY > 1 )) && { kk+=(', .' D); kl+=("image ×$REPLY" remove) }
440
519
  else
@@ -553,7 +632,7 @@ __tt_pv_help() {
553
632
  "Images ←→ , . pick one · D removes it · f finds one"
554
633
  "enter on the empty frame · finds the first one"
555
634
  "←→ step ⇧←→ ×10 1-9 place · = resets · + all"
556
- "space hides · c colors"
635
+ "space hides · c colors · y copies who drew it"
557
636
  "enter · tunes its colors full screen, keeps its own tone"
558
637
  "? there lists its keys · esc leaves it"
559
638
  "enter on Apply, or ⇧enter anywhere · saves, asks where"
@@ -561,10 +640,10 @@ __tt_pv_help() {
561
640
  "esc · back to the list, dropping picture changes since s"
562
641
  )
563
642
  else
564
- hk=(Move Series Filter "" Example Apply Edit)
643
+ hk=(Move Catalogs Filter "" Example Apply Edit)
565
644
  hv=(
566
645
  "↑↓ home end pgup pgdn"
567
- "←→ · enter or space on a series"
646
+ "←→ · enter or space on a catalog"
568
647
  "Any text · bksp · ctrl-u clears"
569
648
  "Names and titles, in Japanese too"
570
649
  "⇧←→ ${(Lj:, :)TTHEME_SCENES}"
@@ -573,7 +652,7 @@ __tt_pv_help() {
573
652
  )
574
653
  hk+=(Config "")
575
654
  hv+=("alt-c · ↑↓ setting ←→ value" "enter saves · esc undoes")
576
- (( hub )) && { hk+=(Screens); hv+=("shift+tab · tab on a series") }
655
+ (( hub )) && { hk+=(Screens); hv+=("shift+tab · tab on a catalog") }
577
656
  fi
578
657
  hk+=(Close)
579
658
  if (( help == 2 )); then
@@ -723,6 +802,7 @@ __tt_pv_tune() {
723
802
  ',') __tt_pv_bg_pick -1 ;;
724
803
  '.') __tt_pv_bg_pick 1 ;;
725
804
  D) __tt_pv_bg_drop ;;
805
+ y) __tt_pv_bg_copy ;;
726
806
  esac
727
807
  return 0
728
808
  }
@@ -764,7 +844,7 @@ __tt_pv_untune() {
764
844
 
765
845
  __tt_pv_regroup() {
766
846
  local ty=${rtype[cur]} v=${rval[cur]} i
767
- __tt_pv_group
847
+ __tt_pv_tops
768
848
  __tt_pv_rows
769
849
  for (( i = 1; i <= ${#rval}; i++ )); do
770
850
  [[ ${rtype[i]} == "$ty" && ${rval[i]} == "$v" ]] && { cur=$i; return 0 }
@@ -1032,8 +1112,8 @@ __tt_pv_draw() {
1032
1112
  fi
1033
1113
  fi
1034
1114
  if [[ ${rtype[cur]} == thm ]]; then
1035
- ag=${TTHEME_GROUP[${rval[cur]}]:-Other}
1036
- [[ -n ${TTHEME_CATALOG[${rval[cur]}]} ]] && acat=$ag/${TTHEME_CATALOG[${rval[cur]}]}
1115
+ ag=${TTHEME_MARKETPLACE[${rval[cur]}]:-${TTHEME_CATALOG[${rval[cur]}]:-Other}}
1116
+ [[ -n ${TTHEME_MARKETPLACE[${rval[cur]}]} && -n ${TTHEME_CATALOG[${rval[cur]}]} ]] && acat=$ag/${TTHEME_CATALOG[${rval[cur]}]}
1037
1117
  fi
1038
1118
  fi
1039
1119
  if [[ -n $flt ]]; then
@@ -1070,7 +1150,7 @@ __tt_pv_draw() {
1070
1150
  if [[ -n $flt ]]; then
1071
1151
  find=$flt"_"
1072
1152
  else
1073
- ex="$expal | $exgrp"
1153
+ ex="$expal | $extop"
1074
1154
  local -i room=$(( tall ? lw - 21 : lw - 19 - ${#cnt} ))
1075
1155
  (( ${#ex} > room )) && ex="${ex[1,room-1]}…"
1076
1156
  if (( gstep > 0 )); then
@@ -1183,14 +1263,14 @@ __tt_pv_draw() {
1183
1263
  __tt_pv_flush
1184
1264
  }
1185
1265
 
1186
- __tt_pv_group() {
1266
+ __tt_pv_tops() {
1187
1267
  local k g
1188
- groups=() gthemes=()
1268
+ tops=() tmembers=()
1189
1269
  __tt_order
1190
1270
  for k in $reply; do
1191
- g=${TTHEME_GROUP[$k]:-Other}
1192
- [[ -n ${gthemes[$g]} ]] || groups+=($g)
1193
- gthemes[$g]+=" $k"
1271
+ g=${TTHEME_MARKETPLACE[$k]:-${TTHEME_CATALOG[$k]:-Other}}
1272
+ [[ -n ${tmembers[$g]} ]] || tops+=($g)
1273
+ tmembers[$g]+=" $k"
1194
1274
  done
1195
1275
  }
1196
1276
 
@@ -1220,7 +1300,7 @@ __tt_pv_strip() {
1220
1300
  }
1221
1301
 
1222
1302
  __tt_pv_init() {
1223
- __tt_pv_group
1303
+ __tt_pv_tops
1224
1304
  [[ -n $orig ]] && __tt_name_of "$orig" && cn=$REPLY
1225
1305
  [[ -n ${TTHEME_PALETTE[$cn]} ]] || return 0
1226
1306
  cdot="◆"
@@ -1228,7 +1308,7 @@ __tt_pv_init() {
1228
1308
 
1229
1309
  __tt_pv_roll() {
1230
1310
  expal=${TTHEME_ORDER[RANDOM % ${#TTHEME_ORDER} + 1]}
1231
- exgrp=${groups[RANDOM % ${#groups} + 1]}
1311
+ extop=${tops[RANDOM % ${#tops} + 1]}
1232
1312
  gseed=$RANDOM
1233
1313
  exnext=$(( SECONDS + 3 ))
1234
1314
  }
@@ -1899,7 +1979,9 @@ __tt_pv_te_head() {
1899
1979
  (( color )) || z= d= b= y=
1900
1980
  __tt_te_unsaved && (( room -= 11 ))
1901
1981
  line=$b$ac"◆"$z" "$b$tename$z
1902
- [[ -n ${TTHEME_GROUP[$tename]} ]] && line+=" "$d"· ${TTHEME_GROUP[$tename]}"$z
1982
+ local REPLY
1983
+ __tt_shelf $tename
1984
+ line+=" "$d"· $REPLY"$z
1903
1985
  __tt_clip "$line" $room
1904
1986
  out+=$'\e[1;'$col'H'$REPLY$z
1905
1987
  __tt_te_unsaved && out+=$'\e[1;'$(( end - 8 ))'H'$y"●"$z" "$d"unsaved"$z
@@ -2020,7 +2102,7 @@ __tt_pv_te_panel() {
2020
2102
  (( tewide == W )) || __tt_te_read $W
2021
2103
  T=${#teframe} P=$(( ${#teframe} + 2 ))
2022
2104
  __tt_te_image && pics=1
2023
- (( pics && 18 <= R && (tfocus == 1 || 18 + P + 1 <= R) )) && I=18
2105
+ (( pics && 19 <= R && (tfocus == 1 || 19 + P + 1 <= R) )) && I=19
2024
2106
  V=$(( I + P + 1 ))
2025
2107
  if (( V <= R || tfocus == 1 )); then
2026
2108
  tetop=0
@@ -2041,23 +2123,25 @@ __tt_pv_te_panel() {
2041
2123
  pvz+=("$(( y + i )) $col $end teimg")
2042
2124
  done
2043
2125
  fi
2044
- if (( I == 18 )); then
2126
+ if (( I == 19 )); then
2045
2127
  if [[ -n $tune ]]; then
2046
2128
  __tt_pv_bg_credit $(( ie - ix + 1 ))
2047
2129
  [[ -n $REPLY ]] && out+=$'\e['$(( y + 1 ))';'$ix'H'$d$REPLY$z
2130
+ __tt_pv_bg_profiles $(( ie - ix + 1 ))
2131
+ [[ -n $REPLY ]] && out+=$'\e['$(( y + 2 ))';'$ix'H'$d$REPLY$z
2048
2132
  fi
2049
- __tt_pv_te_images $(( y + 2 )) $ix $ie
2133
+ __tt_pv_te_images $(( y + 3 )) $ix $ie
2050
2134
  if [[ -n $tune ]]; then
2051
- bgstrip="$(( y + 2 )) $ix $ie"
2135
+ bgstrip="$(( y + 3 )) $ix $ie"
2052
2136
  (( tfocus == 1 )) || tf=0
2053
- __tt_pv_bg_panel $tpick $(( y + 9 )) $ix $ie
2137
+ __tt_pv_bg_panel $tpick $(( y + 10 )) $ix $ie
2054
2138
  tf=$tfs
2055
2139
  else
2056
- __tt_pv_te_tile $(( y + 3 )) $ix
2057
- for (( i = 3; i <= 7; i++ )); do
2140
+ __tt_pv_te_tile $(( y + 4 )) $ix
2141
+ for (( i = 4; i <= 8; i++ )); do
2058
2142
  pvz+=("$(( y + i )) $ix $(( ix + 30 )) tefind")
2059
2143
  done
2060
- __tt_pv_te_ghost $(( y + 9 )) $ix $ie
2144
+ __tt_pv_te_ghost $(( y + 10 )) $ix $ie
2061
2145
  fi
2062
2146
  elif (( pics )); then
2063
2147
  __tt_pv_te_images $(( y + 1 )) $ix $ie
@@ -2296,13 +2380,13 @@ __tt_preview() {
2296
2380
  print -u2 "ttheme $mode: needs a terminal"
2297
2381
  return 1
2298
2382
  fi
2299
- local orig=$TTHEME_SPEC applied=$TTHEME_SPEC painted=$TTHEME_SPEC flt="" sel="" cn="" cdot="" key="" REPLY="" cur=1 top=1 color=0 pw=80 ph=24 resized=1 expal="" exgrp="" exnext=0 gstep=0 gseed=0 tick=0 pvhd=2 pvsr=1 pvsc=4
2383
+ local orig=$TTHEME_SPEC applied=$TTHEME_SPEC painted=$TTHEME_SPEC flt="" sel="" cn="" cdot="" key="" REPLY="" cur=1 top=1 color=0 pw=80 ph=24 resized=1 expal="" extop="" exnext=0 gstep=0 gseed=0 tick=0 pvhd=2 pvsr=1 pvsc=4
2300
2384
  local pick="" pk=1 pkdef=1 picked=0 canpick=0 bgcw=0 bgch=0 bgname="" bgshown="" bginc="" osd="" osdt=0
2301
2385
  local tune="" tpick="" tf=1 help=0 msg="" msgt=0 an="" bgrel=0 bgmx=0 bgmy=0 bganchor=0 bgcut="" bgnext=0 bgbytes=0 bgstrip="" pvscene="" pvscenes=""
2302
2386
  local -i scene=0
2303
2387
  local -a bgorder=()
2304
2388
  local -A bgfrom=() bgurl=() bgby=() bgsent=() bgcost=() bgdim=() bgsrc=() bgfill=() bgfocus=() bgsize=() bgpos=() bgop=() bgdef=() bgoff=() bgbase=() bgload=() bgshot=() bgshotkey=() bgedit=() bgtunef=() bgofff=() bgimages=()
2305
- local -A bgpic=() bgpics=() bgact=() bgview=() bgswap=() bgthumb=() tsnaps=() pvseek=() bgcolors=() bgprep=() TTHEME_ALIASES=()
2389
+ local -A bgpic=() bgpics=() bgact=() bgview=() bgswap=() bgthumb=() tsnaps=() pvseek=() bgcolors=() bgcred=() bgpage=() bgprof=() bgprep=() TTHEME_ALIASES=()
2306
2390
  local conf=0 cf=1
2307
2391
  local -a plabel=(" Default " " This tab ") pkeys=() reach=() csnap=() teframe=()
2308
2392
  local te=0 tfocus=0 tetop=0 tewide=0 tbtn=0 tearm=0 tename=""
@@ -2311,12 +2395,12 @@ __tt_preview() {
2311
2395
  local mact="" mzone="" pvmouse="" pasted=""
2312
2396
  local -a pvz=()
2313
2397
  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)
2314
- 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")
2398
+ local -a cchoice=("off seq" "1 0" "typewriter decode glitch" "abc catalog" "on off" "0 1 2 3 4" "tone original") cshow=("off seq" "on off" "typewriter decode glitch" "abc catalog" "on off" "off 1px 2px 3px 4px" "tone original")
2315
2399
  local -A cnote=(
2316
2400
  TTHEME_TAB_PALETTE:seq "New tabs rotate through palettes" TTHEME_TAB_PALETTE:off "New tabs keep the terminal theme"
2317
2401
  TTHEME_ANNOUNCE:1 "Shows the palette notice" TTHEME_ANNOUNCE:0 "Silences the palette notice"
2318
2402
  TTHEME_FX:typewriter "The search hint types itself" TTHEME_FX:decode "The search hint decodes" TTHEME_FX:glitch "The search hint glitches in"
2319
- TTHEME_SORT:abc "Series and palettes by name" TTHEME_SORT:series "Series in the order added"
2403
+ TTHEME_SORT:abc "Catalogs and palettes by name" TTHEME_SORT:catalog "Catalogs in the order added"
2320
2404
  TTHEME_MOUSE:on "Clicks, the wheel and drags work in ttheme's screens" TTHEME_MOUSE:off "The terminal keeps the mouse, so a drag selects text"
2321
2405
  TTHEME_BG_BLUR:0 "Pictures stay sharp" TTHEME_BG_BLUR:1 "Pictures soften a little behind the text"
2322
2406
  TTHEME_BG_BLUR:2 "Pictures soften behind the text" TTHEME_BG_BLUR:3 "Pictures blur behind the text"
@@ -2328,8 +2412,8 @@ __tt_preview() {
2328
2412
  [[ $mode == pin ]] && __tt_pin_scopes "$pdir"
2329
2413
  __tt_pv_canpick
2330
2414
  __tt_pv_size
2331
- local -a groups=() rtype=() rval=() rcnt=() reply=()
2332
- local -A gthemes=() exp=() tstrip=()
2415
+ local -a tops=() rtype=() rval=() rcnt=() reply=()
2416
+ local -A tmembers=() exp=() tstrip=()
2333
2417
  __tt_color && color=1
2334
2418
  __tt_pv_init
2335
2419
  __tt_pv_roll
@@ -2400,7 +2484,7 @@ __tt_preview() {
2400
2484
  else
2401
2485
  (( ${#bgedit} + ${#bgswap} )) && [[ -n ${TTHEME_PALETTE[$cn]} ]] && { __tt_shown "$cn" && __tt_reload }
2402
2486
  fi
2403
- (( hubleft )) && __tt_catalog_done "$hubwas"
2487
+ (( hubleft )) && __tt_installs_done "$hubwas"
2404
2488
  }
2405
2489
  return 0
2406
2490
  }
package/shell/ttheme.zsh CHANGED
@@ -20,7 +20,7 @@ typeset -gA TTHEME_SGR=(
20
20
  __tt_palettes_load() {
21
21
  emulate -L zsh ${=${options[xtrace]:#off}:+-o xtrace}
22
22
  local -a at
23
- unset TTHEME_PALETTE TTHEME_GROUP TTHEME_CATALOG TTHEME_NATIVE TTHEME_SRC
23
+ unset TTHEME_PALETTE TTHEME_MARKETPLACE TTHEME_CATALOG TTHEME_NATIVE TTHEME_SRC
24
24
  source $TTHEME_HOME/palettes.zsh || return 1
25
25
  zstat -F %s.%N -A at +mtime -- $TTHEME_HOME/palettes.zsh 2>/dev/null
26
26
  TTHEME_PALETTES_AT=$at[1]
@@ -172,7 +172,7 @@ __tt_pins_load
172
172
 
173
173
  : ${TTHEME_WARP_FAST:=on}
174
174
 
175
- : ${TTHEME_MARKET_LOOKUP:=on}
175
+ : ${TTHEME_MARKETPLACE_LOOKUP:=on}
176
176
 
177
177
  typeset -g TTHEME_STATE_DIR=${XDG_STATE_HOME:-$HOME/.local/state}/ttheme
178
178
 
@@ -327,7 +327,8 @@ __tt_announce() {
327
327
  __tt_name_of "$TTHEME_SPEC"
328
328
  [[ -n ${TTHEME_PALETTE[$REPLY]} ]] || return 0
329
329
  local name=$REPLY
330
- local grp=${TTHEME_GROUP[$name]:-Other} src=${TTHEME_SRC[$name]:-unknown}
330
+ __tt_shelf $name
331
+ local grp=$REPLY src=${TTHEME_SRC[$name]:-unknown}
331
332
  if ! __tt_color; then
332
333
  print -r -- "$name · $grp · ANSI $src"
333
334
  return 0
@@ -1300,19 +1301,26 @@ __tt_keep() {
1300
1301
  }
1301
1302
 
1302
1303
  __tt_order() {
1303
- if [[ $TTHEME_SORT == series ]]; then
1304
+ if [[ $TTHEME_SORT == catalog ]]; then
1304
1305
  reply=($TTHEME_ORDER)
1305
1306
  else
1306
1307
  reply=($TTHEME_ABC)
1307
1308
  fi
1308
1309
  }
1309
1310
 
1311
+ __tt_shelf() {
1312
+ local m=${TTHEME_MARKETPLACE[$1]} c=${TTHEME_CATALOG[$1]}
1313
+ REPLY=${m:+$m${c:+ / }}$c
1314
+ REPLY=${REPLY:-Other}
1315
+ }
1316
+
1310
1317
  __tt_menu() {
1311
- local k
1318
+ local k REPLY
1312
1319
  local -a reply
1313
1320
  __tt_order
1314
1321
  for k in $reply; do
1315
- printf '%s\t%s\t%s\n' "$k" "${TTHEME_GROUP[$k]:-Other}" "${TTHEME_SRC[$k]:-unknown}"
1322
+ __tt_shelf $k
1323
+ printf '%s\t%s\t%s\n' "$k" "$REPLY" "${TTHEME_SRC[$k]:-unknown}"
1316
1324
  done
1317
1325
  }
1318
1326
 
@@ -1366,14 +1374,14 @@ __tt_cli() {
1366
1374
  env $pass node $TTHEME_HOME/ttheme.js "$@"
1367
1375
  }
1368
1376
 
1369
- __tt_catalog() {
1377
+ __tt_installs() {
1370
1378
  local was="$TTHEME_STARTUP ${TTHEME_PALETTE[$TTHEME_STARTUP]}"
1371
1379
  __tt_cli "$@" || return
1372
1380
  [[ $1 == (list|share) ]] && return 0
1373
- __tt_catalog_done "$was"
1381
+ __tt_installs_done "$was"
1374
1382
  }
1375
1383
 
1376
- __tt_catalog_done() {
1384
+ __tt_installs_done() {
1377
1385
  [[ -r $TTHEME_HOME/palettes.zsh ]] || return 0
1378
1386
  local was=$TTHEME_PALETTES_AT
1379
1387
  local -a reply
@@ -1548,7 +1556,7 @@ ttheme() {
1548
1556
  if (( ${#TTHEME_PALETTE} )); then
1549
1557
  __tt_preview hub
1550
1558
  else
1551
- __tt_catalog browse
1559
+ __tt_installs browse
1552
1560
  fi
1553
1561
  else
1554
1562
  (( ${#TTHEME_PALETTE} )) || { __tt_empty; return }
@@ -1558,11 +1566,11 @@ ttheme() {
1558
1566
  fi
1559
1567
 
1560
1568
  case $1 in
1561
- list|add|remove|update|market|new) __tt_catalog "$@"; return ;;
1569
+ list|add|remove|update|marketplace|new) __tt_installs "$@"; return ;;
1562
1570
  edit|check|share)
1563
1571
  local REPLY
1564
1572
  __tt_name_of "$TTHEME_SPEC"
1565
- TTHEME_WORN=${TTHEME_PALETTE[$REPLY]:+$REPLY} __tt_catalog "$@"
1573
+ TTHEME_WORN=${TTHEME_PALETTE[$REPLY]:+$REPLY} __tt_installs "$@"
1566
1574
  return ;;
1567
1575
  on|off) __tt_switch "$@"; return ;;
1568
1576
  info) TTHEME_ZSH=$ZSH_VERSION __tt_cli "$@"; return ;;
@@ -1612,9 +1620,9 @@ if (( ${+functions[compdef]} )); then
1612
1620
  _files -/
1613
1621
  elif [[ $words[2] == new ]]; then
1614
1622
  compadd -- --from --in
1615
- elif [[ $words[2] == market && $CURRENT == 3 ]]; then
1623
+ elif [[ $words[2] == marketplace && $CURRENT == 3 ]]; then
1616
1624
  compadd -- add remove search init
1617
- elif [[ $words[2] == market && $words[3] == (add|init) && $CURRENT == 4 ]]; then
1625
+ elif [[ $words[2] == marketplace && $words[3] == (add|init) && $CURRENT == 4 ]]; then
1618
1626
  _files -/
1619
1627
  elif [[ $words[2] == (pin|unpin) && $CURRENT == 3 ]]; then
1620
1628
  reply=(${${(M)${(k)TTHEME_PINS}:#ssh:*}#ssh:})
@@ -1628,11 +1636,11 @@ if (( ${+functions[compdef]} )); then
1628
1636
  _files -/
1629
1637
  [[ $words[2] == pin || ${#reply} -gt 0 ]] && compadd -S '' -- ssh:
1630
1638
  fi
1631
- elif [[ $words[2] == add && $words[CURRENT-1] == --market ]]; then
1639
+ elif [[ $words[2] == add && $words[CURRENT-1] == --marketplace ]]; then
1632
1640
  _files -/
1633
1641
  elif [[ $words[2] == add ]]; then
1634
1642
  reply=(${${${(M)${(f)"$(__tt_cli list --json 2>/dev/null)"}:#*\"name\": *}#*\"name\": \"}%%\"*})
1635
- compadd -- --market ${reply:|TTHEME_ORDER}
1643
+ compadd -- --marketplace ${reply:|TTHEME_ORDER}
1636
1644
  fi
1637
1645
  }
1638
1646
  compdef __tt_complete ttheme