batipanel 0.4.24 → 0.4.26
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/config/tmux-powerline.conf +4 -4
- package/install.sh +16 -1
- package/lib/shell-setup.sh +30 -7
- package/lib/themes-bash.sh +14 -19
- package/lib/themes-tmux.sh +4 -4
- package/package.json +1 -1
package/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.4.
|
|
1
|
+
0.4.26
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# powerline status bar (Nerd Font override)
|
|
2
|
-
set -g status-left '#[fg=colour232,bg=colour2,bold] #S #[fg=colour2,bg=colour234,nobold] '
|
|
3
|
-
set -g status-right '#[fg=colour240,bg=colour234]
|
|
4
|
-
setw -g window-status-format '#[fg=colour234,bg=colour238]
|
|
5
|
-
setw -g window-status-current-format '#[fg=colour234,bg=colour33]
|
|
2
|
+
set -g status-left '#[fg=colour232,bg=colour2,bold] #S #[fg=colour2,bg=colour234,nobold] '
|
|
3
|
+
set -g status-right '#[fg=colour240,bg=colour234]#[fg=colour249,bg=colour240] #{session_windows}W #{window_panes}P #[fg=colour2,bg=colour240]#[fg=colour232,bg=colour2,bold] %H:%M %m-%d '
|
|
4
|
+
setw -g window-status-format '#[fg=colour234,bg=colour238]#[fg=colour249,bg=colour238] #I #W #[fg=colour238,bg=colour234]'
|
|
5
|
+
setw -g window-status-current-format '#[fg=colour234,bg=colour33]#[fg=colour255,bg=colour33,bold] #I #W #[fg=colour33,bg=colour234]'
|
package/install.sh
CHANGED
|
@@ -647,9 +647,24 @@ fi
|
|
|
647
647
|
_sed_i() { sed_i "$@"; }
|
|
648
648
|
export -f _sed_i 2>/dev/null || true
|
|
649
649
|
|
|
650
|
-
# source
|
|
650
|
+
# source theme modules so _generate_themed_prompt is available
|
|
651
|
+
# shellcheck source=lib/core.sh
|
|
652
|
+
source "$BATIPANEL_HOME/lib/core.sh"
|
|
653
|
+
# shellcheck source=lib/themes-data.sh
|
|
654
|
+
source "$BATIPANEL_HOME/lib/themes-data.sh"
|
|
655
|
+
# shellcheck source=lib/themes-tmux.sh
|
|
656
|
+
source "$BATIPANEL_HOME/lib/themes-tmux.sh"
|
|
657
|
+
# shellcheck source=lib/themes-bash.sh
|
|
658
|
+
source "$BATIPANEL_HOME/lib/themes-bash.sh"
|
|
651
659
|
# shellcheck source=lib/shell-setup.sh
|
|
652
660
|
source "$BATIPANEL_HOME/lib/shell-setup.sh"
|
|
661
|
+
|
|
662
|
+
# apply default theme (generates theme.conf, bash-prompt.sh, theme-env.sh)
|
|
663
|
+
BATIPANEL_THEME="${BATIPANEL_THEME:-default}"
|
|
664
|
+
_generate_theme_conf "$BATIPANEL_THEME"
|
|
665
|
+
generate_theme_env "$BATIPANEL_THEME"
|
|
666
|
+
|
|
667
|
+
# setup shell RC (sources prompt file from .bashrc/.zshrc)
|
|
653
668
|
setup_shell_environment "$USER_SHELL" "$SHELL_RC"
|
|
654
669
|
|
|
655
670
|
# === done ===
|
package/lib/shell-setup.sh
CHANGED
|
@@ -76,7 +76,15 @@ precmd() { vcs_info }
|
|
|
76
76
|
zstyle ':vcs_info:git:*' formats " %F{${BP_C_GIT:-green}}(%b)%f"
|
|
77
77
|
zstyle ':vcs_info:*' enable git
|
|
78
78
|
|
|
79
|
-
|
|
79
|
+
# detect powerline glyph support at runtime
|
|
80
|
+
_bp_sep='>'
|
|
81
|
+
case "${TERM_PROGRAM:-}" in
|
|
82
|
+
iTerm.app|WezTerm|kitty|Hyper|Alacritty|vscode) _bp_sep=$'\uE0B0' ;;
|
|
83
|
+
esac
|
|
84
|
+
[[ -n "${TMUX:-}" ]] && _bp_sep=$'\uE0B0'
|
|
85
|
+
[[ "${BATIPANEL_ICONS:-0}" == "1" ]] && _bp_sep=$'\uE0B0'
|
|
86
|
+
|
|
87
|
+
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 "
|
|
80
88
|
RPROMPT='%(?..%F{red}[%?]%f)'
|
|
81
89
|
ZSH_PROMPT_EOF
|
|
82
90
|
}
|
|
@@ -116,21 +124,36 @@ _setup_default_bash_prompt() {
|
|
|
116
124
|
|
|
117
125
|
cat > "$prompt_file" << 'BASH_PROMPT_EOF'
|
|
118
126
|
#!/usr/bin/env bash
|
|
119
|
-
# batipanel bash prompt
|
|
127
|
+
# batipanel bash prompt (fallback)
|
|
120
128
|
|
|
121
129
|
# load theme colors
|
|
122
130
|
_bp_env="$HOME/.batipanel/config/theme-env.sh"
|
|
123
131
|
[ -f "$_bp_env" ] && source "$_bp_env"
|
|
124
132
|
|
|
125
133
|
# set terminal colors via OSC
|
|
126
|
-
if [[ "$TERM" != "dumb" ]]; then
|
|
127
|
-
printf
|
|
128
|
-
printf
|
|
129
|
-
printf
|
|
134
|
+
if [[ "$TERM" != "dumb" ]] && [[ -n "${BP_BG:-}" ]]; then
|
|
135
|
+
printf '\e]11;%s\a' "$BP_BG"
|
|
136
|
+
printf '\e]10;%s\a' "$BP_FG"
|
|
137
|
+
printf '\e]12;%s\a' "$BP_CURSOR"
|
|
130
138
|
fi
|
|
131
139
|
|
|
132
140
|
__batipanel_prompt() {
|
|
133
141
|
local exit_code=$?
|
|
142
|
+
|
|
143
|
+
# detect powerline glyph support at runtime
|
|
144
|
+
local sep
|
|
145
|
+
local _use_pl=0
|
|
146
|
+
case "${TERM_PROGRAM:-}" in
|
|
147
|
+
iTerm.app|WezTerm|kitty|Hyper|Alacritty|vscode) _use_pl=1 ;;
|
|
148
|
+
esac
|
|
149
|
+
[[ -n "${TMUX:-}" ]] && _use_pl=1
|
|
150
|
+
[[ "${BATIPANEL_ICONS:-0}" == "1" ]] && _use_pl=1
|
|
151
|
+
if (( _use_pl )); then
|
|
152
|
+
sep=$'\uE0B0'
|
|
153
|
+
else
|
|
154
|
+
sep='>'
|
|
155
|
+
fi
|
|
156
|
+
|
|
134
157
|
local reset="\[\e[0m\]"
|
|
135
158
|
local ps=""
|
|
136
159
|
if [ "$exit_code" -ne 0 ]; then
|
|
@@ -144,7 +167,7 @@ __batipanel_prompt() {
|
|
|
144
167
|
if [ -n "$git_branch" ]; then
|
|
145
168
|
ps+=" \[\e[32m\](${git_branch})${reset}"
|
|
146
169
|
fi
|
|
147
|
-
ps+=" \[\e[35m\]
|
|
170
|
+
ps+=" \[\e[35m\]${sep}${reset} "
|
|
148
171
|
PS1="$ps"
|
|
149
172
|
}
|
|
150
173
|
PROMPT_COMMAND="__batipanel_prompt"
|
package/lib/themes-bash.sh
CHANGED
|
@@ -118,22 +118,6 @@ _generate_themed_prompt() {
|
|
|
118
118
|
t_err_dir="\\[\\e[38;5;${t_err_fg};48;5;${prompt_dir}m\\]"
|
|
119
119
|
fi
|
|
120
120
|
|
|
121
|
-
# detect glyph support: Nerd Font terminals get powerline arrows, others get ASCII
|
|
122
|
-
local use_powerline=0
|
|
123
|
-
case "${TERM_PROGRAM:-}" in
|
|
124
|
-
iTerm.app|WezTerm|kitty) use_powerline=1 ;;
|
|
125
|
-
esac
|
|
126
|
-
[[ "${BATIPANEL_ICONS:-0}" == "1" ]] && use_powerline=1
|
|
127
|
-
|
|
128
|
-
local sep_char git_icon_line
|
|
129
|
-
if (( use_powerline )); then
|
|
130
|
-
sep_char=\$\'\\\\uE0B0\'
|
|
131
|
-
git_icon_line=" local git_icon=\$'\\\\uE0A0'"
|
|
132
|
-
else
|
|
133
|
-
sep_char='>'
|
|
134
|
-
git_icon_line=' local git_icon=""'
|
|
135
|
-
fi
|
|
136
|
-
|
|
137
121
|
mkdir -p "$BATIPANEL_HOME/config"
|
|
138
122
|
cat > "$prompt_file" << PROMPT_EOF
|
|
139
123
|
#!/usr/bin/env bash
|
|
@@ -153,8 +137,20 @@ fi
|
|
|
153
137
|
__batipanel_prompt() {
|
|
154
138
|
local exit_code=\$?
|
|
155
139
|
|
|
156
|
-
#
|
|
157
|
-
local sep="
|
|
140
|
+
# detect powerline glyph support at runtime
|
|
141
|
+
local sep git_icon=""
|
|
142
|
+
local _use_pl=0
|
|
143
|
+
case "\${TERM_PROGRAM:-}" in
|
|
144
|
+
iTerm.app|WezTerm|kitty|Hyper|Alacritty|vscode) _use_pl=1 ;;
|
|
145
|
+
esac
|
|
146
|
+
[[ -n "\${TMUX:-}" ]] && _use_pl=1
|
|
147
|
+
[[ "\${BATIPANEL_ICONS:-0}" == "1" ]] && _use_pl=1
|
|
148
|
+
if (( _use_pl )); then
|
|
149
|
+
sep=\$'\\uE0B0'
|
|
150
|
+
git_icon=\$'\\uE0A0'
|
|
151
|
+
else
|
|
152
|
+
sep='>'
|
|
153
|
+
fi
|
|
158
154
|
|
|
159
155
|
# colors (generated from theme: ${theme})
|
|
160
156
|
local bg_user="${bg_user}"
|
|
@@ -194,7 +190,6 @@ __batipanel_prompt() {
|
|
|
194
190
|
|
|
195
191
|
if [ -n "\$git_branch" ]; then
|
|
196
192
|
ps+="\${t_dir_git}\${sep}"
|
|
197
|
-
${git_icon_line}
|
|
198
193
|
if [ -n "\$git_icon" ]; then
|
|
199
194
|
ps+="\${bg_git}\${fg_git} \${git_icon} \${git_branch} "
|
|
200
195
|
else
|
package/lib/themes-tmux.sh
CHANGED
|
@@ -24,12 +24,12 @@ _generate_theme_conf() {
|
|
|
24
24
|
|
|
25
25
|
# status bar
|
|
26
26
|
set -g status-style "bg=${status_bg},fg=${status_fg}"
|
|
27
|
-
set -g status-left '#[fg=${accent_fg},bg=${accent},bold] #S #[fg=${accent},bg=${status_bg},nobold] '
|
|
28
|
-
set -g status-right '#[fg=${border},bg=${status_bg}]
|
|
27
|
+
set -g status-left '#[fg=${accent_fg},bg=${accent},bold] #S #[fg=${accent},bg=${status_bg},nobold] '
|
|
28
|
+
set -g status-right '#[fg=${border},bg=${status_bg}]#[fg=${win_fg},bg=${border}] #{session_windows}W #{window_panes}P #[fg=${accent},bg=${border}]#[fg=${accent_fg},bg=${accent},bold] %H:%M %m-%d '
|
|
29
29
|
|
|
30
30
|
# window tabs
|
|
31
|
-
setw -g window-status-format '#[fg=${status_bg},bg=${win_bg}]
|
|
32
|
-
setw -g window-status-current-format '#[fg=${status_bg},bg=${win_active_bg}]
|
|
31
|
+
setw -g window-status-format '#[fg=${status_bg},bg=${win_bg}]#[fg=${win_fg},bg=${win_bg}] #I #W #[fg=${win_bg},bg=${status_bg}]'
|
|
32
|
+
setw -g window-status-current-format '#[fg=${status_bg},bg=${win_active_bg}]#[fg=${win_active_fg},bg=${win_active_bg},bold] #I #W #[fg=${win_active_bg},bg=${status_bg}]'
|
|
33
33
|
|
|
34
34
|
# pane borders
|
|
35
35
|
set -g pane-border-style "fg=${border}"
|
package/package.json
CHANGED