Tiny per-segment programs for the strip
status bar. Part of the CHasm suite.
We call them asmites: little pieces of assembly, each a single focused tool that strip composes into a status row. Same idea as i3blocks blocklets or polybar modules, but each is a static x86_64 ELF talking straight to the kernel.
Each program is a single x86_64 NASM source file, no libc, pure syscalls. Each does ONE thing: read some piece of system state, format it, write it to stdout, exit. Static binaries, ~5-13 KB each.
strip spawns these as children on a refresh interval and reads their
stdout. Output may include ANSI SGR escapes (ESC[Nm) for color;
strip parses them and switches GC foreground per text-run.
| Program | Source | What it reports |
|---|---|---|
| date | /proc/uptime + clock_gettime → HH:MM |
wall clock |
| battery | /sys/class/power_supply/BAT*/capacity + status |
percentage + charging glyph |
| cpu | /proc/loadavg |
1-minute load |
| mem | /proc/meminfo |
available memory % |
| disk | statfs(2) on / |
free disk % |
| ip | /proc/net/route + /proc/net/fib_trie |
primary IPv4 |
| net | nl80211 (generic netlink) + cache files | wifi name, public IP, signal %, speed; forks curl only when the network or VPN changes. Shows offline behind a captive portal and asks strip to refresh the moment the Internet works |
| ping | forks ping -c3, parses the average |
ping ms in 3 characters (1K above 999); --updown adds ↕ |
| sep | (no input) | colored separator glyph |
| wintitle | X11 GetInputFocus + GetProperty(_NET_WM_NAME) | focused window title — --length N truncates with mid-string … AND right-pads with spaces so the segment occupies a constant width (lets you put it leftmost without the rest of the bar shifting around) |
Each program builds standalone with the same recipe:
nasm -f elf64 date.asm -o date.o && ld date.o -o date
The top-level Makefile builds them all in one shot.
# ~/.striprc
segment date ~/bin/date 1
segment sep ~/bin/sep
segment battery ~/bin/battery 30
segment sep ~/bin/sep
segment cpu ~/bin/cpu 5
segment tray
segment NAME COMMAND INTERVAL refreshes every INTERVAL seconds.
segment NAME COMMAND runs once at startup (e.g. static separators).
segment NAME for built-ins (tray, title).
- Write
bits/<name>.asmthat prints to stdout and exits. - Add the build target to
Makefile. - Document in this README.
The strip side is language-agnostic — bits programs can be Rust, Go,
Ruby, anything. The asm versions in this repo are the canonical
"this is how you'd do it in pure x86_64" reference.