detached a3516e3

fix(examples): treat the state file as data in the bundled scripts and document $TERMINAL

commit
a3516e3fd166e8ad4d3babd007f25f477ca38839
author
brice · · 2026-10-05 16:00 UTC
parent
6a789b4
signature
GPG VerifiedCD88F9E564E0102646FB6077A1A07C7C7C3E349D · arch-gpg Verified for the committer email
5 files · +23 -7
M README.md +10 -1
@@ -66,7 +66,16 @@ theme = "auto" # the terminal you use
6666 theme = "~/.config/kitty/themes/mytheme.conf" # or one file
6767 ```
6868
69-`auto` picks the terminal named by `$TERMINAL` (or the first entry of `xdg-terminals.list`), and otherwise the first of kitty, ghostty, foot and alacritty that has a config with colors. A file can be any of those formats, and the bar recognizes it by its content. Includes and `theme =` names are followed. Colors the file does not set come from a built-in dark theme.
69+`auto` reads the theme of the terminal named by the **`$TERMINAL`** environment variable, and nothing else. It knows kitty, ghostty, foot and alacritty (`TERMINAL=kitty`, or a path such as `/usr/bin/foot`). A theme file can be any of those formats, and the bar recognizes it by its content. Includes and ghostty `theme =` names are followed. Colors the file does not set come from a built-in dark theme.
70+
71+**Set `$TERMINAL` for your whole session**, not only in a shell. A variable you `set -x` in an open terminal is not seen by programs your compositor starts. The simplest place is a systemd user environment file, read when a session starts, whatever your shell is:
72+
73+```
74+# ~/.config/environment.d/10-terminal.conf
75+TERMINAL=kitty
76+```
77+
78+Then start a new session. If `$TERMINAL` is missing, the bar says so in its log and uses the built-in colors.
7079
7180 The bar watches every file it read: change your terminal's theme and the bar changes with it. If the theme cannot be read, the bar uses the built-in colors and says why in its log.
7281
@@ -66,7 +66,16 @@ theme = "auto" # the terminal you use
66 theme = "~/.config/kitty/themes/mytheme.conf" # or one file66 theme = "~/.config/kitty/themes/mytheme.conf" # or one file
67 ```67 ```
68 68
69-`auto` picks the terminal named by `$TERMINAL` (or the first entry of `xdg-terminals.list`), and otherwise the first of kitty, ghostty, foot and alacritty that has a config with colors. A file can be any of those formats, and the bar recognizes it by its content. Includes and `theme =` names are followed. Colors the file does not set come from a built-in dark theme.69+`auto` reads the theme of the terminal named by the **`$TERMINAL`** environment variable, and nothing else. It knows kitty, ghostty, foot and alacritty (`TERMINAL=kitty`, or a path such as `/usr/bin/foot`). A theme file can be any of those formats, and the bar recognizes it by its content. Includes and ghostty `theme =` names are followed. Colors the file does not set come from a built-in dark theme.
70+
71+**Set `$TERMINAL` for your whole session**, not only in a shell. A variable you `set -x` in an open terminal is not seen by programs your compositor starts. The simplest place is a systemd user environment file, read when a session starts, whatever your shell is:
72+
73+```
74+# ~/.config/environment.d/10-terminal.conf
75+TERMINAL=kitty
76+```
77+
78+Then start a new session. If `$TERMINAL` is missing, the bar says so in its log and uses the built-in colors.
70 79
71 The bar watches every file it read: change your terminal's theme and the bar changes with it. If the theme cannot be read, the bar uses the built-in colors and says why in its log.80 The bar watches every file it read: change your terminal's theme and the bar changes with it. If the theme cannot be read, the bar uses the built-in colors and says why in its log.
72 81
M examples/bundle/center.sh +3 -1
@@ -10,7 +10,9 @@
1010
1111 draw() {
1212 local app
13- app=$(jq -r '.window.app_id // empty' "$NEFERWL_STATE" 2>/dev/null) || return
13+ # An app id is chosen by the application: drop control characters, which
14+ # would otherwise reach the bar as escape sequences.
15+ app=$(jq -r '(.window.app_id // empty) | explode | map(select(. >= 32 and . != 127)) | implode' "$NEFERWL_STATE" 2>/dev/null) || return
1416 if [ -n "$app" ]; then
1517 printf '%s%s%s %s%s%s\f' "$(bg "$BAR")" "$(fg "$NEFERBAR_COLOR3")" "$ICON_APP" "$(fg "$NEFERBAR_FOREGROUND")" "$app" "$RESET"
1618 else
@@ -10,7 +10,9 @@
10 10
11 draw() {11 draw() {
12 local app12 local app
13- app=$(jq -r '.window.app_id // empty' "$NEFERWL_STATE" 2>/dev/null) || return13+ # An app id is chosen by the application: drop control characters, which
14+ # would otherwise reach the bar as escape sequences.
15+ app=$(jq -r '(.window.app_id // empty) | explode | map(select(. >= 32 and . != 127)) | implode' "$NEFERWL_STATE" 2>/dev/null) || return
14 if [ -n "$app" ]; then16 if [ -n "$app" ]; then
15 printf '%s%s%s %s%s%s\f' "$(bg "$BAR")" "$(fg "$NEFERBAR_COLOR3")" "$ICON_APP" "$(fg "$NEFERBAR_FOREGROUND")" "$app" "$RESET"17 printf '%s%s%s %s%s%s\f' "$(bg "$BAR")" "$(fg "$NEFERBAR_COLOR3")" "$ICON_APP" "$(fg "$NEFERBAR_FOREGROUND")" "$app" "$RESET"
16 else18 else
M examples/bundle/config.toml +1 -1
@@ -9,7 +9,7 @@
99 [bar]
1010 font = "JetBrainsMono Nerd Font Mono" # any "Mono" Nerd Font
1111 size = 14
12-theme = "auto" # the colors of your terminal, or the path of a theme file
12+theme = "auto" # the colors of the terminal in $TERMINAL, or the path of a theme file
1313
1414 [[module]]
1515 name = "workspaces"
@@ -9,7 +9,7 @@
9 [bar]9 [bar]
10 font = "JetBrainsMono Nerd Font Mono" # any "Mono" Nerd Font10 font = "JetBrainsMono Nerd Font Mono" # any "Mono" Nerd Font
11 size = 1411 size = 14
12-theme = "auto" # the colors of your terminal, or the path of a theme file12+theme = "auto" # the colors of the terminal in $TERMINAL, or the path of a theme file
13 13
14 [[module]]14 [[module]]
15 name = "workspaces"15 name = "workspaces"
M examples/bundle/left.sh +4 -1
@@ -24,10 +24,13 @@ draw() {
2424 | "\($n) \($here | length) \([$here[] | select(.stash_count > 0)] | length)")' \
2525 "$NEFERWL_STATE" 2>/dev/null) || return
2626 read -r active count <<<"$(head -1 <<<"$data")"
27- [ -n "$active" ] || return
27+ # The state file is data, not code: bash arithmetic runs command
28+ # substitutions, so only digits may reach it.
29+ [[ $active =~ ^[0-9]+$ && $count =~ ^[0-9]+$ ]] || return
2830
2931 line="$(bg "$ACCENT")$(fg "$(ink "$ACCENT")")$BOLD $active $RESET$(fade "$ACCENT" "$BAR")$(bg "$BAR")"
3032 while read -r n w s; do
33+ [[ $n =~ ^[0-9]+$ && $w =~ ^[0-9]+$ && $s =~ ^[0-9]+$ ]] || continue
3134 pips=""
3235 ((w > 0)) && printf -v pips "$DOT%.0s" $(seq 1 $((w > 4 ? 4 : w)))
3336 if ((n == active)); then
@@ -24,10 +24,13 @@ draw() {
24 | "\($n) \($here | length) \([$here[] | select(.stash_count > 0)] | length)")' \24 | "\($n) \($here | length) \([$here[] | select(.stash_count > 0)] | length)")' \
25 "$NEFERWL_STATE" 2>/dev/null) || return25 "$NEFERWL_STATE" 2>/dev/null) || return
26 read -r active count <<<"$(head -1 <<<"$data")"26 read -r active count <<<"$(head -1 <<<"$data")"
27- [ -n "$active" ] || return27+ # The state file is data, not code: bash arithmetic runs command
28+ # substitutions, so only digits may reach it.
29+ [[ $active =~ ^[0-9]+$ && $count =~ ^[0-9]+$ ]] || return
28 30
29 line="$(bg "$ACCENT")$(fg "$(ink "$ACCENT")")$BOLD $active $RESET$(fade "$ACCENT" "$BAR")$(bg "$BAR")"31 line="$(bg "$ACCENT")$(fg "$(ink "$ACCENT")")$BOLD $active $RESET$(fade "$ACCENT" "$BAR")$(bg "$BAR")"
30 while read -r n w s; do32 while read -r n w s; do
33+ [[ $n =~ ^[0-9]+$ && $w =~ ^[0-9]+$ && $s =~ ^[0-9]+$ ]] || continue
31 pips=""34 pips=""
32 ((w > 0)) && printf -v pips "$DOT%.0s" $(seq 1 $((w > 4 ? 4 : w)))35 ((w > 0)) && printf -v pips "$DOT%.0s" $(seq 1 $((w > 4 ? 4 : w)))
33 if ((n == active)); then36 if ((n == active)); then
M examples/bundle/right.sh +5 -3
@@ -3,8 +3,10 @@
33 . "$(dirname "$0")/lib.sh"
44
55 while true; do
6+ # One reading of the clock, for the text and for the sleep, so they cannot
7+ # straddle a minute boundary.
8+ printf -v now '%(%s)T' -1
69 printf '%s%s%s%s%s %(%H:%M)T %s\f' \
7- "$(fade "$BAR" "$ACCENT")" "$(bg "$ACCENT")" "$(fg "$(ink "$ACCENT")")" "$BOLD" "$ICON_CLOCK" -1 "$RESET"
8- # Sleep until the next minute starts.
9- sleep $((60 - 10#$(date +%S)))
10+ "$(fade "$BAR" "$ACCENT")" "$(bg "$ACCENT")" "$(fg "$(ink "$ACCENT")")" "$BOLD" "$ICON_CLOCK" "$now" "$RESET"
11+ sleep $((60 - now % 60))
1012 done
@@ -3,8 +3,10 @@
3 . "$(dirname "$0")/lib.sh"3 . "$(dirname "$0")/lib.sh"
4 4
5 while true; do5 while true; do
6+ # One reading of the clock, for the text and for the sleep, so they cannot
7+ # straddle a minute boundary.
8+ printf -v now '%(%s)T' -1
6 printf '%s%s%s%s%s %(%H:%M)T %s\f' \9 printf '%s%s%s%s%s %(%H:%M)T %s\f' \
7- "$(fade "$BAR" "$ACCENT")" "$(bg "$ACCENT")" "$(fg "$(ink "$ACCENT")")" "$BOLD" "$ICON_CLOCK" -1 "$RESET"10+ "$(fade "$BAR" "$ACCENT")" "$(bg "$ACCENT")" "$(fg "$(ink "$ACCENT")")" "$BOLD" "$ICON_CLOCK" "$now" "$RESET"
8- # Sleep until the next minute starts.11+ sleep $((60 - now % 60))
9- sleep $((60 - 10#$(date +%S)))
10 done12 done

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 5

Tags 4

↑↓ moveenter openesc close