batipanel 0.4.18 → 0.4.19
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/lib/common.sh +6 -0
- package/lib/shell-setup.sh +19 -9
- package/lib/themes-data.sh +10 -10
- package/lib/themes.sh +7 -15
- package/package.json +1 -1
package/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.4.
|
|
1
|
+
0.4.19
|
package/lib/common.sh
CHANGED
|
@@ -8,6 +8,12 @@ set -euo pipefail
|
|
|
8
8
|
BATIPANEL_HOME="${BATIPANEL_HOME:-$HOME/.batipanel}"
|
|
9
9
|
_BATIPANEL_LIB="$BATIPANEL_HOME/lib"
|
|
10
10
|
|
|
11
|
+
# ensure batipanel-installed tools (e.g. tmux via micromamba) are in PATH
|
|
12
|
+
case ":$PATH:" in
|
|
13
|
+
*":$BATIPANEL_HOME/bin:"*) ;;
|
|
14
|
+
*) export PATH="$BATIPANEL_HOME/bin:$PATH" ;;
|
|
15
|
+
esac
|
|
16
|
+
|
|
11
17
|
# shellcheck source=lib/core.sh
|
|
12
18
|
source "$_BATIPANEL_LIB/core.sh"
|
|
13
19
|
# shellcheck source=lib/logger.sh
|
package/lib/shell-setup.sh
CHANGED
|
@@ -60,7 +60,18 @@ _generate_zsh_prompt() {
|
|
|
60
60
|
local prompt_file="$BATIPANEL_HOME/config/zsh-prompt.zsh"
|
|
61
61
|
mkdir -p "$BATIPANEL_HOME/config"
|
|
62
62
|
|
|
63
|
-
|
|
63
|
+
# get theme colors
|
|
64
|
+
local theme="${BATIPANEL_THEME:-default}"
|
|
65
|
+
local term_colors
|
|
66
|
+
if declare -f _get_theme_terminal_colors &>/dev/null; then
|
|
67
|
+
term_colors=$(_get_theme_terminal_colors "$theme")
|
|
68
|
+
else
|
|
69
|
+
term_colors="#1e1e2e #cdd6f4 #f5e0dc blue cyan green magenta"
|
|
70
|
+
fi
|
|
71
|
+
local bg fg cursor c_user c_dir c_git c_prompt
|
|
72
|
+
read -r bg fg cursor c_user c_dir c_git c_prompt <<< "$term_colors"
|
|
73
|
+
|
|
74
|
+
cat > "$prompt_file" << ZSH_PROMPT_EOF
|
|
64
75
|
# batipanel zsh prompt (no Oh My Zsh needed)
|
|
65
76
|
# This file is sourced from .zshrc
|
|
66
77
|
|
|
@@ -69,18 +80,17 @@ autoload -Uz vcs_info
|
|
|
69
80
|
setopt PROMPT_SUBST
|
|
70
81
|
|
|
71
82
|
precmd() { vcs_info }
|
|
72
|
-
zstyle ':vcs_info:git:*' formats ' %F{
|
|
83
|
+
zstyle ':vcs_info:git:*' formats ' %F{${c_git}}(%b)%f'
|
|
73
84
|
zstyle ':vcs_info:*' enable git
|
|
74
85
|
|
|
75
|
-
#
|
|
76
|
-
if [[ "
|
|
77
|
-
printf '\e]11
|
|
78
|
-
printf '\e]10
|
|
79
|
-
printf '\e]12
|
|
86
|
+
# terminal colors via OSC
|
|
87
|
+
if [[ "\$TERM" != "dumb" ]]; then
|
|
88
|
+
printf '\e]11;${bg}\a'
|
|
89
|
+
printf '\e]10;${fg}\a'
|
|
90
|
+
printf '\e]12;${cursor}\a'
|
|
80
91
|
fi
|
|
81
92
|
|
|
82
|
-
|
|
83
|
-
PROMPT='%F{blue}%n%f %F{cyan}%~%f${vcs_info_msg_0_} %F{magenta}>%f '
|
|
93
|
+
PROMPT='%F{${c_user}}%n%f %F{${c_dir}}%~%f\${vcs_info_msg_0_} %F{${c_prompt}}>%f '
|
|
84
94
|
RPROMPT='%(?..%F{red}[%?]%f)'
|
|
85
95
|
ZSH_PROMPT_EOF
|
|
86
96
|
}
|
package/lib/themes-data.sh
CHANGED
|
@@ -57,18 +57,18 @@ _get_theme_desc() {
|
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
# terminal hex colors for OSC escape sequences
|
|
60
|
-
# returns: BG FG CURSOR
|
|
60
|
+
# returns: BG FG CURSOR USER_COLOR DIR_COLOR GIT_COLOR PROMPT_COLOR
|
|
61
61
|
_get_theme_terminal_colors() {
|
|
62
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" ;;
|
|
63
|
+
default) echo "#1e1e2e #cdd6f4 #f5e0dc blue cyan green magenta" ;;
|
|
64
|
+
dracula) echo "#282a36 #f8f8f2 #ff79c6 141 117 84 212" ;;
|
|
65
|
+
nord) echo "#2e3440 #d8dee9 #88c0d0 blue 110 green 67" ;;
|
|
66
|
+
gruvbox) echo "#282828 #ebdbb2 #fe8019 yellow 223 green 208" ;;
|
|
67
|
+
tokyo-night) echo "#1a1b26 #c0caf5 #bb9af7 blue 111 green 141" ;;
|
|
68
|
+
catppuccin) echo "#1e1e2e #cdd6f4 #f5e0dc blue 183 green 183" ;;
|
|
69
|
+
rose-pine) echo "#191724 #e0def4 #ebbcba magenta 181 green 182" ;;
|
|
70
|
+
kanagawa) echo "#1f1f28 #dcd7ba #7e9cd8 blue 110 green 103" ;;
|
|
71
|
+
*) echo "#1e1e2e #cdd6f4 #f5e0dc blue cyan green magenta" ;;
|
|
72
72
|
esac
|
|
73
73
|
}
|
|
74
74
|
|
package/lib/themes.sh
CHANGED
|
@@ -20,6 +20,12 @@ _apply_theme() {
|
|
|
20
20
|
# generate themed bash prompt
|
|
21
21
|
_generate_themed_prompt "$theme"
|
|
22
22
|
|
|
23
|
+
# regenerate zsh prompt with new theme colors
|
|
24
|
+
BATIPANEL_THEME="$theme"
|
|
25
|
+
if declare -f _generate_zsh_prompt &>/dev/null; then
|
|
26
|
+
_generate_zsh_prompt
|
|
27
|
+
fi
|
|
28
|
+
|
|
23
29
|
# persist to config.sh
|
|
24
30
|
if [ -f "$TMUX_CONFIG" ]; then
|
|
25
31
|
if grep -qF "BATIPANEL_THEME=" "$TMUX_CONFIG"; then
|
|
@@ -31,20 +37,6 @@ _apply_theme() {
|
|
|
31
37
|
echo "BATIPANEL_THEME=\"$theme\"" > "$TMUX_CONFIG"
|
|
32
38
|
fi
|
|
33
39
|
|
|
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
|
-
|
|
48
40
|
# live reload: apply theme overlay to all running tmux servers
|
|
49
41
|
if command -v tmux &>/dev/null && tmux list-sessions &>/dev/null 2>&1; then
|
|
50
42
|
tmux source-file "$BATIPANEL_HOME/config/theme.conf" 2>/dev/null || true
|
|
@@ -61,9 +53,9 @@ _apply_theme() {
|
|
|
61
53
|
printf '\e]10;%s\a' "$fg"
|
|
62
54
|
printf '\e]12;%s\a' "$cursor"
|
|
63
55
|
|
|
64
|
-
BATIPANEL_THEME="$theme"
|
|
65
56
|
log_info "theme applied: $theme"
|
|
66
57
|
echo -e "${GREEN}Theme applied: ${theme}${NC}"
|
|
58
|
+
echo " Run: source ~/.zshrc (to update prompt colors)"
|
|
67
59
|
}
|
|
68
60
|
|
|
69
61
|
# CLI entry point: b theme [name]
|
package/package.json
CHANGED