batipanel 0.4.31 → 0.4.32

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/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.31
1
+ 0.4.32
package/install.sh CHANGED
@@ -153,6 +153,18 @@ if tmux -f /dev/null new-session -d -s _bp_smoke -x 10 -y 5 2>/dev/null; then
153
153
  _tmux_smoke_ok=1
154
154
  fi
155
155
 
156
+ # if smoke test failed, clean stale socket and retry (common on macOS)
157
+ if [ "$_tmux_smoke_ok" = "0" ]; then
158
+ tmux kill-server 2>/dev/null || true
159
+ rm -rf "/tmp/tmux-$(id -u)/" "/private/tmp/tmux-$(id -u)/" 2>/dev/null || true
160
+ sleep 0.3
161
+ if tmux -f /dev/null new-session -d -s _bp_smoke -x 10 -y 5 2>/dev/null; then
162
+ tmux kill-session -t _bp_smoke 2>/dev/null || true
163
+ _tmux_smoke_ok=1
164
+ echo " Cleared stale tmux socket — tmux is working now."
165
+ fi
166
+ fi
167
+
156
168
  if [ "$_tmux_smoke_ok" = "0" ]; then
157
169
  echo ""
158
170
  echo "WARNING: tmux is installed but fails to start (server exited unexpectedly)."
@@ -162,9 +174,9 @@ if [ "$_tmux_smoke_ok" = "0" ]; then
162
174
  rm -f "$BATIPANEL_HOME/bin/tmux"
163
175
  fi
164
176
  if [ "$OS" = "Darwin" ]; then
165
- echo " Please install tmux via Homebrew: brew install tmux"
177
+ echo " Try: brew reinstall tmux"
166
178
  else
167
- echo " Please install tmux via package manager: sudo apt install tmux"
179
+ echo " Try: sudo apt install --reinstall tmux"
168
180
  fi
169
181
  # re-check after removing mamba wrapper
170
182
  if command -v tmux &>/dev/null && tmux -f /dev/null new-session -d -s _bp_smoke2 -x 10 -y 5 2>/dev/null; then
@@ -512,6 +524,8 @@ fi
512
524
 
513
525
  # kill stale tmux server so new config takes effect
514
526
  tmux kill-server 2>/dev/null || true
527
+ # clean stale socket (dead server leaves socket behind, blocks new sessions)
528
+ rm -rf "/tmp/tmux-$(id -u)/" "/private/tmp/tmux-$(id -u)/" 2>/dev/null || true
515
529
 
516
530
  # clean ~/.tmux.conf (remove ALL old batipanel lines, then add fresh)
517
531
  BATIPANEL_SOURCE_LINE="source-file $BATIPANEL_HOME/config/tmux.conf"
@@ -555,7 +569,7 @@ esac
555
569
 
556
570
  BATIPANEL_ALIAS="alias batipanel='bash \"$BATIPANEL_HOME/bin/start.sh\"'"
557
571
  # b is a function (not alias) so theme changes can auto-reload the prompt
558
- SHORT_FUNC="b() { bash \"$BATIPANEL_HOME/bin/start.sh\" \"\$@\"; if [[ \"\${1:-}\" == \"theme\" || (\"\${1:-}\" == \"config\" && \"\${2:-}\" == \"theme\") ]]; then if [ -n \"\${ZSH_VERSION:-}\" ]; then local _pf=\"$BATIPANEL_HOME/config/zsh-prompt.zsh\"; [ -f \"\$_pf\" ] && source \"\$_pf\"; else local _pf=\"$BATIPANEL_HOME/config/bash-prompt.sh\"; [ -f \"\$_pf\" ] && source \"\$_pf\"; fi; fi; }"
572
+ SHORT_FUNC="b() { bash \"$BATIPANEL_HOME/bin/start.sh\" \"\$@\"; if [[ \"\${1:-}\" == \"theme\" && -n \"\${2:-}\" ]] || [[ \"\${1:-}\" == \"config\" && \"\${2:-}\" == \"theme\" && -n \"\${3:-}\" ]]; then if [ -n \"\${ZSH_VERSION:-}\" ]; then local _pf=\"$BATIPANEL_HOME/config/zsh-prompt.zsh\"; [ -f \"\$_pf\" ] && source \"\$_pf\"; else local _pf=\"$BATIPANEL_HOME/config/bash-prompt.sh\"; [ -f \"\$_pf\" ] && source \"\$_pf\"; fi; fi; }"
559
573
 
560
574
  # Always register 'batipanel' alias
561
575
  if grep -q "alias batipanel=" "$SHELL_RC" 2>/dev/null; then
@@ -614,9 +628,13 @@ if [ "$NEED_LOCAL_BIN_PATH" = "1" ]; then
614
628
  fi
615
629
 
616
630
  # === 8b. enable powerline glyphs by default ===
631
+ # only auto-enable on terminals known to support Nerd Fonts well
632
+ # Apple Terminal: defer to batipanel profile setup (sets BATIPANEL_ICONS=1 after font confirmed)
617
633
  if ! grep -qF 'BATIPANEL_ICONS' "$SHELL_RC" 2>/dev/null; then
618
- echo 'export BATIPANEL_ICONS="1"' >> "$SHELL_RC"
619
- echo " Enabled powerline glyphs (BATIPANEL_ICONS=1)"
634
+ if [ "${TERM_PROGRAM:-}" != "Apple_Terminal" ]; then
635
+ echo 'export BATIPANEL_ICONS="1"' >> "$SHELL_RC"
636
+ echo " Enabled powerline glyphs (BATIPANEL_ICONS=1)"
637
+ fi
620
638
  fi
621
639
 
622
640
  # === 9. register tab completion ===
@@ -648,7 +666,37 @@ else
648
666
  fi
649
667
  fi
650
668
 
651
- # === 9b. install Nerd Font + configure terminal (macOS) ===
669
+ # === 9b. install Nerd Font + configure terminal ===
670
+ _install_nerd_font_linux() {
671
+ local font_dir="$HOME/.local/share/fonts"
672
+ # skip if already installed
673
+ if ls "$font_dir"/MesloLGS* &>/dev/null 2>&1; then
674
+ return 0
675
+ fi
676
+ echo " Installing Nerd Font (MesloLGS NF) for powerline glyphs..."
677
+ mkdir -p "$font_dir"
678
+ local base_url="https://github.com/romkatv/powerlevel10k-media/raw/master"
679
+ local fonts=(
680
+ "MesloLGS NF Regular.ttf"
681
+ "MesloLGS NF Bold.ttf"
682
+ "MesloLGS NF Italic.ttf"
683
+ "MesloLGS NF Bold Italic.ttf"
684
+ )
685
+ for f in "${fonts[@]}"; do
686
+ local encoded="${f// /%20}"
687
+ curl -fsSL "$base_url/$encoded" -o "$font_dir/$f" 2>/dev/null || true
688
+ done
689
+ # rebuild font cache
690
+ if command -v fc-cache &>/dev/null; then
691
+ fc-cache -f "$font_dir" 2>/dev/null || true
692
+ fi
693
+ echo " Nerd Font installed to $font_dir"
694
+ }
695
+
696
+ if [ "$OS" = "Linux" ]; then
697
+ _install_nerd_font_linux
698
+ fi
699
+
652
700
  if [ "$OS" = "Darwin" ]; then
653
701
  echo ""
654
702
 
@@ -660,55 +708,124 @@ if [ "$OS" = "Darwin" ]; then
660
708
  fi
661
709
  fi
662
710
 
663
- # auto-configure Apple Terminal: font + theme colors via osascript
711
+ # auto-configure Apple Terminal: create/update "batipanel" profile
664
712
  if [ "${TERM_PROGRAM:-}" = "Apple_Terminal" ]; then
665
- # detect current profile name
666
- _term_profile=$(defaults read com.apple.Terminal "Default Window Settings" 2>/dev/null || echo "Basic")
667
-
668
- # set Nerd Font on the profile
669
- echo " Configuring Apple Terminal font (MesloLGS NF)..."
670
- osascript -e "tell application \"Terminal\" to set font name of settings set \"${_term_profile}\" to \"MesloLGS-NF-Regular\"" 2>/dev/null || true
671
- osascript -e "tell application \"Terminal\" to set font size of settings set \"${_term_profile}\" to 13" 2>/dev/null || true
672
-
673
- # apply theme colors to Terminal.app profile
674
- _apply_terminal_app_colors() {
675
- local theme="${1:-default}"
676
- local term_colors
677
- if declare -f _get_theme_terminal_colors &>/dev/null; then
678
- term_colors=$(_get_theme_terminal_colors "$theme")
713
+ _bp_profile="batipanel"
714
+ _current_profile=$(defaults read com.apple.Terminal "Default Window Settings" 2>/dev/null || echo "Basic")
715
+
716
+ # hex to AppleScript RGB helper
717
+ _hex_to_applescript_rgb() {
718
+ local hex="${1#\#}"
719
+ local r=$((16#${hex:0:2}))
720
+ local g=$((16#${hex:2:2}))
721
+ local b=$((16#${hex:4:2}))
722
+ echo "$((r * 257)), $((g * 257)), $((b * 257))"
723
+ }
724
+
725
+ # get theme colors
726
+ _bp_theme="${BATIPANEL_THEME:-default}"
727
+ _bp_term_colors=""
728
+ if declare -f _get_theme_terminal_colors &>/dev/null; then
729
+ _bp_term_colors=$(_get_theme_terminal_colors "$_bp_theme")
730
+ else
731
+ _bp_term_colors="#1e1e2e #cdd6f4 #f5e0dc blue cyan green magenta"
732
+ fi
733
+ read -r _bp_bg _bp_fg _bp_cursor _ <<< "$_bp_term_colors"
734
+
735
+ # create or update the batipanel profile
736
+ _setup_bp_profile() {
737
+ echo " Setting up Apple Terminal profile: ${_bp_profile}..."
738
+
739
+ # create profile by duplicating current one (inherits encoding, shell settings)
740
+ osascript <<APPLESCRIPT 2>/dev/null || true
741
+ tell application "Terminal"
742
+ -- duplicate current profile as base if batipanel doesn't exist yet
743
+ if not (exists settings set "${_bp_profile}") then
744
+ set baseProfile to settings set "${_current_profile}"
745
+ set newProfile to make new settings set with properties {name:"${_bp_profile}"}
746
+ end if
747
+ end tell
748
+ APPLESCRIPT
749
+
750
+ # set Nerd Font (try v3, v2, mono variants)
751
+ local _nf_applied=false
752
+ for _nf_name in "MesloLGSNF-Regular" "MesloLGSNerdFont-Regular" "MesloLGS-NF-Regular"; do
753
+ if osascript -e "tell application \"Terminal\" to set font name of settings set \"${_bp_profile}\" to \"${_nf_name}\"" 2>/dev/null; then
754
+ _nf_applied=true
755
+ break
756
+ fi
757
+ done
758
+ if [ "$_nf_applied" = true ]; then
759
+ # font confirmed — enable powerline glyphs
760
+ if ! grep -qF 'BATIPANEL_ICONS' "$SHELL_RC" 2>/dev/null; then
761
+ echo 'export BATIPANEL_ICONS="1"' >> "$SHELL_RC"
762
+ fi
679
763
  else
680
- term_colors="#1e1e2e #cdd6f4 #f5e0dc blue cyan green magenta"
764
+ echo " Warning: Could not set Nerd Font. Powerline glyphs may not render."
765
+ echo " Install manually: brew install --cask font-meslo-lg-nerd-font"
681
766
  fi
682
- local bg fg cursor
683
- read -r bg fg cursor _ <<< "$term_colors"
684
-
685
- # convert hex #RRGGBB to AppleScript RGB {R*257, G*257, B*257}
686
- _hex_to_applescript_rgb() {
687
- local hex="${1#\#}"
688
- local r=$((16#${hex:0:2}))
689
- local g=$((16#${hex:2:2}))
690
- local b=$((16#${hex:4:2}))
691
- echo "$((r * 257)), $((g * 257)), $((b * 257))"
692
- }
693
-
694
- if [[ "$bg" =~ ^# ]]; then
767
+ osascript -e "tell application \"Terminal\" to set font size of settings set \"${_bp_profile}\" to 13" 2>/dev/null || true
768
+
769
+ # apply theme colors to the batipanel profile
770
+ if [[ "$_bp_bg" =~ ^# ]]; then
695
771
  local bg_rgb fg_rgb cursor_rgb
696
- bg_rgb=$(_hex_to_applescript_rgb "$bg")
697
- fg_rgb=$(_hex_to_applescript_rgb "$fg")
698
- cursor_rgb=$(_hex_to_applescript_rgb "$cursor")
699
- local profile="$_term_profile"
772
+ bg_rgb=$(_hex_to_applescript_rgb "$_bp_bg")
773
+ fg_rgb=$(_hex_to_applescript_rgb "$_bp_fg")
774
+ cursor_rgb=$(_hex_to_applescript_rgb "$_bp_cursor")
700
775
  osascript <<APPLESCRIPT 2>/dev/null || true
701
776
  tell application "Terminal"
702
- set background color of settings set "$profile" to {${bg_rgb}}
703
- set normal text color of settings set "$profile" to {${fg_rgb}}
704
- set cursor color of settings set "$profile" to {${cursor_rgb}}
777
+ set background color of settings set "${_bp_profile}" to {${bg_rgb}}
778
+ set normal text color of settings set "${_bp_profile}" to {${fg_rgb}}
779
+ set cursor color of settings set "${_bp_profile}" to {${cursor_rgb}}
705
780
  end tell
706
781
  APPLESCRIPT
707
782
  fi
783
+
784
+ # set as default profile for new windows
785
+ osascript <<APPLESCRIPT 2>/dev/null || true
786
+ tell application "Terminal"
787
+ set default settings to settings set "${_bp_profile}"
788
+ set startup settings to settings set "${_bp_profile}"
789
+ end tell
790
+ APPLESCRIPT
791
+
792
+ # apply to current window
793
+ osascript <<APPLESCRIPT 2>/dev/null || true
794
+ tell application "Terminal"
795
+ set w to front window
796
+ set current settings of w to settings set "${_bp_profile}"
797
+ end tell
798
+ APPLESCRIPT
799
+ echo " Profile '${_bp_profile}' configured and set as default"
708
800
  }
709
801
 
710
- _apply_terminal_app_colors "${BATIPANEL_THEME:-default}"
711
- echo " Applied theme colors to Apple Terminal profile (${_term_profile})"
802
+ if [ "$_current_profile" = "$_bp_profile" ]; then
803
+ # already using batipanel profile update it silently
804
+ _setup_bp_profile
805
+ else
806
+ # first install or different profile — ask user
807
+ echo ""
808
+ echo " Apple Terminal detected (current profile: ${_current_profile})"
809
+ echo " batipanel can create a dedicated '${_bp_profile}' profile with:"
810
+ echo " - Nerd Font (MesloLGS) for powerline glyphs"
811
+ echo " - Dark theme colors"
812
+ echo ""
813
+ printf " Apply batipanel Terminal profile? [Y/n] "
814
+ _bp_answer=""
815
+ if [ -t 0 ]; then
816
+ read -r _bp_answer
817
+ else
818
+ read -r _bp_answer < /dev/tty 2>/dev/null || _bp_answer="y"
819
+ fi
820
+ case "$_bp_answer" in
821
+ [nN]*)
822
+ echo " Skipped. You can set your font to a Nerd Font manually."
823
+ ;;
824
+ *)
825
+ _setup_bp_profile
826
+ ;;
827
+ esac
828
+ fi
712
829
  fi
713
830
  fi
714
831
 
@@ -781,7 +898,7 @@ echo " b config layout 7panel # Change default layout"
781
898
  echo " b theme # List/change color themes"
782
899
  echo ""
783
900
  if [ "${TERM_PROGRAM:-}" = "Apple_Terminal" ]; then
784
- echo "Apple Terminal: font and theme colors have been configured automatically."
901
+ echo "Apple Terminal: using 'batipanel' profile with Nerd Font + theme colors."
785
902
  echo ""
786
903
  echo "Type: b"
787
904
  echo ""
@@ -802,10 +919,14 @@ else
802
919
  echo "Type: b"
803
920
  fi
804
921
 
805
- # === reload shell so prompt theme applies immediately ===
806
- # only exec when running interactively (not from npm postinstall or scripts)
807
- if [ -t 0 ] && [ -t 1 ] && [ -z "${npm_lifecycle_event:-}" ]; then
922
+ # === activate prompt theme ===
923
+ # don't exec $SHELL it breaks /dev/tty when run from curl|bash or subshells
924
+ if [ -z "${npm_lifecycle_event:-}" ]; then
925
+ echo ""
926
+ echo -e "\033[1;33m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\033[0m"
927
+ echo -e "\033[1;33m Activate batipanel (choose one):\033[0m"
808
928
  echo ""
809
- echo "Reloading shell to apply prompt theme..."
810
- exec "$SHELL" -l
929
+ echo -e " \033[1;32m▶ exec \$SHELL -l\033[0m ← paste this"
930
+ echo -e " \033[1;32m▶ restart terminal\033[0m ← or just close & reopen"
931
+ echo -e "\033[1;33m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\033[0m"
811
932
  fi
package/lib/layout.sh CHANGED
@@ -21,30 +21,55 @@ init_layout() {
21
21
  local tmux_err
22
22
  tmux_err=$(tmux new-session -d -s "$session" -c "$project" -x 220 -y 60 2>&1) || {
23
23
  debug_log "init_layout: first attempt failed: $tmux_err"
24
- # retry with safe TERM
25
- debug_log "init_layout: retrying with TERM=xterm-256color"
26
- tmux_err=$(TERM=xterm-256color tmux new-session -d -s "$session" -c "$project" -x 220 -y 60 2>&1) || {
27
- debug_log "init_layout: second attempt failed: $tmux_err"
28
- # check if session was created by a concurrent invocation
29
- if tmux has-session -t "$session" 2>/dev/null; then
30
- debug_log "init_layout: session already exists (concurrent creation)"
31
- return 0
32
- fi
33
- echo -e "${RED}Failed to create tmux session '$session'${NC}"
34
- # provide specific guidance based on error
35
- if [[ "$tmux_err" == *"open terminal failed"* ]]; then
36
- echo " Error: open terminal failed (terminfo issue)"
37
- echo " Try: export TERM=xterm-256color && b $session"
38
- elif [[ "$tmux_err" == *"server"* ]] || [[ "$tmux_err" == *"socket"* ]]; then
39
- echo " Stale tmux server? Try: tmux kill-server"
40
- elif [[ "$tmux_err" == *"library"* ]] || [[ "$tmux_err" == *"dylib"* ]]; then
41
- echo " Library issue try reinstalling tmux"
42
- else
43
- echo " tmux error: $tmux_err"
44
- fi
45
- return 1
46
- }
24
+
25
+ # if "server exited unexpectedly", clean stale socket and retry
26
+ if [[ "$tmux_err" == *"server exited"* ]] || [[ "$tmux_err" == *"server"* ]]; then
27
+ debug_log "init_layout: cleaning stale socket and retrying"
28
+ tmux kill-server 2>/dev/null || true
29
+ rm -rf "/tmp/tmux-$(id -u)/" "/private/tmp/tmux-$(id -u)/" 2>/dev/null || true
30
+ sleep 0.3
31
+ tmux_err=$(tmux new-session -d -s "$session" -c "$project" -x 220 -y 60 2>&1) && {
32
+ debug_log "init_layout: succeeded after socket cleanup"
33
+ # fall through to success path below
34
+ tmux_err=""
35
+ }
36
+ fi
37
+
38
+ # if still failing, retry with safe TERM
39
+ if [ -n "$tmux_err" ]; then
40
+ debug_log "init_layout: retrying with TERM=xterm-256color"
41
+ tmux_err=$(TERM=xterm-256color tmux new-session -d -s "$session" -c "$project" -x 220 -y 60 2>&1) || {
42
+ debug_log "init_layout: all attempts failed: $tmux_err"
43
+ # check if session was created by a concurrent invocation
44
+ if tmux has-session -t "$session" 2>/dev/null; then
45
+ debug_log "init_layout: session already exists (concurrent creation)"
46
+ return 0
47
+ fi
48
+ echo -e "${RED}Failed to create tmux session '$session'${NC}"
49
+ # provide specific guidance based on error
50
+ if [[ "$tmux_err" == *"open terminal failed"* ]]; then
51
+ echo " Error: open terminal failed (terminfo issue)"
52
+ echo " Try: export TERM=xterm-256color && b $session"
53
+ elif [[ "$tmux_err" == *"server"* ]] || [[ "$tmux_err" == *"socket"* ]]; then
54
+ echo " Stale tmux socket. Tried auto-cleanup but still failing."
55
+ echo " Try: rm -rf /tmp/tmux-\$(id -u)/ && b $session"
56
+ elif [[ "$tmux_err" == *"library"* ]] || [[ "$tmux_err" == *"dylib"* ]]; then
57
+ echo " Library issue — try reinstalling tmux"
58
+ else
59
+ echo " tmux error: $tmux_err"
60
+ fi
61
+ return 1
62
+ }
63
+ fi
47
64
  }
65
+
66
+ # pass parent terminal info into tmux so prompts can detect Apple Terminal etc.
67
+ if [ -n "${TERM_PROGRAM:-}" ]; then
68
+ tmux set-environment -t "$session" TERM_PROGRAM "$TERM_PROGRAM"
69
+ fi
70
+ if [ -n "${TERM_PROGRAM_VERSION:-}" ]; then
71
+ tmux set-environment -t "$session" TERM_PROGRAM_VERSION "$TERM_PROGRAM_VERSION"
72
+ fi
48
73
  }
49
74
 
50
75
  # Wait for shell init after pane splits
package/lib/session.sh CHANGED
@@ -79,8 +79,9 @@ tmux_start() {
79
79
  fi
80
80
 
81
81
  echo -e " ${YELLOW}Tip:${NC} Detach with Ctrl+b d | Stop with: b stop $SESSION"
82
- # attach to session (exec replaces this process)
83
- if [ "${BATIPANEL_ITERM_CC:-0}" = "1" ]; then
82
+ # attach to session (exec hands terminal directly to tmux)
83
+ # -CC mode only works in iTerm2 — ignore setting in other terminals
84
+ if [ "${BATIPANEL_ITERM_CC:-0}" = "1" ] && [ "${TERM_PROGRAM:-}" = "iTerm.app" ]; then
84
85
  exec tmux -CC attach -t "$SESSION"
85
86
  else
86
87
  exec tmux attach -t "$SESSION"
@@ -86,7 +86,10 @@ _bp_sep='>'
86
86
  case "${TERM_PROGRAM:-}" in
87
87
  iTerm.app|WezTerm|kitty|Hyper|Alacritty|vscode) _bp_sep=$'\uE0B0' ;;
88
88
  esac
89
- [[ -n "${TMUX:-}" ]] && _bp_sep=$'\uE0B0'
89
+ # in tmux, only enable powerline if NOT Apple Terminal (glyphs may not render)
90
+ if [[ -n "${TMUX:-}" ]] && [[ "${TERM_PROGRAM:-}" != "Apple_Terminal" ]]; then
91
+ _bp_sep=$'\uE0B0'
92
+ fi
90
93
  [[ "${BATIPANEL_ICONS:-0}" == "1" ]] && _bp_sep=$'\uE0B0'
91
94
 
92
95
  PROMPT="%F{${BP_C_USER:-blue}}%n%f %F{${BP_C_DIR:-cyan}}%~%f\${vcs_info_msg_0_} %F{${BP_C_PROMPT:-magenta}}${_bp_sep}%f "
@@ -151,7 +154,8 @@ __batipanel_prompt() {
151
154
  case "${TERM_PROGRAM:-}" in
152
155
  iTerm.app|WezTerm|kitty|Hyper|Alacritty|vscode) _use_pl=1 ;;
153
156
  esac
154
- [[ -n "${TMUX:-}" ]] && _use_pl=1
157
+ # in tmux, only enable powerline if NOT Apple Terminal
158
+ [[ -n "${TMUX:-}" ]] && [[ "${TERM_PROGRAM:-}" != "Apple_Terminal" ]] && _use_pl=1
155
159
  [[ "${BATIPANEL_ICONS:-0}" == "1" ]] && _use_pl=1
156
160
  if (( _use_pl )); then
157
161
  sep=$'\uE0B0'
@@ -143,7 +143,8 @@ __batipanel_prompt() {
143
143
  case "\${TERM_PROGRAM:-}" in
144
144
  iTerm.app|WezTerm|kitty|Hyper|Alacritty|vscode) _use_pl=1 ;;
145
145
  esac
146
- [[ -n "\${TMUX:-}" ]] && _use_pl=1
146
+ # in tmux, only enable powerline if NOT Apple Terminal
147
+ [[ -n "\${TMUX:-}" ]] && [[ "\${TERM_PROGRAM:-}" != "Apple_Terminal" ]] && _use_pl=1
147
148
  [[ "\${BATIPANEL_ICONS:-0}" == "1" ]] && _use_pl=1
148
149
  if (( _use_pl )); then
149
150
  sep=\$'\\uE0B0'
package/lib/themes.sh CHANGED
@@ -17,18 +17,25 @@ _apply_apple_terminal_colors() {
17
17
  echo "$((r * 257)), $((g * 257)), $((b * 257))"
18
18
  }
19
19
 
20
- local profile
21
- profile=$(defaults read com.apple.Terminal "Default Window Settings" 2>/dev/null || echo "Basic")
22
20
  local bg_rgb fg_rgb cursor_rgb
23
21
  bg_rgb=$(_hex_to_as_rgb "$bg")
24
22
  fg_rgb=$(_hex_to_as_rgb "$fg")
25
23
  cursor_rgb=$(_hex_to_as_rgb "$cursor")
26
24
 
25
+ # update batipanel profile if it exists (so new windows also get the colors)
26
+ # then apply to current window for immediate feedback
27
27
  osascript <<APPLESCRIPT 2>/dev/null || true
28
28
  tell application "Terminal"
29
- set background color of settings set "$profile" to {${bg_rgb}}
30
- set normal text color of settings set "$profile" to {${fg_rgb}}
31
- set cursor color of settings set "$profile" to {${cursor_rgb}}
29
+ if exists settings set "batipanel" then
30
+ set background color of settings set "batipanel" to {${bg_rgb}}
31
+ set normal text color of settings set "batipanel" to {${fg_rgb}}
32
+ set cursor color of settings set "batipanel" to {${cursor_rgb}}
33
+ end if
34
+ -- also apply to current window immediately
35
+ set w to front window
36
+ set background color of current settings of w to {${bg_rgb}}
37
+ set normal text color of current settings of w to {${fg_rgb}}
38
+ set cursor color of current settings of w to {${cursor_rgb}}
32
39
  end tell
33
40
  APPLESCRIPT
34
41
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "batipanel",
3
- "version": "0.4.31",
3
+ "version": "0.4.32",
4
4
  "description": "AI-powered terminal workspace manager — multi-panel tmux layouts with Claude Code, git, monitoring, and more",
5
5
  "bin": {
6
6
  "batipanel": "./bin/cli.sh"