Просмотр исходного кода

wm: use Adwaita icons for the network and battery status

The top bar still drew its status pictograms with usurf_fill() while the rest of the UI moved to the Adwaita symbolic set.  Import the wired, WiFi signal, offline, phone, battery and AC-adapter symbols and append them to ICON_LIST (24 masks now, ~6.2 KB raw, ~1.3 KB gzip).

uwm_lib generates enum uwm_icon from the same list and adds usurf_icon(), which loads the NBICO1 bundle once per process and blends a tinted mask over the 16/24/32 bpp shadow.  The WM maps wired, WiFi strength, RNDIS and offline to the matching symbols and draws the Adwaita battery outline with a dimmed interior and our level fill; the AC adapter replaces it while on AC.  A WiFi card that is present but not associated now shows the wireless-offline symbol instead of the generic red X.

Update docs/graphics.html and AGENTS.md.
Johannes Zellner 2 дней назад
Родитель
Сommit
a991e68498

+ 24 - 12
AGENTS.md

@@ -448,12 +448,16 @@ it to `0x7E00`.  The kernel region itself only has one wall (`_end` below
   The right-aligned date/time text is itself a click target: `draw_bar()`
   records its rectangle, the pointer highlights it, and a click opens the
   control panel (the `Clock` launcher still opens the analog clock).
-  The rightmost bar item is the AC/battery status icon: a plug while the
-  adapter is online and a level-filled battery on battery.  Hovering it paints
+  The rightmost bar item is the AC/battery status icon: the Adwaita
+  `ac-adapter` symbol while the adapter is online and the `battery` outline
+  with our own level fill inside on battery.  Hovering it paints
   a percentage tooltip below the bar, above every window; clicking it opens
-  the control panel.  To its left is the network status icon: a cable for a
-  wired netdev, signal bars for an associated WiFi link, a USB mark for RNDIS
-  tethering, and a red X otherwise.  The WM polls `SYS_NET_INFO` (and
+  the control panel.  To its left is the network status icon: the Adwaita
+  `network-wired` symbol for a wired netdev, `network-wireless-signal-*` for
+  a WiFi link (by RSSI), the `phone` symbol for RNDIS tethering, and
+  `network-wired-disconnected` in red otherwise (`network-wireless-offline`
+  when a WiFi card is present but not associated).  The WM polls
+  `SYS_NET_INFO` (and
   `SYS_WIFI_STATUS` only while WiFi is active) at 1 Hz.  The whole right
   status area is one click target: the temperature, clock, network and
   AC/battery items and the gaps between them toggle one
@@ -1100,19 +1104,27 @@ it to `0x7E00`.  The kernel region itself only has one wall (`_end` below
   holds the unchanged `*-symbolic.svg` files; `ICON_LIST` (an X-macro in
   `include/icon_abi.h`: enum suffix, short name, theme file) is the icon id
   order and the bundle order, so append only, and it generates
-  `enum ngui_icon` (`NGUI_ICON_FOLDER` .. `NGUI_ICON_MENU`,
-  `NGUI_ICON_COUNT`) and `ngui_icon_name()`.  `tools/mkicons.c` rasterizes
+  `enum ngui_icon` (`NGUI_ICON_FOLDER` .. `NGUI_ICON_NET_USB`,
+  `NGUI_ICON_COUNT`) and `ngui_icon_name()`.  The same list generates
+  `enum uwm_icon` in `uwm_lib.h`, so the ring-3 WM (which does not link
+  ngui) uses the same ids for the bar's network and battery icons.
+  `tools/mkicons.c` rasterizes
   each SVG with the browser's `svg_raster.c` into a 16x16 8-bit coverage
-  mask and writes one `NBICO1` bundle (16-byte header + masks, ~3.3 KB,
-  ~0.8 KB gzip) packed as `icons/adwaita16.icn` in **both** packs.  Its XML
-  reader handles only what symbolic icons use (`<svg viewBox>`, `<g>`,
-  `<path>`, `<rect>`, `<circle>`, `<ellipse>`, fill/fill-rule/opacity) and
+  mask and writes one `NBICO1` bundle (16-byte header + masks, 24 icons,
+  ~6.2 KB, ~1.3 KB gzip) packed as `icons/adwaita16.icn` in **both** packs.
+  Its XML reader handles only what symbolic icons use (`<svg viewBox>`,
+  `<g>`, `<path>`, `<rect>`, `<circle>`, `<ellipse>`,
+  fill/fill-rule/opacity) and
   fails the build on transforms, strokes, `style` or unknown elements.
   `ngui_icon()` reads the bundle once per process into a BSS buffer (not
   the libc heap, so the browser's `heap_reset()` cannot free it; the read is
   capped at the ids this build knows, so a newer bundle with appended icons
   still works) and blends the mask tinted with the caller's colour, centred
-  in the rectangle and clipped.  There is no line-drawn fallback: without
+  in the rectangle and clipped.  `usurf_icon()` in `uwm_lib.c` does the same
+  over the WM's bpp-aware shadow (returning 0 when the bundle is absent);
+  the bar's battery clears the striped `battery` mask's interior to a dim
+  shade of the state colour and draws its level fill over the lower part.
+  There is no line-drawn fallback: without
   the bundle an icon is left blank (the old procedural drawings cost ~2 KB
   of code per app and the floppy has a few hundred bytes to spare).
   `browser-host` symlinks the repository's `icons/` into its `/ramfs` like

+ 4 - 0
assets/icons/adwaita/ac-adapter-symbolic.svg

@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg height="16px" viewBox="0 0 16 16" width="16px" xmlns="http://www.w3.org/2000/svg">
+    <path d="m 7 0 c -1 0 -1 1 -1 1 v 1 h -1 s -0.707031 -0.015625 -1.449219 0.355469 c -0.738281 0.371093 -1.550781 1.3125 -1.550781 2.644531 v 8 s -0.015625 0.707031 0.355469 1.449219 c 0.371093 0.738281 1.3125 1.550781 2.644531 1.550781 h 6 s 0.707031 0.015625 1.449219 -0.355469 c 0.738281 -0.371093 1.550781 -1.3125 1.550781 -2.644531 v -8 c 0 -1.332031 -0.8125 -2.273438 -1.550781 -2.644531 c -0.742188 -0.371094 -1.449219 -0.355469 -1.449219 -0.355469 h -1 v -1 c 0 -1 -1 -1 -1 -1 z m -2 4 h 6 c 0.554688 0 1 0.445312 1 1 v 8 c 0 0.554688 -0.445312 1 -1 1 h -6 c -0.554688 0 -1 -0.445312 -1 -1 v -8 c 0 -0.554688 0.445312 -1 1 -1 z m 3.875 0.992188 c -0.042969 0 -0.082031 0.003906 -0.125 0.007812 c -0.179688 0.050781 -0.34375 0.148438 -0.46875 0.28125 l -3.03125 3 c -0.234375 0.230469 -0.34375 0.582031 -0.28125 0.90625 v 0.8125 h 2.46875 l -1.1875 1.273438 c -0.210938 0.21875 -0.320312 0.539062 -0.28125 0.84375 v 0.09375 v 0.78125 h 1 c 0.265625 0.003906 0.53125 -0.097657 0.71875 -0.28125 l 3 -2.992188 c 0.1875 -0.191406 0.289062 -0.453125 0.28125 -0.71875 c 0.003906 -0.042969 0.003906 -0.082031 0 -0.125 v -0.875 h -2.5625 l 1.3125 -1.28125 c 0.214844 -0.21875 0.320312 -0.539062 0.28125 -0.84375 c 0 -0.03125 0 -0.0625 0 -0.09375 v -0.78125 h -0.9375 c -0.019531 0 -0.042969 0 -0.0625 0 c -0.042969 -0.003906 -0.082031 -0.007812 -0.125 -0.007812 z m 0 0" fill="#2e3434"/>
+</svg>

+ 1 - 0
assets/icons/adwaita/battery-symbolic.svg

@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="16px" height="16px" viewBox="0 0 16 16"><path fill="#2e3434" d="M7 0C6 0 6 1 6 1v1H5s-.707031-.015625-1.449219.355469C2.8125 2.726562 2 3.667969 2 5v8s-.015625.707031.355469 1.449219C2.726562 15.1875 3.667969 16 5 16h6s.707031.015625 1.449219-.355469C13.1875 15.273438 14 14.332031 14 13V5c0-1.332031-.8125-2.273438-1.550781-2.644531C11.707031 1.984375 11 2 11 2h-1V1c0-1-1-1-1-1zM5 4h6c.554688 0 1 .445312 1 1v8c0 .554688-.445312 1-1 1H5c-.554688 0-1-.445312-1-1V5c0-.554688.445312-1 1-1m0 1v2h6V5zm0 3v2h6V8zm0 3v2h6v-2zm0 0"/></svg>

+ 1 - 0
assets/icons/adwaita/network-wired-disconnected-symbolic.svg

@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="16px" height="16px" viewBox="0 0 16 16"><g fill="#2e3436"><path d="M15 10c.265625 0 .519531.105469.707031.292969.390625.390625.390625 1.023437 0 1.414062L14.414062 13l1.292969 1.292969c.390625.390625.390625 1.023437 0 1.414062s-1.023437.390625-1.414062 0L13 14.414062l-1.292969 1.292969c-.390625.390625-1.023437.390625-1.414062 0s-.390625-1.023437 0-1.414062L11.585938 13l-1.292969-1.292969c-.390625-.390625-.390625-1.023437 0-1.414062C10.480469 10.105469 10.734375 10 11 10s.519531.105469.707031.292969L13 11.585938l1.292969-1.292969C14.480469 10.105469 14.734375 10 15 10m0 0"/><path fill-opacity="0.34902" d="M6 0c-.554688 0-1 .445312-1 1v3c0 .554688.445312 1 1 1h1v2H0v2h2v2H1c-.554688 0-1 .445312-1 1v3c0 .554688.445312 1 1 1h4c.554688 0 1-.445312 1-1v-3c0-.554688-.445312-1-1-1H4V9h12V7H9V5h1c.554688 0 1-.445312 1-1V1c0-.554688-.445312-1-1-1zm0 0"/></g></svg>

+ 1 - 0
assets/icons/adwaita/network-wired-symbolic.svg

@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="16px" height="16px" viewBox="0 0 16 16"><path fill="#2e3436" d="M6 .015625c-.554688 0-1 .445313-1 1v3c0 .554687.445312 1 1 1h1v2H0v2h2v2H1c-.554688 0-1 .445313-1 1v3c0 .554687.445312 1 1 1h4c.554688 0 1-.445313 1-1v-3c0-.554687-.445312-1-1-1H4v-2h8v2h-1c-.554688 0-1 .445313-1 1v3c0 .554687.445312 1 1 1h4c.554688 0 1-.445313 1-1v-3c0-.554687-.445312-1-1-1h-1v-2h2v-2H9v-2h1c.554688 0 1-.445313 1-1v-3c0-.554687-.445312-1-1-1zm0 0"/></svg>

+ 1 - 0
assets/icons/adwaita/network-wireless-offline-symbolic.svg

@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="16px" height="16px" viewBox="0 0 16 16"><g fill="#2e3436"><path fill-opacity="0.34902" d="M8 1.992188c-2.617188 0-5.238281.933593-7.195312 2.808593l-.496094.480469c-.398438.378906-.410156 1.011719-.03125 1.410156.382812.398438 1.015625.410156 1.414062.03125l.5-.476562c3.085938-2.957032 8.53125-2.957032 11.617188 0l.5.476562c.398437.378906 1.03125.367188 1.414062-.03125.378906-.398437.367188-1.03125-.03125-1.410156l-.496094-.480469C13.238281 2.925781 10.617188 1.992188 8 1.992188M7.96875 6c-1.570312.011719-3.128906.628906-4.207031 1.8125l-.5.550781c-.375.40625-.347657 1.042969.0625 1.414063s1.042969.339844 1.414062-.070313l.5-.546875c1.242188-1.359375 3.992188-1.488281 5.398438-.125Q10.818359 9 11 9c.53125 0 1.039062.210938 1.414062.585938l.222657.222656c.011719-.011719.023437-.019532.035156-.03125.410156-.371094.441406-1.007813.066406-1.414063l-.5-.550781C11.113281 6.582031 9.535156 5.988281 7.96875 6M8 10c-.511719 0-1.023438.195312-1.414062.585938-.78125.78125-.78125 2.046874 0 2.828124s2.046874.78125 2.828124 0c.210938-.210937.359376-.453124.457032-.714843l-.285156-.285157c-.554688-.554687-.707032-1.367187-.46875-2.070312C8.78125 10.117188 8.390625 10 8 10m0 0"/><path d="M11 10c-.265625 0-.519531.105469-.707031.292969-.390625.390625-.390625 1.023437 0 1.414062L11.585938 13l-1.292969 1.292969c-.390625.390625-.390625 1.023437 0 1.414062s1.023437.390625 1.414062 0L13 14.414062l1.292969 1.292969c.390625.390625 1.023437.390625 1.414062 0s.390625-1.023437 0-1.414062L14.414062 13l1.292969-1.292969c.390625-.390625.390625-1.023437 0-1.414062C15.519531 10.105469 15.265625 10 15 10s-.519531.105469-.707031.292969L13 11.585938l-1.292969-1.292969C11.519531 10.105469 11.265625 10 11 10m0 0"/></g></svg>

+ 1 - 0
assets/icons/adwaita/network-wireless-signal-excellent-symbolic.svg

@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="16px" height="16px" viewBox="0 0 16 16"><path fill="#2e3436" d="M8 1.992188c-2.617188 0-5.238281.933593-7.195312 2.808593l-.496094.480469c-.398438.378906-.410156 1.011719-.03125 1.410156.382812.398438 1.015625.410156 1.414062.03125l.5-.476562c3.085938-2.957032 8.53125-2.957032 11.617188 0l.5.476562c.398437.378906 1.03125.367188 1.414062-.03125.378906-.398437.367188-1.03125-.03125-1.410156l-.496094-.484375C13.238281 2.925781 10.617188 1.992188 8 1.992188M7.96875 6c-1.570312.011719-3.128906.628906-4.207031 1.8125l-.5.550781c-.179688.195313-.277344.453125-.261719.71875.011719.265625.128906.515625.328125.695313.195313.179687.453125.273437.71875.257812.265625-.011718.515625-.128906.695313-.328125l.496093-.546875c1.277344-1.402344 4.160157-1.496094 5.523438.003906l.5.542969c.175781.199219.425781.316407.691406.328125.265625.015625.523437-.078125.722656-.257812.195313-.179688.3125-.429688.324219-.695313.011719-.261719-.082031-.523437-.261719-.71875l-.5-.546875C11.117188 6.582031 9.535156 5.988281 7.96875 6M8 10c-.511719 0-1.023438.195312-1.414062.585938-.78125.78125-.78125 2.046874 0 2.828124s2.046874.78125 2.828124 0 .78125-2.046874 0-2.828124C9.023438 10.195312 8.511719 10 8 10m0 0"/></svg>

+ 1 - 0
assets/icons/adwaita/network-wireless-signal-good-symbolic.svg

@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="16px" height="16px" viewBox="0 0 16 16"><path fill="#2e3436" d="M8 1.992188c-2.617188 0-5.238281.933593-7.195312 2.808593l-.496094.480469c-.398438.378906-.410156 1.011719-.03125 1.410156.382812.398438 1.015625.410156 1.414062.03125l.5-.476562c3.085938-2.957032 8.53125-2.957032 11.617188 0l.5.476562c.398437.378906 1.03125.367188 1.414062-.03125.378906-.398437.367188-1.03125-.03125-1.410156l-.496094-.484375C13.238281 2.925781 10.617188 1.992188 8 1.992188M7.96875 6c-1.570312.011719-3.128906.628906-4.207031 1.8125l-.5.550781c-.179688.195313-.277344.453125-.261719.71875.011719.265625.128906.515625.328125.695313.195313.179687.453125.273437.71875.257812.265625-.011718.515625-.128906.695313-.328125l.496093-.546875c1.277344-1.402344 4.160157-1.496094 5.523438.003906l.5.542969c.175781.199219.425781.316407.691406.328125.265625.015625.523437-.078125.722656-.257812.195313-.179688.3125-.429688.324219-.695313.011719-.261719-.082031-.523437-.261719-.71875l-.5-.546875C11.117188 6.582031 9.535156 5.988281 7.96875 6M8 10c-.511719 0-1.023438.195312-1.414062.585938-.78125.78125-.78125 2.046874 0 2.828124s2.046874.78125 2.828124 0 .78125-2.046874 0-2.828124C9.023438 10.195312 8.511719 10 8 10m0 0"/></svg>

+ 1 - 0
assets/icons/adwaita/network-wireless-signal-none-symbolic.svg

@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="16px" height="16px" viewBox="0 0 16 16"><path fill="#2e3436" fill-opacity="0.34902" d="M8 1.992188c-2.617188 0-5.238281.933593-7.195312 2.808593l-.496094.480469c-.398438.378906-.410156 1.011719-.03125 1.410156.382812.398438 1.015625.410156 1.414062.03125l.5-.476562c3.085938-2.957032 8.53125-2.957032 11.617188 0l.5.476562c.398437.378906 1.03125.367188 1.414062-.03125.378906-.398437.367188-1.03125-.03125-1.410156l-.496094-.480469C13.238281 2.925781 10.617188 1.992188 8 1.992188M7.96875 6c-1.570312.011719-3.128906.628906-4.207031 1.8125l-.5.550781c-.375.40625-.347657 1.042969.0625 1.414063s1.042969.339844 1.414062-.070313l.5-.546875c1.277344-1.402344 4.160157-1.496094 5.523438 0l.5.546875c.371093.410157 1.003906.441407 1.414062.070313.40625-.371094.4375-1.007813.0625-1.414063l-.5-.550781C11.113281 6.582031 9.535156 5.988281 7.96875 6M8 10c-.511719 0-1.023438.195312-1.414062.585938-.78125.78125-.78125 2.046874 0 2.828124s2.046874.78125 2.828124 0 .78125-2.046874 0-2.828124C9.023438 10.195312 8.511719 10 8 10m0 0"/></svg>

+ 1 - 0
assets/icons/adwaita/network-wireless-signal-ok-symbolic.svg

@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="16px" height="16px" viewBox="0 0 16 16"><path fill="#2e3436" d="M7.96875 6c-1.570312.011719-3.128906.628906-4.207031 1.8125l-.5.550781c-.375.40625-.347657 1.042969.066406 1.414063.40625.371094 1.039063.339844 1.414063-.070313l.496093-.546875c1.277344-1.402344 4.160157-1.496094 5.523438.003906l.5.542969c.371093.410157 1.003906.441407 1.414062.070313.40625-.371094.4375-1.007813.0625-1.414063l-.5-.546875C11.117188 6.582031 9.535156 5.988281 7.96875 6M8 10c-.511719 0-1.023438.195312-1.414062.585938-.78125.78125-.78125 2.046874 0 2.828124s2.046874.78125 2.828124 0 .78125-2.046874 0-2.828124C9.023438 10.195312 8.511719 10 8 10m0 0"/><path fill="#2e3434" fill-opacity="0.34902" d="M8 1.992188c-2.617188 0-5.238281.933593-7.195312 2.808593l-.496094.480469c-.398438.378906-.410156 1.011719-.03125 1.410156.382812.398438 1.015625.410156 1.414062.03125l.5-.476562c3.085938-2.957032 8.53125-2.957032 11.617188 0l.5.476562c.398437.378906 1.03125.367188 1.414062-.03125.378906-.398437.367188-1.03125-.03125-1.410156l-.496094-.484375C13.238281 2.925781 10.617188 1.992188 8 1.992188m0 0"/></svg>

+ 1 - 0
assets/icons/adwaita/network-wireless-signal-weak-symbolic.svg

@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="16px" height="16px" viewBox="0 0 16 16"><path fill="#2e3436" d="M8 10c-.511719 0-1.023438.195312-1.414062.585938-.78125.78125-.78125 2.046874 0 2.828124s2.046874.78125 2.828124 0 .78125-2.046874 0-2.828124C9.023438 10.195312 8.511719 10 8 10m0 0"/><path fill="#2e3434" fill-opacity="0.34902" d="M8 1.992188c-2.617188 0-5.238281.933593-7.195312 2.808593l-.496094.480469c-.398438.378906-.410156 1.011719-.03125 1.410156.382812.398438 1.015625.410156 1.414062.03125l.5-.476562c3.085938-2.957032 8.53125-2.957032 11.617188 0l.5.476562c.398437.378906 1.03125.367188 1.414062-.03125.378906-.398437.367188-1.03125-.03125-1.410156l-.496094-.480469C13.238281 2.925781 10.617188 1.992188 8 1.992188M7.96875 6c-1.570312.011719-3.128906.628906-4.207031 1.8125l-.5.550781c-.375.40625-.347657 1.042969.0625 1.414063s1.042969.339844 1.414062-.070313l.5-.546875c1.277344-1.402344 4.160157-1.496094 5.523438 0l.5.546875c.371093.410157 1.003906.441407 1.414062.070313.40625-.371094.4375-1.007813.0625-1.414063l-.5-.550781C11.113281 6.582031 9.535156 5.988281 7.96875 6m0 0"/></svg>

+ 1 - 0
assets/icons/adwaita/phone-symbolic.svg

@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="16px" height="16px" viewBox="0 0 16 16"><path fill="#2e3436" d="M5 0C3.355469 0 2 1.355469 2 3v10c0 1.644531 1.355469 3 3 3h6c1.644531 0 3-1.355469 3-3V3c0-1.644531-1.355469-3-3-3zm0 2h6c.570312 0 1 .429688 1 1v10c0 .554688-.445312 1-1 1H5c-.554688 0-1-.445312-1-1V3c0-.570312.429688-1 1-1m0 0"/><path fill="#222" fill-opacity="0.34902" d="M5.5 12c-.277344 0-.5.222656-.5.5s.222656.5.5.5h5c.277344 0 .5-.222656.5-.5s-.222656-.5-.5-.5zm0 0"/></svg>

+ 18 - 11
docs/graphics.html

@@ -148,9 +148,11 @@
 			The WM is a process that owns the desktop and a fixed array of eight
 			windows. It draws a system bar with the banner, launcher buttons,
 			clock, the temperature, and, on ThinkPads and Chromebooks, an
-			AC/battery status icon at the far right (a plug on AC, a
-			level-filled battery on battery, with a percentage tooltip below
-			the bar on hover, painted above the windows), plus draggable
+			AC/battery status icon at the far right (the Adwaita
+			<code>ac-adapter</code> symbol on AC, and the <code>battery</code>
+			outline with our own level fill inside on battery, with a
+			percentage tooltip below the bar on hover, painted above the
+			windows), plus draggable
 			terminal and canvas windows with a title bar and close button.
 			A normal window has no visible frame; an invisible resize band
 			(1 px inside, 3 px outside its outer edge) is the resize grab
@@ -158,9 +160,13 @@
 			colour.
 			Click-to-focus, drag-by-title-bar and close are routed through the
 			same pointer path. To the left of the rightmost AC/battery status
-			icon, a network status icon shows a
-			cable for wired Ethernet, signal bars for a connected WiFi link, a
-			USB mark for RNDIS tethering, or a red X when no link is up.
+			icon, a network status icon shows the Adwaita
+			<code>network-wired</code> symbol for wired Ethernet, a
+			<code>network-wireless-signal-*</code> symbol for a connected WiFi
+			link, the <code>phone</code> symbol for RNDIS tethering, and
+			<code>network-wired-disconnected</code> in red when no NIC is
+			active (<code>network-wireless-offline</code> when a WiFi card is
+			present but not associated).
 			The whole right status area — temperature, date/time, network
 			and AC/battery items plus the gaps between them — is one button:
 			it opens the anchored <code>bin/netmenu</code> control panel (a
@@ -461,7 +467,8 @@
 		<p>
 			ngui's icons (<code>ngui_icon()</code>, <code>ngui_icon_button()</code>:
 			back/forward, reload and home in the browser toolbar, folder/file/drive
-			in <code>files</code>) are GNOME Adwaita symbolic icons
+			in <code>files</code>) and the WM's top-bar network/battery
+			indicators are GNOME Adwaita symbolic icons
 			(adwaita-icon-theme 51, LGPL-3 or CC-BY-SA-3.0).  The unchanged
 			<code>*-symbolic.svg</code> files live in
 			<span class="file">assets/icons/adwaita/</span>; the host tool
@@ -470,13 +477,13 @@
 			8-bit coverage mask and writes one <code>NBICO1</code> bundle,
 			<code>/ramfs/icons/adwaita16.icn</code> (layout in
 			<span class="file">include/icon_abi.h</span>): a 16-byte header and
-			13 masks, ~3.3&nbsp;KB raw and ~0.8&nbsp;KB gzip, so both the USB
+			24 masks, ~6.2&nbsp;KB raw and ~1.3&nbsp;KB gzip, so both the USB
 			and the floppy pack carry it.
 		</p>
 		<ul>
-			<li><strong>Icon list.</strong> <code>ICON_LIST</code> is an X-macro of enum suffix, short name and theme file.  Its order is the icon id and the bundle order (append only); it generates <code>enum ngui_icon</code> and <code>ngui_icon_name()</code>, and the gallery shows every entry.</li>
-			<li><strong>Tinting.</strong> Symbolic icons are one colour, so only coverage is stored.  <code>ngui_icon()</code> blends the mask in the caller's colour (the theme text colour on buttons, <code>icon_folder</code>/<code>icon_disk</code>/<code>icon_file</code> in <code>files</code>), centred and clipped.</li>
-			<li><strong>Loading.</strong> Each process reads the bundle once into a BSS buffer, so the browser's <code>heap_reset()</code> cannot free it.  The read is capped at the ids the app was built with, so an older app still works with a newer bundle.  Without the bundle the icon is left blank; there is no line-drawn fallback, because it cost ~2&nbsp;KB of code in each app.</li>
+			<li><strong>Icon list.</strong> <code>ICON_LIST</code> is an X-macro of enum suffix, short name and theme file.  Its order is the icon id and the bundle order (append only); it generates <code>enum ngui_icon</code> and <code>ngui_icon_name()</code>, and the gallery shows every entry.  <code>uwm_lib.h</code> applies the same list to <code>enum uwm_icon</code>, so the ring-3 WM can use ids without linking ngui.</li>
+			<li><strong>Tinting.</strong> Symbolic icons are one colour, so only coverage is stored.  <code>ngui_icon()</code> blends the mask in the caller's colour (the theme text colour on buttons, <code>icon_folder</code>/<code>icon_disk</code>/<code>icon_file</code> in <code>files</code>), centred and clipped.  <code>usurf_icon()</code> does the same over the WM's 16/24/32 bpp shadow.  The bar's battery clears the striped <code>battery</code> mask's interior to a quarter-brightness shade and draws its level fill over the lower part, so the gauge reads at 16&nbsp;px.</li>
+			<li><strong>Loading.</strong> Each process (every ngui app and the WM) reads the bundle once into a BSS buffer, so the browser's <code>heap_reset()</code> cannot free it.  The read is capped at the ids the process was built with, so an older app still works with a newer bundle.  Without the bundle the icon is left blank; there is no line-drawn fallback, because it cost ~2&nbsp;KB of code in each app.</li>
 			<li><strong>Strict converter.</strong> mkicons reads only what symbolic icons use (<code>&lt;svg viewBox&gt;</code>, <code>&lt;g&gt;</code>, <code>&lt;path&gt;</code>, <code>&lt;rect&gt;</code>, <code>&lt;circle&gt;</code>, <code>&lt;ellipse&gt;</code>, fill, fill-rule, opacity) and fails the build on transforms, strokes, <code>style</code> or unknown elements instead of drawing a wrong icon.  <code>./mkicons assets/icons/adwaita 16 out.icn -v</code> prints an ASCII preview of every mask.</li>
 		</ul>
 	</section>

+ 19 - 4
include/icon_abi.h

@@ -1,8 +1,9 @@
 /* UI icons and the NBICO1 icon bundle.
  *
- * Shared by ngui (user/lib/ngui: enum ngui_icon, ngui_icon()) and the host
- * tool tools/mkicons.c, which rasterizes the Adwaita symbolic SVGs in
- * assets/icons/adwaita/ into /ramfs/icons/adwaita16.icn.
+ * Shared by ngui (user/lib/ngui: enum ngui_icon, ngui_icon()), the WM's
+ * uwm_lib (enum uwm_icon, usurf_icon()) and the host tool tools/mkicons.c,
+ * which rasterizes the Adwaita symbolic SVGs in assets/icons/adwaita/ into
+ * /ramfs/icons/adwaita16.icn.
  *
  * ICON_LIST is an X-macro: X(ENUM_SUFFIX, "short name", "theme file").  The
  * order is the icon id and the order of the masks in the bundle, so append
@@ -23,7 +24,21 @@
 	X(STOP,          "stop",    "process-stop-symbolic")   \
 	X(CLOSE,         "close",   "window-close-symbolic")   \
 	X(SEARCH,        "search",  "system-search-symbolic")  \
-	X(MENU,          "menu",    "open-menu-symbolic")
+	X(MENU,          "menu",    "open-menu-symbolic")      \
+	X(BATTERY,       "battery", "battery-symbolic")         \
+	X(AC,            "ac",      "ac-adapter-symbolic")      \
+	X(NET_WIRED,     "wired",   "network-wired-symbolic")   \
+	X(NET_WIRED_OFF, "wired-off", "network-wired-disconnected-symbolic") \
+	X(NET_WIFI_0,    "wifi-0",  "network-wireless-signal-none-symbolic") \
+	X(NET_WIFI_1,    "wifi-1",  "network-wireless-signal-weak-symbolic") \
+	X(NET_WIFI_2,    "wifi-2",  "network-wireless-signal-ok-symbolic")   \
+	X(NET_WIFI_3,    "wifi-3",  "network-wireless-signal-good-symbolic") \
+	X(NET_WIFI_4,    "wifi-4",  "network-wireless-signal-excellent-symbolic") \
+	X(NET_WIFI_OFF,  "wifi-off", "network-wireless-offline-symbolic") \
+	X(NET_USB,       "usb",     "phone-symbolic")
+
+/* The NBICO1 bundle, read by ngui and the WM's uwm_lib. */
+#define ICON_BUNDLE_PATH "/ramfs/icons/adwaita16.icn"
 
 /* ---- NBICO1 bundle ------------------------------------------------------
  * [struct icon_file_hdr][count x size*size coverage bytes]

+ 49 - 69
user/apps/wm/ucmd_wm.c

@@ -71,10 +71,11 @@ static int bar_temp_c = -1;
 static int bar_batt_pct = -1;
 static int bar_batt_charging;
 static int bar_ac_online = -1;
-/* Battery/AC status icon: a plug on AC, a level-filled battery otherwise.
- * The rightmost bar item; hovering it shows a percentage tooltip below it. */
+/* Battery/AC status icon: the Adwaita AC adapter on AC, the battery outline
+ * with our own level fill otherwise.  The rightmost bar item; hovering it
+ * shows a percentage tooltip below it. */
 #define BAR_PWR_W 24
-#define BAR_PWR_Y 6
+#define BAR_PWR_Y 7
 #define BAR_TIP_H 20
 static int bar_pwr_x = -1;
 static int bar_pwr_hot;
@@ -110,7 +111,7 @@ static unsigned int stat_frames, stat_ms, stat_px, stat_max, stat_last;
 
 /* Network status icon (right side of the bar). */
 #define BAR_NET_W 24
-#define BAR_NET_Y 6
+#define BAR_NET_Y 7
 #define BAR_NET_NONE  0
 #define BAR_NET_WIRED 1
 #define BAR_NET_WIFI  2
@@ -216,60 +217,28 @@ static int net_rssi_bars(int rssi)
 	return 1;
 }
 
-/* Small top-bar pictograms, drawn directly into the shadow. */
-static void bar_icon_cable(int x, int y, unsigned int c)
-{
-	usurf_fill(&screen, x + 1, y + 6, 9, 8, c);
-	usurf_fill(&screen, x + 3, y + 8, 2, 2, COL_BG);
-	usurf_fill(&screen, x + 6, y + 8, 2, 2, COL_BG);
-	usurf_fill(&screen, x + 10, y + 9, 7, 2, c);
-	usurf_fill(&screen, x + 17, y + 5, 5, 10, c);
-	usurf_fill(&screen, x + 19, y + 7, 2, 3, COL_BG);
-}
-
-static void bar_icon_wifi(int x, int y, unsigned int c, int bars)
-{
-	int i;
-
-	for (i = 0; i < 4; i++) {
-		int h = 3 + i * 3;
-
-		usurf_fill(&screen, x + 3 + i * 5, y + 16 - h, 3, h,
-			   i < bars ? c : 0x4A4A5Au);
-	}
-}
-
-static void bar_icon_x(int x, int y, unsigned int c)
-{
-	int i;
-
-	for (i = 0; i < 12; i++) {
-		usurf_fill(&screen, x + 6 + i, y + 4 + i, 2, 2, c);
-		usurf_fill(&screen, x + 17 - i, y + 4 + i, 2, 2, c);
-	}
-}
-
-static void bar_icon_usb(int x, int y, unsigned int c)
-{
-	usurf_text(&screen, x + 1, y + 1, "USB", c, 0, 0, fbw, WM_BAR_H);
-}
-
+/* Small top-bar pictograms: Adwaita symbolic masks from the pack, centered
+ * in their 24 px hit slots. */
 static void bar_draw_net_icon(int x, int y)
 {
+	enum uwm_icon ic;
+
 	switch (bar_net_kind) {
 	case BAR_NET_WIRED:
-		bar_icon_cable(x, y, bar_net_color);
+		ic = UWM_ICON_NET_WIRED;
 		break;
 	case BAR_NET_WIFI:
-		bar_icon_wifi(x, y, bar_net_color, bar_net_bars);
+		ic = bar_net_bars > 0 ? UWM_ICON_NET_WIFI_0 + bar_net_bars :
+					UWM_ICON_NET_WIFI_OFF;
 		break;
 	case BAR_NET_USB:
-		bar_icon_usb(x, y, bar_net_color);
+		ic = UWM_ICON_NET_USB;
 		break;
 	default:
-		bar_icon_x(x, y, bar_net_color);
+		ic = UWM_ICON_NET_WIRED_OFF;
 		break;
 	}
+	(void)usurf_icon(&screen, x + 4, y, ic, bar_net_color);
 }
 
 /* 1 Hz poll: cached state -> the bar's network icon.  The WiFi status call is
@@ -291,11 +260,18 @@ static int poll_net_status(void)
 			struct sys_wifi_status ws;
 
 			if (u_wifi(SYS_WIFI_STATUS, (int)&ws, 0) == 0 &&
-			    ws.present && ws.state >= SYS_WIFI_ST_ASSOC) {
+			    ws.present) {
 				kind = BAR_NET_WIFI;
-				bars = net_rssi_bars(ws.rssi);
-				color = (ws.state >= SYS_WIFI_ST_LINK && have_ip) ?
-					0x55FF55u : 0xFFD250u;
+				if (ws.state >= SYS_WIFI_ST_ASSOC) {
+					bars = net_rssi_bars(ws.rssi);
+					color = (ws.state >= SYS_WIFI_ST_LINK &&
+						 have_ip) ?
+						0x55FF55u : 0xFFD250u;
+				} else {
+					/* Card present, not associated. */
+					bars = 0;
+					color = 0xFF5050u;
+				}
 			}
 		} else if (name_is(ni.name, "rndis")) {
 			kind = BAR_NET_USB;
@@ -360,31 +336,35 @@ static unsigned int batt_color(int pct)
 	return 0x55FF55u;
 }
 
-/* Battery pictogram: outline, terminal and a fill proportional to the
- * percentage.  A critical charge turns the outline red as well. */
+/* Battery: the Adwaita outline with our own level fill over the lower
+ * interior.  The symbol's body is striped, so the interior is cleared to a
+ * dim shade of the state colour first; the level then reads as a bright
+ * block inside the outline.  A critical charge turns the outline red too.
+ * Geometry of battery-symbolic at 16 px: body x2..13, cavity x4..11 and
+ * y4..13. */
+static unsigned int batt_dim(unsigned int c)
+{
+	return (c >> 2) & 0x3F3F3F;
+}
+
 static void bar_icon_battery(int x, int y, int pct, unsigned int c)
 {
-	unsigned int frame = c;
-	unsigned int fill = (unsigned int)((14 * pct + 99) / 100);
+	unsigned int fill = (unsigned int)((10 * pct + 99) / 100);
+	int ix = x + 4;
 
-	usurf_fill(&screen, x + 1, y + 2, 18, 2, frame);
-	usurf_fill(&screen, x + 1, y + 14, 18, 2, frame);
-	usurf_fill(&screen, x + 1, y + 2, 2, 14, frame);
-	usurf_fill(&screen, x + 17, y + 2, 2, 14, frame);
-	usurf_fill(&screen, x + 19, y + 6, 3, 6, frame);
-	if (fill > 14)
-		fill = 14;
+	if (fill > 10)
+		fill = 10;
+	if (!usurf_icon(&screen, ix, y, UWM_ICON_BATTERY, c))
+		return;
+	usurf_fill(&screen, ix + 4, y + 4, 8, 10, batt_dim(c));
 	if (fill)
-		usurf_fill(&screen, x + 3, y + 4, fill, 10, c);
+		usurf_fill(&screen, ix + 4, y + 14 - (int)fill, 8, fill, c);
 }
 
-/* AC plug pictogram: two prongs and the body, kept compact in height. */
-static void bar_icon_plug(int x, int y, unsigned int c)
+/* AC adapter: the Adwaita plug symbol. */
+static void bar_icon_ac(int x, int y, unsigned int c)
 {
-	usurf_fill(&screen, x + 7, y + 2, 3, 5, c);
-	usurf_fill(&screen, x + 14, y + 2, 3, 5, c);
-	usurf_fill(&screen, x + 5, y + 7, 14, 7, c);
-	usurf_fill(&screen, x + 7, y + 9, 10, 3, COL_BG);
+	(void)usurf_icon(&screen, x + 4, y, UWM_ICON_AC, c);
 }
 
 /* Percentage tooltip: a small box below the status icon.  It is drawn after
@@ -515,7 +495,7 @@ static void draw_bar(void)
 						   BAR_PWR_W + 6,
 						   WM_BAR_H - 7, 0x3A3A55u);
 				if (bar_ac_online > 0)
-					bar_icon_plug(px, BAR_PWR_Y, 0x55FF55u);
+					bar_icon_ac(px, BAR_PWR_Y, 0x55FF55u);
 				else
 					bar_icon_battery(px, BAR_PWR_Y,
 							 bar_batt_pct,

+ 1 - 1
user/lib/ngui/ngui.h

@@ -82,7 +82,7 @@ enum ngui_icon {
 };
 #undef NGUI_ICON_ENUM_
 
-#define NGUI_ICON_PATH "/ramfs/icons/adwaita16.icn"
+#define NGUI_ICON_PATH ICON_BUNDLE_PATH
 
 /* Short display name of an icon ("folder", "back", ...). */
 const char *ngui_icon_name(enum ngui_icon icon);

+ 111 - 0
user/lib/uwm/uwm_lib.c

@@ -2,6 +2,7 @@
  * fbtext/gfx byte order so the mapped shadow matches the kernel console. */
 
 #include "uwm_lib.h"
+#include "ucmd_lib.h"
 #include "font_8x16.h"
 #include "ufont.h"
 
@@ -31,6 +32,116 @@ void usurf_init(struct usurf *s, void *px, unsigned int w, unsigned int h,
 	s->font_px = 16;
 }
 
+/* ---- Adwaita icon masks ------------------------------------------------
+ * /ramfs/icons/adwaita16.icn (NBICO1, include/icon_abi.h): one 8-bit
+ * coverage mask per icon, tinted and blended over the surface.  Loaded once
+ * per process into BSS, like ngui's copy, so a page heap reset or a pack
+ * swap cannot leave a dangling pointer. */
+#define UWM_ICON_PX    16
+#define UWM_ICON_BYTES (UWM_ICON_PX * UWM_ICON_PX)
+
+static unsigned char icon_data[sizeof(struct icon_file_hdr) +
+			       UWM_ICON_COUNT * UWM_ICON_BYTES + 512];
+static int icon_state;          /* 0 untried, 1 loaded, -1 unavailable */
+static unsigned int icon_count;
+
+static void icon_load(void)
+{
+	const struct icon_file_hdr *h = (const struct icon_file_hdr *)icon_data;
+	unsigned int max = sizeof(icon_data) - 512, have;
+	int n, i;
+
+	icon_state = -1;
+	/* The FAT path may write a final partial sector past `max`; the
+	 * buffer keeps 512 bytes of slack for it. */
+	n = u_syscall3(SYS_READ_FILE, (int)ICON_BUNDLE_PATH, (int)icon_data,
+		       (int)max);
+	if (n < (int)sizeof(*h))
+		return;
+	for (i = 0; i < 8; i++)
+		if (h->magic[i] != ICON_FILE_MAGIC[i])
+			return;
+	if (h->size != UWM_ICON_PX)
+		return;
+	have = ((unsigned int)n - sizeof(*h)) / UWM_ICON_BYTES;
+	if (have > h->count)
+		have = h->count;
+	if (have > UWM_ICON_COUNT)
+		have = UWM_ICON_COUNT;
+	icon_count = have;
+	icon_state = 1;
+}
+
+static const unsigned char *icon_mask(unsigned int icon)
+{
+	if (icon_state == 0)
+		icon_load();
+	if (icon_state != 1 || icon >= icon_count)
+		return 0;
+	return icon_data + sizeof(struct icon_file_hdr) +
+		icon * UWM_ICON_BYTES;
+}
+
+/* Tint a coverage mask with `rgb` and blend it over the canvas. */
+int usurf_icon(struct usurf *s, int x, int y, enum uwm_icon icon,
+	       unsigned int rgb)
+{
+	const unsigned char *m = icon_mask((unsigned int)icon);
+	unsigned int sr = (rgb >> 16) & 0xFF;
+	unsigned int sg = (rgb >> 8) & 0xFF;
+	unsigned int sb = rgb & 0xFF;
+	int i, j;
+
+	if (!s || !s->px || !m)
+		return 0;
+	for (j = 0; j < UWM_ICON_PX; j++) {
+		int py = y + j;
+		unsigned char *row;
+
+		if (py < 0 || py >= (int)s->h)
+			continue;
+		row = s->px + (unsigned long)py * s->pitch;
+		for (i = 0; i < UWM_ICON_PX; i++) {
+			int px = x + i, a = m[j * UWM_ICON_PX + i];
+			unsigned int dr, dg, db;
+
+			if (!a || px < 0 || px >= (int)s->w)
+				continue;
+			usurf_pixels++;
+			if (s->bpp == 16) {
+				unsigned short *d = (unsigned short *)row + px;
+				unsigned int v = *d;
+
+				dr = ((v >> 11) & 0x1F) << 3;
+				dg = ((v >> 5) & 0x3F) << 2;
+				db = (v & 0x1F) << 3;
+				dr = (dr * (255 - a) + sr * a + 127) / 255;
+				dg = (dg * (255 - a) + sg * a + 127) / 255;
+				db = (db * (255 - a) + sb * a + 127) / 255;
+				*d = (unsigned short)(((dr >> 3) << 11) |
+						      ((dg >> 2) << 5) |
+						      (db >> 3));
+			} else {
+				unsigned char *p = row + px * (s->bpp / 8);
+
+				/* BGR(A) byte order, like put_px(). */
+				dr = p[2];
+				dg = p[1];
+				db = p[0];
+				p[0] = (unsigned char)((db * (255 - a) +
+							sb * a + 127) / 255);
+				p[1] = (unsigned char)((dg * (255 - a) +
+							sg * a + 127) / 255);
+				p[2] = (unsigned char)((dr * (255 - a) +
+							sr * a + 127) / 255);
+				if (s->bpp == 32)
+					p[3] = 0xFF;
+			}
+		}
+	}
+	return 1;
+}
+
 void usurf_font_attach(struct usurf *s, const char *path, int px)
 {
 	if (!s)

+ 18 - 2
user/lib/uwm/uwm_lib.h

@@ -1,11 +1,23 @@
 /* Small userland drawing library for the ring-3 WM: bpp-aware fills, copies,
- * 8x8 glyphs, VGA cell grids and RGB565 canvas blits.  No kernel dependencies;
- * the WM maps the shadow buffer and calls these functions directly. */
+ * 8x8 glyphs, VGA cell grids, RGB565 canvas blits and the Adwaita icon masks.
+ * No kernel dependencies; the WM maps the shadow buffer and calls these
+ * functions directly. */
 #ifndef UWM_LIB_H
 #define UWM_LIB_H
 
+#include "icon_abi.h"
+
 struct ufont_face;
 
+/* Icon ids from the same list the ngui tools use; the order is the bundle
+ * order.  The WM does not link ngui, so it generates its own ids. */
+#define UWM_ICON_ENUM_(e, name, file) UWM_ICON_##e,
+enum uwm_icon {
+	ICON_LIST(UWM_ICON_ENUM_)
+	UWM_ICON_COUNT
+};
+#undef UWM_ICON_ENUM_
+
 struct usurf {
 	unsigned char *px;
 	unsigned int w, h, pitch;
@@ -44,5 +56,9 @@ void usurf_cells(struct usurf *s, const unsigned short *cells,
 void usurf_canvas(struct usurf *s, const struct uwm_canvas *c,
 		  int x0, int y0,
 		  int cx, int cy, unsigned int cw, unsigned int ch);
+/* Blit one 16x16 Adwaita coverage mask, tinted with `rgb`, blended over the
+ * surface.  Returns 0 when the bundle (or that id) is not available. */
+int usurf_icon(struct usurf *s, int x, int y, enum uwm_icon icon,
+	       unsigned int rgb);
 
 #endif