@kecan0406/ttheme 1.0.41 → 1.0.43

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.
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.0.41",
2
+ "version": "1.0.43",
3
3
  "gate": [
4
4
  {
5
5
  "rule": "foreground",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kecan0406/ttheme",
3
- "version": "1.0.41",
3
+ "version": "1.0.43",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "ttheme": "bin/ttheme.js"
@@ -38,6 +38,7 @@
38
38
  "@types/pngjs": "6.0.5",
39
39
  "jpeg-js": "^0.4.4",
40
40
  "pngjs": "7.0.0",
41
+ "smol-toml": "^1.9.0",
41
42
  "typescript": "^5.8.2"
42
43
  },
43
44
  "engines": {
@@ -6,6 +6,7 @@ __tt_ghostty_shown() {
6
6
  [[ -r $f ]] || return 1
7
7
  REPLY=${${"$(<$f)"}##*\?}
8
8
  REPLY=${REPLY%.conf}
9
+ REPLY=${REPLY/--//}
9
10
  }
10
11
 
11
12
  __tt_put() {
@@ -91,12 +92,12 @@ __tt_bg_path() {
91
92
  }
92
93
 
93
94
  __tt_bg_load() {
94
- local name=$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
95
96
  local -i at=5
96
97
  local -a fills lines
97
98
  (( ${+bgsrc[$name]} )) && return 0
98
- bgfrom[$name]="" bgtunef[$name]=$name.tune.conf bgofff[$name]=$name.off.conf bgimages[$name]=1
99
- [[ -r $dir/$name.conf ]] && lines=("${(@f)$(<$dir/$name.conf)}")
99
+ bgfrom[$name]="" bgtunef[$name]=$file.tune.conf bgofff[$name]=$file.off.conf bgimages[$name]=1
100
+ [[ -r $dir/$file.conf ]] && lines=("${(@f)$(<$dir/$file.conf)}")
100
101
  for line in $lines; do
101
102
  case $line in
102
103
  'config-file = ?'*.tune.conf) bgtunef[$name]=${line#config-file = \?} ;;
@@ -104,7 +105,7 @@ __tt_bg_load() {
104
105
  '# image '*/<->) bgimages[$name]=${line##*/} ;;
105
106
  esac
106
107
  done
107
- for f in $dir/$name.conf $dir/${bgtunef[$name]}; do
108
+ for f in $dir/$file.conf $dir/${bgtunef[$name]}; do
108
109
  if [[ -r $f ]]; then
109
110
  for line in "${(@f)$(<$f)}"; do
110
111
  case $line in
@@ -188,10 +189,11 @@ __tt_bg_bake() {
188
189
  }
189
190
 
190
191
  __tt_bg_include() {
191
- local conf=${TTHEME_CONFIG:h}/backgrounds/$1.conf line
192
+ local file=${1/\//--}
193
+ local conf=${TTHEME_CONFIG:h}/backgrounds/$file.conf line
192
194
  local -a lines=() add=()
193
195
  [[ -r $conf ]] && lines=("${(@f)$(<$conf)}")
194
- for line in "config-file = ?${bgtunef[$1]:-$1.tune.conf}" "config-file = ?${bgofff[$1]:-$1.off.conf}"; do
196
+ for line in "config-file = ?${bgtunef[$1]:-$file.tune.conf}" "config-file = ?${bgofff[$1]:-$file.off.conf}"; do
195
197
  (( ${lines[(Ie)$line]} )) || add+=("$line")
196
198
  done
197
199
  (( ${#add} )) || return 0
@@ -203,7 +205,7 @@ __tt_bg_write() {
203
205
  local pos=${TTHEME_BG_POSITIONS[${bgpos[$1]}]}
204
206
  local -i W=$(( (pw + 2 * bgmx) * bgcw )) H=$(( (ph + 2 * bgmy) * bgch ))
205
207
  local -a wh fr
206
- [[ -r $dir/$name.conf ]] || return 0
208
+ [[ -r $dir/${name/\//--}.conf ]] || return 0
207
209
  __tt_bg_include $name || return 1
208
210
  if [[ "$size ${bgpos[$1]} ${bgop[$1]}" == "${bgdef[$1]}" ]]; then
209
211
  rm -f -- $dir/${bgtunef[$1]}
@@ -447,7 +449,7 @@ __tt_pv_bg_image() {
447
449
  __tt_bg_load $name
448
450
  bgload[$name]="" bgedit[$name]=1
449
451
  msg=${err:-"background · $name"} msgt=$(( rc ? 300 : 200 ))
450
- [[ -r ${TTHEME_CONFIG:h}/backgrounds/$name.conf ]] || return 0
452
+ [[ -r ${TTHEME_CONFIG:h}/backgrounds/${name/\//--}.conf ]] || return 0
451
453
  tune=$name tf=1 tsnap="${bgsize[$name]} ${bgpos[$name]} ${bgop[$name]} ${bgoff[$name]}"
452
454
  }
453
455
 
@@ -525,7 +527,7 @@ __tt_pv_bg_save() {
525
527
  continue
526
528
  fi
527
529
  saved+=($name)
528
- if [[ ! -r ${TTHEME_CONFIG:h}/backgrounds/$name.conf ]]; then
530
+ if [[ ! -r ${TTHEME_CONFIG:h}/backgrounds/${name/\//--}.conf ]]; then
529
531
  msg="background · $name none"
530
532
  elif (( bgoff[$name] )); then
531
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
@@ -472,7 +472,7 @@ __tt_cli() {
472
472
  __tt_catalog() {
473
473
  local was
474
474
  __tt_cli "$@" || return
475
- [[ $1 == list ]] && return 0
475
+ [[ $1 == (list|share|submit) ]] && return 0
476
476
  [[ -r $TTHEME_HOME/palettes.zsh ]] || return 0
477
477
  was="$TTHEME_STARTUP ${TTHEME_PALETTE[$TTHEME_STARTUP]}"
478
478
  __tt_palettes_load && __tt_reloaded
@@ -1635,7 +1635,7 @@ ttheme() {
1635
1635
  print -u2 "ttheme: unknown command '$1' — see \`ttheme help\`"
1636
1636
  return 1
1637
1637
  fi
1638
- if [[ $TTHEME_ADAPTER == warp && $1 != (browse|list|add|remove|update|config|default|on|off) ]]; then
1638
+ if [[ $TTHEME_ADAPTER == warp && $1 != (browse|list|add|remove|update|new|edit|check|share|submit|config|default|on|off) ]]; then
1639
1639
  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
1640
  return 1
1641
1641
  fi
@@ -1646,7 +1646,7 @@ ttheme() {
1646
1646
  fi
1647
1647
 
1648
1648
  case $1 in
1649
- browse|list|add|remove|update) __tt_catalog "$@"; return ;;
1649
+ browse|list|add|remove|update|new|edit|check|share|submit) __tt_catalog "$@"; return ;;
1650
1650
  on|off) __tt_switch "$@"; return ;;
1651
1651
  esac
1652
1652
  __tt_arity "$@" || return
@@ -1677,8 +1677,12 @@ if (( $+functions[compdef] )); then
1677
1677
  local -a reply
1678
1678
  if (( CURRENT == 2 )); then
1679
1679
  compadd -- ${TTHEME_VERBS:#-} help
1680
- elif [[ $words[2] == remove || ( $words[2] == (use|default) && CURRENT == 3 ) ]]; then
1680
+ elif [[ $words[2] == remove || ( $words[2] == (use|default|edit|check|share|submit) && CURRENT == 3 ) ]]; then
1681
1681
  compadd -- $TTHEME_ORDER
1682
+ elif [[ $words[2] == new && $words[CURRENT-1] == --from ]]; then
1683
+ compadd -- $TTHEME_ORDER
1684
+ elif [[ $words[2] == new ]]; then
1685
+ compadd -- --from
1682
1686
  elif [[ $words[2] == add ]]; then
1683
1687
  reply=(${${${(M)${(f)"$(__tt_cli list --json 2>/dev/null)"}:#*\"name\": *}#*\"name\": \"}%%\"*})
1684
1688
  compadd -- ${reply:|TTHEME_ORDER}