@kecan0406/ttheme 1.2.0 → 1.2.2

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/shell/ttheme.zsh CHANGED
@@ -30,7 +30,7 @@ __tt_gone() {
30
30
  __tt_reload
31
31
  __tt_reset_reloaded $bg
32
32
  print -n $'\e[?1004l'
33
- for hook in precmd:__tt_fresh precmd:__tt_precmd precmd:__tt_unmux preexec:__tt_preexec preexec:__tt_mux chpwd:__tt_chpwd; do
33
+ for hook in precmd:__tt_fresh precmd:__tt_precmd precmd:__tt_prompted precmd:__tt_unmux preexec:__tt_preexec preexec:__tt_mux chpwd:__tt_chpwd; do
34
34
  add-zsh-hook -d ${hook%%:*} ${hook#*:}
35
35
  done
36
36
  (( $+functions[add-zle-hook-widget] )) && add-zle-hook-widget -d line-init __tt_line_init
@@ -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
  () {
@@ -1673,11 +1675,16 @@ __tt_pv_foot() {
1673
1675
  badge='IMAGE EDIT' kk=(↑↓ ←→ '=' +) kl=(field step reset "reset all")
1674
1676
  if (( tf == 2 )); then
1675
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")
1676
1680
  else
1677
1681
  kk+=(⇧←→) kl+=(×10)
1678
1682
  fi
1679
- kk+=(space enter)
1680
- if (( bgoff[$tpick] )); then kl+=(show keep); else kl+=(hide keep); fi
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
1681
1688
  __tt_pv_bg_images $tune
1682
1689
  (( REPLY > 1 )) && { kk+=(', .' D); kl+=("image ×$REPLY" remove) }
1683
1690
  __tt_pv_bg_findable $tune && { kk+=(f); kl+=(find) }
@@ -1773,8 +1780,8 @@ __tt_pv_help() {
1773
1780
  "enter · esc restores $back"
1774
1781
  )
1775
1782
  if (( bgcw )); then
1776
- hk+=("Tune bg" "" "" "" "" "")
1777
- 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")
1778
1785
  fi
1779
1786
  hk+=(Config "")
1780
1787
  hv+=("alt-c · ↑↓ setting ←→ value" "enter saves · esc undoes")
@@ -1890,9 +1897,14 @@ __tt_pv_tune() {
1890
1897
  local name
1891
1898
  case $key in
1892
1899
  $'\x03') return 1 ;;
1893
- up) tf=$(( tf > 1 ? tf - 1 : 3 )) ;;
1894
- down) tf=$(( tf < 3 ? tf + 1 : 1 )) ;;
1900
+ up) tf=$(( tf > 1 ? tf - 1 : 4 )) ;;
1901
+ down) tf=$(( tf < 4 ? tf + 1 : 1 )) ;;
1902
+ c) (( bgoff[$tpick] )) || __tt_pv_bg_recolor ;;
1895
1903
  left|right|sleft|sright)
1904
+ if (( tf == 4 )); then
1905
+ (( bgoff[$tpick] )) || __tt_pv_bg_recolor
1906
+ return 0
1907
+ fi
1896
1908
  [[ $key == *left ]] && n=-1
1897
1909
  [[ $key == s* ]] && (( tf != 2 )) && n=$(( n * 10 ))
1898
1910
  __tt_pv_bg_adjust ${fields[tf]} $n
@@ -1902,7 +1914,7 @@ __tt_pv_tune() {
1902
1914
  __tt_pv_bg_adjust at $key
1903
1915
  ;;
1904
1916
  ' ') __tt_pv_bg_adjust on ;;
1905
- '=') __tt_pv_bg_adjust def $tf ;;
1917
+ '=') (( tf == 4 )) || __tt_pv_bg_adjust def $tf ;;
1906
1918
  '+') __tt_pv_bg_adjust def ;;
1907
1919
  ',') __tt_pv_bg_pick -1 ;;
1908
1920
  '.') __tt_pv_bg_pick 1 ;;
@@ -2312,11 +2324,11 @@ __tt_pv_draw() {
2312
2324
  src=" · $k/${#held}"
2313
2325
  fi
2314
2326
  __tt_pv_bg_title $(( lw - ${#tune} - 6 )) "$src"
2315
- __tt_pv_head $(( ph - 9 )) 1 $lw $tune "$REPLY" $state
2316
- __tt_pv_bg_panel $tpick $(( ph - 8 )) 1 $lw
2327
+ __tt_pv_head $(( ph - 10 )) 1 $lw $tune "$REPLY" $state
2328
+ __tt_pv_bg_panel $tpick $(( ph - 9 )) 1 $lw
2317
2329
  elif (( conf )); then
2318
- __tt_pv_head $(( ph - 7 )) 1 $lw Config
2319
- __tt_pv_conf_panel $(( ph - 6 )) 1 $lw
2330
+ __tt_pv_head $(( ph - 8 )) 1 $lw Config
2331
+ __tt_pv_conf_panel $(( ph - 7 )) 1 $lw
2320
2332
  fi
2321
2333
  (( help )) && __tt_pv_help
2322
2334
  fi
@@ -2611,11 +2623,11 @@ __tt_preview() {
2611
2623
  local -i scene=0
2612
2624
  local -a bgorder=()
2613
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=()
2614
- local -A bgpic=() bgpics=() bgact=() bgview=() bgswap=() bgthumb=() tsnaps=() pvseek=()
2626
+ local -A bgpic=() bgpics=() bgact=() bgview=() bgswap=() bgthumb=() tsnaps=() pvseek=() bgcolors=()
2615
2627
  local conf=0 cf=1
2616
2628
  local -a plabel=(" This tab " " Default ") pkeys=() reach=() csnap=()
2617
- local -a cvars=(TTHEME_TAB_PALETTE TTHEME_ANNOUNCE TTHEME_FX TTHEME_SORT TTHEME_BG_BLUR) clabel=("New tabs" Announce "Search fx" Sort Blur)
2618
- 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")
2619
2631
  local -A cnote=(
2620
2632
  TTHEME_TAB_PALETTE:seq "New tabs rotate through palettes" TTHEME_TAB_PALETTE:off "New tabs keep the terminal theme"
2621
2633
  TTHEME_ANNOUNCE:1 "Shows the palette notice" TTHEME_ANNOUNCE:0 "Silences the palette notice"
@@ -2624,6 +2636,8 @@ __tt_preview() {
2624
2636
  TTHEME_BG_BLUR:0 "Pictures stay sharp" TTHEME_BG_BLUR:1 "Pictures soften a little behind the text"
2625
2637
  TTHEME_BG_BLUR:2 "Pictures soften behind the text" TTHEME_BG_BLUR:3 "Pictures blur behind the text"
2626
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"
2627
2641
  )
2628
2642
  [[ $mode == pin ]] && __tt_pin_scopes "$pdir"
2629
2643
  [[ $mode == init ]] && pkdef=2
@@ -2639,7 +2653,7 @@ __tt_preview() {
2639
2653
  local tty=""
2640
2654
  local -i TTHEME_RAW=0
2641
2655
  {
2642
- tty=$(stty -g 2>/dev/null && stty -echo -icanon min 1 time 0 2>/dev/null)
2656
+ tty=$(stty -g 2>/dev/null) && stty -echo -icanon min 1 time 0 2>/dev/null || tty=""
2643
2657
  TTHEME_RAW=$(( ${#tty} > 0 ))
2644
2658
  __tt_pv_bg_open
2645
2659
  printf '\e[?2026h\e[?1049h\e[?7l\e[?25l'
@@ -2827,6 +2841,7 @@ fi
2827
2841
  else
2828
2842
  __tt_sync
2829
2843
  fi
2844
+ __tt_follows_prompt && add-zsh-hook precmd __tt_prompted
2830
2845
  __tt_announce
2831
2846
  }
2832
2847