batipanel 0.4.13 → 0.4.14

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.13
1
+ 0.4.14
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env bash
2
- # batipanel shell-setup - powerline fonts, prompt theme, hostname hiding
2
+ # batipanel shell-setup - prompt theme, terminal colors, powerline fonts
3
3
 
4
4
  BATIPANEL_HOME="${BATIPANEL_HOME:-$HOME/.batipanel}"
5
5
 
@@ -26,57 +26,18 @@ install_powerline_fonts() {
26
26
  OS="$(uname -s)"
27
27
 
28
28
  # check if already installed
29
- if fc-list 2>/dev/null | grep -qi "powerline\|nerd"; then
29
+ if [ "$OS" = "Darwin" ] && [ -d "$HOME/Library/Fonts" ]; then
30
+ if ls "$HOME/Library/Fonts/"*owerline* &>/dev/null 2>&1 \
31
+ || ls "$HOME/Library/Fonts/"*erd* &>/dev/null 2>&1; then
32
+ echo " Powerline-compatible fonts already installed"
33
+ return 0
34
+ fi
35
+ elif fc-list 2>/dev/null | grep -qi "powerline\|nerd"; then
30
36
  echo " Powerline-compatible fonts already installed"
31
37
  return 0
32
38
  fi
33
39
 
34
- case "$OS" in
35
- Darwin)
36
- if has_cmd brew; then
37
- # install Nerd Font (includes powerline glyphs)
38
- brew tap homebrew/cask-fonts 2>/dev/null || true
39
- if brew install --cask font-meslo-lg-nerd-font 2>/dev/null; then
40
- echo " Installed MesloLGS Nerd Font (macOS)"
41
- else
42
- echo " Font install via brew failed, trying powerline-fonts..."
43
- _install_powerline_fonts_git
44
- fi
45
- else
46
- _install_powerline_fonts_git
47
- fi
48
- ;;
49
- Linux)
50
- if has_cmd apt-get; then
51
- if sudo apt-get install -y -qq fonts-powerline 2>/dev/null; then
52
- echo " Installed fonts-powerline (apt)"
53
- else
54
- _install_powerline_fonts_git
55
- fi
56
- elif has_cmd dnf; then
57
- if sudo dnf install -y powerline-fonts 2>/dev/null; then
58
- echo " Installed powerline-fonts (dnf)"
59
- else
60
- _install_powerline_fonts_git
61
- fi
62
- elif has_cmd pacman; then
63
- if sudo pacman -S --noconfirm powerline-fonts 2>/dev/null; then
64
- echo " Installed powerline-fonts (pacman)"
65
- else
66
- _install_powerline_fonts_git
67
- fi
68
- else
69
- _install_powerline_fonts_git
70
- fi
71
- ;;
72
- *)
73
- _install_powerline_fonts_git
74
- ;;
75
- esac
76
- }
77
-
78
- # fallback: clone and install powerline fonts from GitHub
79
- _install_powerline_fonts_git() {
40
+ # clone and install powerline fonts from GitHub (works on all platforms)
80
41
  if ! has_cmd git; then
81
42
  echo " git not found, skipping font install"
82
43
  return 1
@@ -86,62 +47,91 @@ _install_powerline_fonts_git() {
86
47
  tmpdir=$(mktemp -d)
87
48
  if git clone --depth=1 https://github.com/powerline/fonts.git "$tmpdir/fonts" 2>/dev/null; then
88
49
  bash "$tmpdir/fonts/install.sh" 2>/dev/null || true
89
- echo " Installed powerline fonts from GitHub"
50
+ echo " Installed powerline fonts"
90
51
  else
91
- echo " Failed to clone powerline fonts"
52
+ echo " Failed to download powerline fonts (optional)"
92
53
  fi
93
54
  rm -rf "$tmpdir"
94
55
  }
95
56
 
96
- # === 2. Setup zsh with Oh My Zsh + agnoster ===
57
+ # === 2. Generate zsh prompt config file ===
58
+ # Writes a standalone zsh prompt config that works WITHOUT Oh My Zsh
59
+ _generate_zsh_prompt() {
60
+ local prompt_file="$BATIPANEL_HOME/config/zsh-prompt.zsh"
61
+ mkdir -p "$BATIPANEL_HOME/config"
62
+
63
+ cat > "$prompt_file" << 'ZSH_PROMPT_EOF'
64
+ # batipanel zsh prompt - powerline style (no Oh My Zsh needed)
65
+ # This file is sourced from .zshrc
66
+
67
+ # enable colors
68
+ autoload -U colors && colors
69
+
70
+ # enable git info
71
+ autoload -Uz vcs_info
72
+ precmd() { vcs_info }
73
+ zstyle ':vcs_info:git:*' formats ' %F{black}%K{green} \uE0A0 %b %k%F{green}\uE0B0%f'
74
+ zstyle ':vcs_info:*' enable git
75
+
76
+ # enable prompt substitution
77
+ setopt PROMPT_SUBST
78
+
79
+ # dark terminal colors via OSC escape sequences (works immediately)
80
+ if [[ "$TERM" != "dumb" ]]; then
81
+ printf '\e]11;#1e1e2e\a' # background: dark blue-grey
82
+ printf '\e]10;#cdd6f4\a' # foreground: light grey
83
+ printf '\e]12;#f5e0dc\a' # cursor: pink
84
+ fi
85
+
86
+ # powerline-style prompt
87
+ PROMPT='%K{blue}%F{white} %n %f%k%F{blue}%K{240}\uE0B0%f%F{white} %~ %f%k%F{240}${vcs_info_msg_0_:-%F{240}\uE0B0}%f '
88
+ RPROMPT='%(?..%F{red}\u2718 %?%f)'
89
+ ZSH_PROMPT_EOF
90
+ }
91
+
92
+ # === 3. Setup zsh prompt (direct, no Oh My Zsh) ===
97
93
  setup_zsh_theme() {
98
94
  local shell_rc="$1"
99
95
 
100
- echo " Configuring zsh theme..."
101
-
102
- # install Oh My Zsh if not present
103
- if [ ! -d "$HOME/.oh-my-zsh" ]; then
104
- echo " Installing Oh My Zsh..."
105
- if has_cmd curl; then
106
- RUNZSH=no CHSH=no KEEP_ZSHRC=yes \
107
- sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" 2>/dev/null || true
108
- elif has_cmd wget; then
109
- RUNZSH=no CHSH=no KEEP_ZSHRC=yes \
110
- sh -c "$(wget -qO- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" 2>/dev/null || true
111
- else
112
- echo " curl/wget not found, skipping Oh My Zsh"
113
- return 1
114
- fi
115
- fi
96
+ echo " Configuring zsh prompt..."
116
97
 
117
- if [ ! -d "$HOME/.oh-my-zsh" ]; then
118
- echo " Oh My Zsh installation failed"
119
- return 1
120
- fi
98
+ # generate the prompt file
99
+ _generate_zsh_prompt
100
+
101
+ # add source line to .zshrc if not present
102
+ local prompt_file="$BATIPANEL_HOME/config/zsh-prompt.zsh"
103
+ local source_line="[[ -f \"$prompt_file\" ]] && source \"$prompt_file\""
121
104
 
122
- # set agnoster theme
123
105
  if [ -f "$shell_rc" ]; then
124
- if grep -q 'ZSH_THEME=' "$shell_rc" 2>/dev/null; then
125
- _sed_i 's/^ZSH_THEME=.*/ZSH_THEME="agnoster"/' "$shell_rc"
126
- else
127
- echo 'ZSH_THEME="agnoster"' >> "$shell_rc"
106
+ if ! grep -qF "zsh-prompt.zsh" "$shell_rc" 2>/dev/null; then
107
+ {
108
+ echo ""
109
+ echo "# batipanel prompt theme"
110
+ echo "$source_line"
111
+ } >> "$shell_rc"
128
112
  fi
113
+ else
114
+ echo "$source_line" > "$shell_rc"
129
115
  fi
130
116
 
131
- # hide hostname: set DEFAULT_USER to current user
132
- _add_line_if_missing "$shell_rc" "DEFAULT_USER" \
133
- "DEFAULT_USER=\"\$(whoami)\""
134
-
135
- echo " Set agnoster theme with hostname hidden"
117
+ echo " Set powerline-style prompt"
136
118
  }
137
119
 
138
- # fallback prompt generator (when themes.sh is not loaded)
120
+ # === 4. Bash prompt (fallback) ===
139
121
  _setup_default_bash_prompt() {
140
122
  local prompt_file="$BATIPANEL_HOME/config/bash-prompt.sh"
141
123
  mkdir -p "$BATIPANEL_HOME/config"
142
124
  cat > "$prompt_file" << 'FALLBACK_EOF'
143
125
  #!/usr/bin/env bash
144
- # batipanel bash prompt - default theme (fallback)
126
+ # batipanel bash prompt - powerline style
127
+
128
+ # dark terminal colors via OSC
129
+ if [[ "$TERM" != "dumb" ]]; then
130
+ printf '\e]11;#1e1e2e\a'
131
+ printf '\e]10;#cdd6f4\a'
132
+ printf '\e]12;#f5e0dc\a'
133
+ fi
134
+
145
135
  __batipanel_prompt() {
146
136
  local exit_code=$?
147
137
  local sep=$'\uE0B0'
@@ -185,27 +175,23 @@ PROMPT_COMMAND="__batipanel_prompt"
185
175
  FALLBACK_EOF
186
176
  }
187
177
 
188
- # === 3. Setup bash powerline prompt ===
189
178
  setup_bash_prompt() {
190
179
  local shell_rc="$1"
191
180
 
192
181
  echo " Configuring bash prompt..."
193
182
 
194
- # generate prompt with current theme (uses _generate_themed_prompt from themes.sh)
195
183
  local current_theme="${BATIPANEL_THEME:-default}"
196
184
  if declare -f _generate_themed_prompt &>/dev/null; then
197
185
  _generate_themed_prompt "$current_theme"
198
186
  else
199
- # fallback: generate default prompt directly (standalone install without themes.sh)
200
187
  _setup_default_bash_prompt
201
188
  fi
202
189
 
203
- # source prompt from shell RC
204
190
  local prompt_file="$BATIPANEL_HOME/config/bash-prompt.sh"
205
191
  local source_line="source \"$prompt_file\""
206
192
  _add_line_if_missing "$shell_rc" "bash-prompt.sh" "$source_line"
207
193
 
208
- echo " Set powerline-style prompt (hostname hidden)"
194
+ echo " Set powerline-style prompt"
209
195
  }
210
196
 
211
197
  # === Helper: add line to RC if not already present ===
@@ -228,21 +214,6 @@ _add_line_if_missing() {
228
214
  fi
229
215
  }
230
216
 
231
- # === 4. macOS Terminal.app dark profile ===
232
- setup_macos_terminal_profile() {
233
- [ "$(uname -s)" = "Darwin" ] || return 0
234
-
235
- echo " Setting up Terminal.app dark theme..."
236
-
237
- # set macOS built-in "Pro" dark profile as default
238
- if defaults read com.apple.Terminal &>/dev/null 2>&1; then
239
- defaults write com.apple.Terminal "Default Window Settings" -string "Pro"
240
- defaults write com.apple.Terminal "Startup Window Settings" -string "Pro"
241
- echo " Set Terminal.app to dark theme (Pro)"
242
- echo " Open a new Terminal window to see the change"
243
- fi
244
- }
245
-
246
217
  # === Main entry point ===
247
218
  setup_shell_environment() {
248
219
  local user_shell="$1"
@@ -267,8 +238,5 @@ setup_shell_environment() {
267
238
  ;;
268
239
  esac
269
240
 
270
- # macOS: set Terminal.app to dark theme
271
- setup_macos_terminal_profile
272
-
273
241
  echo " Shell environment setup complete"
274
242
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "batipanel",
3
- "version": "0.4.13",
3
+ "version": "0.4.14",
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"