batipanel 0.4.16 → 0.4.18
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 +1 -1
- package/install.sh +10 -1
- package/lib/shell-setup.sh +12 -55
- package/lib/themes-data.sh +16 -0
- package/lib/themes.sh +25 -1
- package/package.json +1 -1
package/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.4.
|
|
1
|
+
0.4.18
|
package/install.sh
CHANGED
|
@@ -533,14 +533,20 @@ fi
|
|
|
533
533
|
|
|
534
534
|
# === 9. register tab completion ===
|
|
535
535
|
if [ "$USER_SHELL" = "zsh" ]; then
|
|
536
|
-
# zsh: install
|
|
536
|
+
# zsh: install completion + ensure compinit runs
|
|
537
537
|
local_zsh_comp="${ZDOTDIR:-$HOME}/.zfunc"
|
|
538
538
|
mkdir -p "$local_zsh_comp"
|
|
539
539
|
if [ -f "$BATIPANEL_HOME/completions/_batipanel.zsh" ]; then
|
|
540
540
|
cp "$BATIPANEL_HOME/completions/_batipanel.zsh" "$local_zsh_comp/_batipanel"
|
|
541
|
+
# also copy as _b so completion works for the 'b' function
|
|
542
|
+
cp "$BATIPANEL_HOME/completions/_batipanel.zsh" "$local_zsh_comp/_b"
|
|
541
543
|
if ! grep -qF "$local_zsh_comp" "$SHELL_RC" 2>/dev/null; then
|
|
542
544
|
echo "fpath+=($local_zsh_comp)" >> "$SHELL_RC"
|
|
543
545
|
fi
|
|
546
|
+
# ensure compinit is loaded (needed for fpath completions)
|
|
547
|
+
if ! grep -qF "compinit" "$SHELL_RC" 2>/dev/null; then
|
|
548
|
+
echo 'autoload -Uz compinit && compinit -C' >> "$SHELL_RC"
|
|
549
|
+
fi
|
|
544
550
|
echo " Added zsh completion"
|
|
545
551
|
fi
|
|
546
552
|
else
|
|
@@ -607,6 +613,9 @@ echo " b layouts # Show available layouts"
|
|
|
607
613
|
echo " b config layout 7panel # Change default layout"
|
|
608
614
|
echo " b theme # List/change color themes"
|
|
609
615
|
echo ""
|
|
616
|
+
echo "Tip: For a polished arrow-style prompt, set your terminal font"
|
|
617
|
+
echo " to a Powerline or Nerd Font (e.g. MesloLGS NF, Hack NF)."
|
|
618
|
+
echo ""
|
|
610
619
|
# auto-apply: silently launch a fresh login shell so aliases work immediately
|
|
611
620
|
if [ -t 0 ] && [ -z "${BATIPANEL_NO_EXEC:-}" ]; then
|
|
612
621
|
cd "$HOME"
|
package/lib/shell-setup.sh
CHANGED
|
@@ -68,37 +68,20 @@ autoload -U colors && colors
|
|
|
68
68
|
autoload -Uz vcs_info
|
|
69
69
|
setopt PROMPT_SUBST
|
|
70
70
|
|
|
71
|
-
# detect powerline font support
|
|
72
|
-
_bp_sep='▸'
|
|
73
|
-
_bp_git='⎇'
|
|
74
|
-
if [[ "$(uname -s)" == "Darwin" ]]; then
|
|
75
|
-
if ls ~/Library/Fonts/*owerline* &>/dev/null 2>&1 \
|
|
76
|
-
|| ls ~/Library/Fonts/*erd* &>/dev/null 2>&1 \
|
|
77
|
-
|| ls /Library/Fonts/*erd* &>/dev/null 2>&1; then
|
|
78
|
-
_bp_sep=$'\uE0B0'
|
|
79
|
-
_bp_git=$'\uE0A0'
|
|
80
|
-
fi
|
|
81
|
-
else
|
|
82
|
-
if fc-list 2>/dev/null | grep -qi "powerline\|nerd"; then
|
|
83
|
-
_bp_sep=$'\uE0B0'
|
|
84
|
-
_bp_git=$'\uE0A0'
|
|
85
|
-
fi
|
|
86
|
-
fi
|
|
87
|
-
|
|
88
71
|
precmd() { vcs_info }
|
|
89
|
-
zstyle ':vcs_info:git:*' formats
|
|
72
|
+
zstyle ':vcs_info:git:*' formats ' %F{green}(%b)%f'
|
|
90
73
|
zstyle ':vcs_info:*' enable git
|
|
91
74
|
|
|
92
|
-
# dark terminal colors via OSC (works immediately
|
|
75
|
+
# dark terminal colors via OSC (works immediately in any terminal)
|
|
93
76
|
if [[ "$TERM" != "dumb" ]]; then
|
|
94
|
-
printf '\e]11;#1e1e2e\a' # background
|
|
95
|
-
printf '\e]10;#cdd6f4\a' # foreground
|
|
96
|
-
printf '\e]12;#f5e0dc\a' # cursor
|
|
77
|
+
printf '\e]11;#1e1e2e\a' # background
|
|
78
|
+
printf '\e]10;#cdd6f4\a' # foreground
|
|
79
|
+
printf '\e]12;#f5e0dc\a' # cursor
|
|
97
80
|
fi
|
|
98
81
|
|
|
99
|
-
# prompt
|
|
100
|
-
PROMPT=
|
|
101
|
-
RPROMPT='%(?..%F{red}
|
|
82
|
+
# clean prompt: user | directory (branch) >
|
|
83
|
+
PROMPT='%F{blue}%n%f %F{cyan}%~%f${vcs_info_msg_0_} %F{magenta}>%f '
|
|
84
|
+
RPROMPT='%(?..%F{red}[%?]%f)'
|
|
102
85
|
ZSH_PROMPT_EOF
|
|
103
86
|
}
|
|
104
87
|
|
|
@@ -145,48 +128,22 @@ if [[ "$TERM" != "dumb" ]]; then
|
|
|
145
128
|
printf '\e]12;#f5e0dc\a'
|
|
146
129
|
fi
|
|
147
130
|
|
|
148
|
-
# detect powerline font
|
|
149
|
-
_bp_sep='▸'
|
|
150
|
-
_bp_git='⎇'
|
|
151
|
-
if [ "$(uname -s)" = "Darwin" ]; then
|
|
152
|
-
if ls ~/Library/Fonts/*owerline* &>/dev/null 2>&1 \
|
|
153
|
-
|| ls ~/Library/Fonts/*erd* &>/dev/null 2>&1; then
|
|
154
|
-
_bp_sep=$'\uE0B0'
|
|
155
|
-
_bp_git=$'\uE0A0'
|
|
156
|
-
fi
|
|
157
|
-
elif fc-list 2>/dev/null | grep -qi "powerline\|nerd"; then
|
|
158
|
-
_bp_sep=$'\uE0B0'
|
|
159
|
-
_bp_git=$'\uE0A0'
|
|
160
|
-
fi
|
|
161
|
-
|
|
162
131
|
__batipanel_prompt() {
|
|
163
132
|
local exit_code=$?
|
|
164
|
-
local bg_user="\[\e[44m\]"
|
|
165
|
-
local fg_user="\[\e[97m\]"
|
|
166
|
-
local bg_dir="\[\e[48;5;240m\]"
|
|
167
|
-
local fg_dir="\[\e[97m\]"
|
|
168
|
-
local bg_git="\[\e[42m\]"
|
|
169
|
-
local fg_git="\[\e[30m\]"
|
|
170
133
|
local reset="\[\e[0m\]"
|
|
171
|
-
local t_user="\[\e[34;48;5;240m\]"
|
|
172
|
-
local t_dir="\[\e[38;5;240;42m\]"
|
|
173
|
-
local t_end="\[\e[38;5;240m\]"
|
|
174
|
-
local t_git="\[\e[32m\]"
|
|
175
134
|
local ps=""
|
|
176
135
|
if [ "$exit_code" -ne 0 ]; then
|
|
177
|
-
ps+="\[\e[
|
|
136
|
+
ps+="\[\e[31m\][${exit_code}] "
|
|
178
137
|
fi
|
|
179
|
-
ps+="${
|
|
180
|
-
ps+="${bg_dir}${fg_dir} \\w "
|
|
138
|
+
ps+="\[\e[34m\]\\u${reset} \[\e[36m\]\\w${reset}"
|
|
181
139
|
local git_branch=""
|
|
182
140
|
if command -v git &>/dev/null; then
|
|
183
141
|
git_branch="$(git symbolic-ref --short HEAD 2>/dev/null || git rev-parse --short HEAD 2>/dev/null)"
|
|
184
142
|
fi
|
|
185
143
|
if [ -n "$git_branch" ]; then
|
|
186
|
-
ps+="
|
|
187
|
-
else
|
|
188
|
-
ps+="${reset}${t_end}${_bp_sep}${reset} "
|
|
144
|
+
ps+=" \[\e[32m\](${git_branch})${reset}"
|
|
189
145
|
fi
|
|
146
|
+
ps+=" \[\e[35m\]>${reset} "
|
|
190
147
|
PS1="$ps"
|
|
191
148
|
}
|
|
192
149
|
PROMPT_COMMAND="__batipanel_prompt"
|
package/lib/themes-data.sh
CHANGED
|
@@ -56,6 +56,22 @@ _get_theme_desc() {
|
|
|
56
56
|
esac
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
+
# terminal hex colors for OSC escape sequences
|
|
60
|
+
# returns: BG FG CURSOR
|
|
61
|
+
_get_theme_terminal_colors() {
|
|
62
|
+
case "$1" in
|
|
63
|
+
default) echo "#1e1e2e #cdd6f4 #f5e0dc" ;;
|
|
64
|
+
dracula) echo "#282a36 #f8f8f2 #ff79c6" ;;
|
|
65
|
+
nord) echo "#2e3440 #d8dee9 #88c0d0" ;;
|
|
66
|
+
gruvbox) echo "#282828 #ebdbb2 #fe8019" ;;
|
|
67
|
+
tokyo-night) echo "#1a1b26 #c0caf5 #bb9af7" ;;
|
|
68
|
+
catppuccin) echo "#1e1e2e #cdd6f4 #f5e0dc" ;;
|
|
69
|
+
rose-pine) echo "#191724 #e0def4 #ebbcba" ;;
|
|
70
|
+
kanagawa) echo "#1f1f28 #dcd7ba #7e9cd8" ;;
|
|
71
|
+
*) echo "#1e1e2e #cdd6f4 #f5e0dc" ;;
|
|
72
|
+
esac
|
|
73
|
+
}
|
|
74
|
+
|
|
59
75
|
# list available themes
|
|
60
76
|
_list_themes() {
|
|
61
77
|
local current="${BATIPANEL_THEME:-default}"
|
package/lib/themes.sh
CHANGED
|
@@ -31,12 +31,36 @@ _apply_theme() {
|
|
|
31
31
|
echo "BATIPANEL_THEME=\"$theme\"" > "$TMUX_CONFIG"
|
|
32
32
|
fi
|
|
33
33
|
|
|
34
|
+
# update zsh prompt terminal colors
|
|
35
|
+
local zsh_prompt="$BATIPANEL_HOME/config/zsh-prompt.zsh"
|
|
36
|
+
if [ -f "$zsh_prompt" ]; then
|
|
37
|
+
local term_colors
|
|
38
|
+
term_colors=$(_get_theme_terminal_colors "$theme")
|
|
39
|
+
local bg fg cursor
|
|
40
|
+
bg=$(echo "$term_colors" | awk '{print $1}')
|
|
41
|
+
fg=$(echo "$term_colors" | awk '{print $2}')
|
|
42
|
+
cursor=$(echo "$term_colors" | awk '{print $3}')
|
|
43
|
+
_sed_i "s|printf '\\\\e\]11;#[0-9a-f]*\\\\a'|printf '\\\\e]11;${bg}\\\\a'|" "$zsh_prompt"
|
|
44
|
+
_sed_i "s|printf '\\\\e\]10;#[0-9a-f]*\\\\a'|printf '\\\\e]10;${fg}\\\\a'|" "$zsh_prompt"
|
|
45
|
+
_sed_i "s|printf '\\\\e\]12;#[0-9a-f]*\\\\a'|printf '\\\\e]12;${cursor}\\\\a'|" "$zsh_prompt"
|
|
46
|
+
fi
|
|
47
|
+
|
|
34
48
|
# live reload: apply theme overlay to all running tmux servers
|
|
35
49
|
if command -v tmux &>/dev/null && tmux list-sessions &>/dev/null 2>&1; then
|
|
36
|
-
# source theme.conf directly (not tmux.conf which reloads defaults first)
|
|
37
50
|
tmux source-file "$BATIPANEL_HOME/config/theme.conf" 2>/dev/null || true
|
|
38
51
|
fi
|
|
39
52
|
|
|
53
|
+
# live reload: apply terminal colors to current shell immediately
|
|
54
|
+
local term_colors
|
|
55
|
+
term_colors=$(_get_theme_terminal_colors "$theme")
|
|
56
|
+
local bg fg cursor
|
|
57
|
+
bg=$(echo "$term_colors" | awk '{print $1}')
|
|
58
|
+
fg=$(echo "$term_colors" | awk '{print $2}')
|
|
59
|
+
cursor=$(echo "$term_colors" | awk '{print $3}')
|
|
60
|
+
printf '\e]11;%s\a' "$bg"
|
|
61
|
+
printf '\e]10;%s\a' "$fg"
|
|
62
|
+
printf '\e]12;%s\a' "$cursor"
|
|
63
|
+
|
|
40
64
|
BATIPANEL_THEME="$theme"
|
|
41
65
|
log_info "theme applied: $theme"
|
|
42
66
|
echo -e "${GREEN}Theme applied: ${theme}${NC}"
|
package/package.json
CHANGED