batipanel 0.4.15 → 0.4.17
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 +7 -1
- package/lib/shell-setup.sh +14 -28
- 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.17
|
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
|
package/lib/shell-setup.sh
CHANGED
|
@@ -64,27 +64,23 @@ _generate_zsh_prompt() {
|
|
|
64
64
|
# batipanel zsh prompt (no Oh My Zsh needed)
|
|
65
65
|
# This file is sourced from .zshrc
|
|
66
66
|
|
|
67
|
-
# enable colors
|
|
68
67
|
autoload -U colors && colors
|
|
69
|
-
|
|
70
|
-
# enable git info
|
|
71
68
|
autoload -Uz vcs_info
|
|
69
|
+
setopt PROMPT_SUBST
|
|
70
|
+
|
|
72
71
|
precmd() { vcs_info }
|
|
73
|
-
zstyle ':vcs_info:git:*' formats ' %F{black}%K{green} ⎇ %b %k%F{green}
|
|
72
|
+
zstyle ':vcs_info:git:*' formats ' %F{black}%K{green} ⎇ %b %k%F{green}❯%f'
|
|
74
73
|
zstyle ':vcs_info:*' enable git
|
|
75
74
|
|
|
76
|
-
#
|
|
77
|
-
setopt PROMPT_SUBST
|
|
78
|
-
|
|
79
|
-
# dark terminal colors via OSC escape sequences (works immediately)
|
|
75
|
+
# dark terminal colors via OSC (works immediately in any terminal)
|
|
80
76
|
if [[ "$TERM" != "dumb" ]]; then
|
|
81
|
-
printf '\e]11;#1e1e2e\a' # background
|
|
82
|
-
printf '\e]10;#cdd6f4\a' # foreground
|
|
83
|
-
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
|
|
84
80
|
fi
|
|
85
81
|
|
|
86
|
-
# prompt: user
|
|
87
|
-
PROMPT='%K{blue}%F{white} %n %
|
|
82
|
+
# prompt: user ❯ directory ❯ git
|
|
83
|
+
PROMPT='%F{blue}%K{blue}%F{white} %n %k%F{blue}❯%f%K{240}%F{white} %~ %k%F{240}${vcs_info_msg_0_:-%F{240}❯}%f '
|
|
88
84
|
RPROMPT='%(?..%F{red}✘ %?%f)'
|
|
89
85
|
ZSH_PROMPT_EOF
|
|
90
86
|
}
|
|
@@ -134,31 +130,21 @@ fi
|
|
|
134
130
|
|
|
135
131
|
__batipanel_prompt() {
|
|
136
132
|
local exit_code=$?
|
|
137
|
-
local bg_user="\[\e[44m\]"
|
|
138
|
-
local fg_user="\[\e[97m\]"
|
|
139
|
-
local bg_dir="\[\e[48;5;240m\]"
|
|
140
|
-
local fg_dir="\[\e[97m\]"
|
|
141
|
-
local bg_git="\[\e[42m\]"
|
|
142
|
-
local fg_git="\[\e[30m\]"
|
|
143
133
|
local reset="\[\e[0m\]"
|
|
144
|
-
local t_user="\[\e[34;48;5;240m\]"
|
|
145
|
-
local t_dir="\[\e[38;5;240;42m\]"
|
|
146
|
-
local t_end="\[\e[38;5;240m\]"
|
|
147
|
-
local t_git="\[\e[32m\]"
|
|
148
134
|
local ps=""
|
|
149
135
|
if [ "$exit_code" -ne 0 ]; then
|
|
150
|
-
ps+="\[\e[
|
|
136
|
+
ps+="\[\e[41;97m\] ✘ ${exit_code} \[\e[31;48;5;240m\]❯"
|
|
151
137
|
fi
|
|
152
|
-
ps+="
|
|
153
|
-
ps+="
|
|
138
|
+
ps+="\[\e[44;97m\] \\u \[\e[34;48;5;240m\]❯"
|
|
139
|
+
ps+="\[\e[48;5;240;97m\] \\w "
|
|
154
140
|
local git_branch=""
|
|
155
141
|
if command -v git &>/dev/null; then
|
|
156
142
|
git_branch="$(git symbolic-ref --short HEAD 2>/dev/null || git rev-parse --short HEAD 2>/dev/null)"
|
|
157
143
|
fi
|
|
158
144
|
if [ -n "$git_branch" ]; then
|
|
159
|
-
ps+="
|
|
145
|
+
ps+="\[\e[38;5;240;42m\]❯\[\e[42;30m\] ⎇ ${git_branch} ${reset}\[\e[32m\]❯${reset} "
|
|
160
146
|
else
|
|
161
|
-
ps+="${reset}
|
|
147
|
+
ps+="${reset}\[\e[38;5;240m\]❯${reset} "
|
|
162
148
|
fi
|
|
163
149
|
PS1="$ps"
|
|
164
150
|
}
|
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