v0.1.0 7deb448

vev-bar-top-right RawHistoryFolder

1#!/bin/sh
2
3# Print a compact, single-line system summary for vev's top-right bar anchor.
4# When available, segments are ordered as CPU, memory, then clock.
5# Segments that cannot be read are omitted without producing stderr.
6
7now=$(date +%H:%M 2>/dev/null || true)
8
9cpu_pct=
10if [ -r /proc/stat ]; then
11	first=$(awk '$1 == "cpu" { idle = $5 + $6; total = 0; for (i = 2; i <= NF; i++) total += $i; print idle, total; exit }' /proc/stat 2>/dev/null || true)
12	sleep 0.1 2>/dev/null || true
13	second=$(awk '$1 == "cpu" { idle = $5 + $6; total = 0; for (i = 2; i <= NF; i++) total += $i; print idle, total; exit }' /proc/stat 2>/dev/null || true)
14	if [ -n "$first" ] && [ -n "$second" ]; then
15		cpu_pct=$(
16			awk -v first="$first" -v second="$second" '
17				BEGIN {
18					split(first, a, " ")
19					split(second, b, " ")
20					idle = b[1] - a[1]
21					total = b[2] - a[2]
22					if (total > 0) printf "%d", ((total - idle) * 100) / total
23				}
24			' 2>/dev/null || true
25		)
26	fi
27fi
28
29mem_pct=
30if [ -r /proc/meminfo ]; then
31	mem_pct=$(
32		awk '
33			$1 == "MemTotal:" { total = $2 }
34			$1 == "MemAvailable:" { available = $2 }
35			END {
36				if (total > 0 && available >= 0) printf "%d", ((total - available) * 100) / total
37			}
38		' /proc/meminfo 2>/dev/null || true
39	)
40fi
41
42line=
43if [ -n "$cpu_pct" ]; then
44	line="C $cpu_pct%"
45fi
46if [ -n "$mem_pct" ]; then
47	if [ -n "$line" ]; then
48		line="$line M $mem_pct%"
49	else
50		line="M $mem_pct%"
51	fi
52fi
53if [ -n "$now" ]; then
54	if [ -n "$line" ]; then
55		line="$line $now"
56	else
57		line="$now"
58	fi
59fi
60
61printf '%s\n' "$line"

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 12

Tags 11

↑↓ moveenter openesc close