detached ac13ee3

fix(examples): keep the gap after the status icons

commit
ac13ee3b972505c81c1f147e525537de7f08a6b2
author
brice · · 2026-10-09 07:38 UTC
parent
0c98ac0
signature
GPG VerifiedCD88F9E564E0102646FB6077A1A07C7C7C3E349D · arch-gpg Verified for the committer email
1 file · +11 -2
M examples/modules/status.py +11 -2
@@ -89,6 +89,16 @@ def foreground(hex_color):
8989 return f"\033[38;2;{int(h[0:2], 16)};{int(h[2:4], 16)};{int(h[4:6], 16)}m"
9090
9191
92+def background(hex_color):
93+ h = hex_color.lstrip("#")
94+ return f"\033[48;2;{int(h[0:2], 16)};{int(h[2:4], 16)};{int(h[4:6], 16)}m"
95+
96+
97+# The bar drops blank cells at the end of a module; one painted with the bar's
98+# own background is kept, and keeps the last icon off the next module.
99+GAP = background(os.environ.get("NEFERBAR_BACKGROUND", "#000000")) + " " + "\033[0m"
100+
101+
92102 # --- volume ------------------------------------------------------------------
93103
94104 class Volume:
@@ -302,8 +312,7 @@ class Module:
302312 def draw(self):
303313 # One icon per part, separated by a space: part i is at column 2*i.
304314 self.cols = {2 * i: part for i, part in enumerate(self.parts)}
305- # A trailing space keeps the last icon off the next module.
306- frame = " ".join(part.icon() for part in self.parts) + " "
315+ frame = " ".join(part.icon() for part in self.parts) + GAP
307316 if frame != self.last_frame:
308317 self.last_frame = frame
309318 print(frame, flush=True)
@@ -89,6 +89,16 @@ def foreground(hex_color):
89 return f"\033[38;2;{int(h[0:2], 16)};{int(h[2:4], 16)};{int(h[4:6], 16)}m"89 return f"\033[38;2;{int(h[0:2], 16)};{int(h[2:4], 16)};{int(h[4:6], 16)}m"
90 90
91 91
92+def background(hex_color):
93+ h = hex_color.lstrip("#")
94+ return f"\033[48;2;{int(h[0:2], 16)};{int(h[2:4], 16)};{int(h[4:6], 16)}m"
95+
96+
97+# The bar drops blank cells at the end of a module; one painted with the bar's
98+# own background is kept, and keeps the last icon off the next module.
99+GAP = background(os.environ.get("NEFERBAR_BACKGROUND", "#000000")) + " " + "\033[0m"
100+
101+
92 # --- volume ------------------------------------------------------------------102 # --- volume ------------------------------------------------------------------
93 103
94 class Volume:104 class Volume:
@@ -302,8 +312,7 @@ class Module:
302 def draw(self):312 def draw(self):
303 # One icon per part, separated by a space: part i is at column 2*i.313 # One icon per part, separated by a space: part i is at column 2*i.
304 self.cols = {2 * i: part for i, part in enumerate(self.parts)}314 self.cols = {2 * i: part for i, part in enumerate(self.parts)}
305- # A trailing space keeps the last icon off the next module.315+ frame = " ".join(part.icon() for part in self.parts) + GAP
306- frame = " ".join(part.icon() for part in self.parts) + " "
307 if frame != self.last_frame:316 if frame != self.last_frame:
308 self.last_frame = frame317 self.last_frame = frame
309 print(frame, flush=True)318 print(frame, flush=True)

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