ソースを参照

wm: refine the start menu and bar buttons

Drop the start menu's summary card so Applications is the first row.  Make the clock, temperature, network and battery labels one status button with one hover pill; only that cluster is clickable and the battery tooltip is gone.

Render the start and status buttons through one shared helper with the same height, radius and active colour, stopping above the rainbow separator.  Update the docs and AGENTS.md map.
Johannes Zellner 2 日 前
親
コミット
c3dfecba91
5 ファイル変更、339 行追加、384 行削除
  1. 31 25
      AGENTS.md
  2. 1 1
      docs/cpu.html
  3. 3 4
      docs/drivers.html
  4. 25 19
      docs/graphics.html
  5. 279 335
      user/apps/wm/ucmd_wm.c

+ 31 - 25
AGENTS.md

@@ -514,36 +514,42 @@ it to `0x7E00`.  The kernel region itself only has one wall (`_end` below
   start a scrollbar drag.  The kernel hit-test uses the same order.
   The NebOS banner in the top-left corner is the start button.  Clicking it
   opens the WM's Windows-like start menu, a flat overlay panel drawn by the
-  WM (not a window, so it does not consume a `WM_MAX_WINDOWS` slot).  It
-  lists every self-contained GUI app in the pack -- Terminal, Files, Web,
-  Gallery, Chat, Clock, Text editor, Colors, Mines, Cards, Disks, Tasks,
-  Settings and Date & Time -- with a coloured letter tile and a hover
-  highlight, shrinks its row height to fit short panels, and closes on an
-  outside press.  The last row, Power, opens a submenu with Reboot and Power
-  off; both spawn the privileged kernel command through `SYS_SPAWN_KCMD`
-  with no tty.  The menu
-  floats above every window and is redrawn with the bar tooltip and OSD
-  overlays.  The bar notice and the right-aligned status never draw left of
-  `WM_BAR_LEFT_END` (`wm_abi.h`).
-  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
+  WM (not a window, so it does not consume a `WM_MAX_WINDOWS` slot).  It is
+  styled like the netmenu popover: a borderless `theme.bg` surface whose
+  first row is the dim `Applications` caption, `theme.panel_alt` hover rows
+  and a rounded Power tile.  It lists every self-contained GUI app in the
+  pack -- Terminal, Files, Web, Gallery, Chat, Clock, Text editor, Colors,
+  Mines, Cards, Disks, Tasks, Settings and Date & Time -- with a coloured
+  letter tile and a hover highlight, shrinks its row height to fit short
+  panels, and closes on an outside press.  The last row, Power, opens a
+  submenu with Reboot and Power off; both spawn the privileged kernel
+  command through `SYS_SPAWN_KCMD` with no tty.  The menu floats above every
+  window and is redrawn with the brightness OSD overlay.  The bar notice and
+  the right-aligned status never draw left of `WM_BAR_LEFT_END`
+  (`wm_abi.h`).
+  The right status cluster is a single button, not one per label.
+  `draw_bar()` records the rectangle from the leftmost temperature/clock item
+  through the rightmost AC/battery icon, paints one rounded hover pill behind
+  the whole cluster, and only that rectangle is clickable; the empty bar
+  between the start button and the cluster does nothing.  Both bar buttons
+  share the same `BAR_BTN_Y`/`BAR_BTN_H` geometry and rounded style, so their
+  pills stop one pixel above the rainbow separator; both turn selection-blue
+  while their panel is open.  A click anywhere in the cluster opens the
   control panel (whose Date & Time section has the editor; the start menu's
   Clock entry opens the analog clock).
   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: the Adwaita
+  with our own level fill inside on battery.  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
-  `/ramfs/bin/netmenu` control popover, anchored flush against the bottom of
-  the top bar and the right screen edge (`u_wm_set_geom`).  It opens
+  status cluster toggles one `/ramfs/bin/netmenu` control popover, anchored
+  flush against the bottom of the top bar and the right screen edge
+  (`u_wm_set_geom`).  It opens
   collapsed: the battery/clock summary and
   the Quick settings pills are visible, while the network, power-mode and
   date/time settings are hidden until their pill is clicked.  A pill toggles
@@ -558,7 +564,7 @@ it to `0x7E00`.  The kernel region itself only has one wall (`_end` below
   window starts its content one title bar below the origin; a popover uses
   the origin directly).  An outside press dismisses the
   popover and then continues with the normal click handling; a second click
-  on a status target toggles it.
+  on the status cluster toggles it.
   The start menu entries spawn the same pack binaries (`Chat` ->
   `/ramfs/bin/chat`, `Tasks` -> `/ramfs/bin/process`, `Disks` ->
   `/ramfs/bin/disks`, ...).  When the full date/time would cross
@@ -915,7 +921,7 @@ it to `0x7E00`.  The kernel region itself only has one wall (`_end` below
   failure.  Every receive/send goes through `netdev_rx_frame()`/
   `netdev_tx_frame()`, which keep the 32-bit frame byte counters behind
   `SYS_NET_INFO.rx_bytes/tx_bytes` (the `process` monitor's network graph).
-  The top-bar status area opens `ucmd_netmenu.c`, the control
+  The top-bar status cluster opens `ucmd_netmenu.c`, the control
   panel.  It lists every present driver through `SYS_NET_DEVLIST` (111),
   selects one
   through `SYS_NET_SELECT` (112) and runs DHCP; the same popover lists scanned
@@ -1179,7 +1185,7 @@ it to `0x7E00`.  The kernel region itself only has one wall (`_end` below
   overrides with resize arrows on the resize band and while
   resizing, the move cross during a title-bar drag
   (once it moved), and a hand over the start button, the start menu and the
-  status area.  ngui
+  status cluster.  ngui
   resets `ui->cursor` to the arrow for every redrawn frame (begin returned
   1), `ngui_text_input` asks for the I-beam (not-allowed when disabled),
   apps use `ngui_cursor_rect()`/`ngui_set_cursor()`, and `ngui_end_ex()`
@@ -1377,8 +1383,8 @@ it to `0x7E00`.  The kernel region itself only has one wall (`_end` below
   Tcase-max = 85.2 °C, so `sensors` prints the raw delta and the 90/100/125 °C
   scales as well as the top bar's bare `43C` before the clock and, on
   ThinkPads and the HP Chromebook, the AC/battery icon at the far right (a
-  plug while on AC, a level-filled battery on battery, with a percentage
-  tooltip below it on hover) and `cpuinfo`'s value plus EIST state.
+  plug while on AC, a level-filled battery on battery) and `cpuinfo`'s value
+  plus EIST state.
   AMD family 15h models below `0x60` (Bulldozer/Piledriver, the FX-6350)
   read Tctl from `D18F3xA4` at PCI `0:18.3`: `raw = val >> 21`, `raw * 125`
   m°C, minus 49 °C when bits 17:16 are both set, TjMax 70 °C.  The probe

+ 1 - 1
docs/cpu.html

@@ -366,7 +366,7 @@
 			<li><strong>Nehalem/Westmere P-states.</strong> <code>power_init</code> enables SpeedStep, raises the package C-state limit to C6 when unlocked, reads min/max ratios from <code>PLATFORM_INFO</code> and starts at the maximum non-turbo ratio. The target ratio goes in bits 15:8 of <code>IA32_PERF_CTL</code> with the low byte zero.</li>
 			<li><strong>Airmont/Braswell P-states.</strong> Family 6 model <code>0x4C</code> reads the Atom ratio/VID MSRs (<code>0x66A..0x66D</code>), <code>MSR_FSB_FREQ</code> and the FSB table. The N3060 reports pstates 6..20, BCLK 80 MHz (1600 MHz nominal), turbo pstate 31 (2480 MHz) and VID 0x2D..0x3C. <code>power_init</code> enters at max non-turbo and the governor drops to pstate 6 (480 MHz); <code>IA32_PERF_CTL</code> carries the pstate in 15:8 and the Linux-interpolated VID in 7:0. Turbo is detected but not requested. The probe deliberately avoids package/power-SKU MSRs; an unsupported <code>rdmsr</code> before the IDT triple-faults.</li>
 			<li><strong>Governor.</strong> A 100 ms window picks min/max/linear target pstates; short busy streaks jump to max immediately. Each CPU writes its own <code>IA32_PERF_CTL</code>; <code>cpufreq [auto|min|max|off|&lt;pstate&gt;]</code> overrides it, and <code>SYS_CPUFREQ</code> exposes the same auto/min/max/off mode to the control panel's Power mode tile.</li>
-			<li><strong>Telemetry.</strong> <code>power</code> prints effective MHz from APERF/MPERF, the current/requested pstate and, on Airmont, the FSB, nominal MHz, turbo pstate/VID, VID range and live <code>PERF_CTL</code>; <code>sensors</code> prints the CPU temperature, board sensors and both EC types; <code>powerinfo</code> prints the AC adapter and battery state, and the WM top bar shows the temperature plus a far-right AC plug or level-filled battery icon (percentage tooltip below it on hover) on ThinkPads and Chromebooks.</li>
+			<li><strong>Telemetry.</strong> <code>power</code> prints effective MHz from APERF/MPERF, the current/requested pstate and, on Airmont, the FSB, nominal MHz, turbo pstate/VID, VID range and live <code>PERF_CTL</code>; <code>sensors</code> prints the CPU temperature, board sensors and both EC types; <code>powerinfo</code> prints the AC adapter and battery state, and the WM top bar shows the temperature plus a far-right AC plug or level-filled battery icon on ThinkPads and Chromebooks.</li>
 			<li><strong>Thermal.</strong> On Intel, each CPU samples its DTS once a second from its scheduler tick; the hottest core is exposed to ring 3. TjMax comes from <code>IA32_TEMPERATURE_TARGET</code> on Nehalem/Westmere, the coretemp 90 °C table on Airmont, and the Bonnell table on older Atoms. On AMD family 15h models below <code>0x60</code> (Bulldozer/Piledriver/Steamroller), <span class="file">thermal.c</span> reads the package Tctl from <code>D18F3xA4</code> at PCI <code>0:18.3</code> (k10temp's <code>(raw × 125) m°C</code>, with the 49 °C range offset when bits 17:16 are both set) and publishes it to every CPU from the kworker under the BKL; PCI config space is deliberately not touched from the per-CPU timer interrupt.</li>
 			<li><strong>Limits.</strong> Package C-states/S0ix remain firmware-managed; Airmont reports no C3/C6 residency and does not request the turbo pstate. The explicit <code>idle c6</code> override is the Nehalem <code>0x20</code> hint; use <code>idle auto</code> for the Airmont C6N (<code>0x58</code>) path.</li>
 		</ul>

+ 3 - 4
docs/drivers.html

@@ -640,10 +640,9 @@
 			<code>power</code> prints ratios, effective MHz and C-state hints.
 			The WM top bar shows the CPU temperature and, on both ThinkPads
 			and Chromebooks, a status icon at the far right for the first
-			present battery: a plug while the AC adapter is online, a
-			level-filled battery on battery, with a percentage tooltip below
-			the icon on hover.  The tooltip is painted after the windows, so
-			it always stays on top.  Machines without an EC show neither.
+			present battery: a plug while the AC adapter is online and a
+			level-filled battery on battery.  Machines without an EC show
+			neither.
 		</p>
 	</section>
 

+ 25 - 19
docs/graphics.html

@@ -150,9 +150,8 @@
 			clock, the temperature, and, on ThinkPads and Chromebooks, an
 			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
+			outline with our own level fill inside on battery), 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
@@ -167,10 +166,14 @@
 			<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
-			second click closes it).
+			The whole right status cluster — temperature, date/time,
+			network and AC/battery items plus the gaps between them — is
+			one button with a single rounded hover pill; the empty bar
+			between the start button and the cluster is not clickable. Both
+			bar buttons use the same height and rounded style, stopping just
+			above the rainbow separator, and turn selection-blue while their
+			panel is open. It opens the anchored <code>bin/netmenu</code>
+			control panel (a second click closes it).
 			It opens collapsed: the battery/clock summary and Quick settings
 			pills are visible, while the network, power-mode and date/time
 			settings stay hidden until their pill is clicked.  Present NICs
@@ -182,16 +185,19 @@
 			The NebOS banner in the top-left is the start button. Clicking it
 			opens a Windows-like start menu drawn by the WM as a flat overlay,
 			not a window, so it floats above every canvas without consuming a
-			window slot. Every self-contained GUI application in the pack
-			gets a row with a coloured letter tile — Terminal, Files, Web,
-			Gallery, Chat, Clock, Text editor, Colors, Mines, Cards, Disks,
-			Tasks, Settings and Date &amp; Time — the pointer highlights the
-			hovered row, and an outside press dismisses the panel. Row height
-			shrinks to keep the whole list inside the work area on short
-			panels. The last row,
-			Power, opens a submenu with Reboot and Power off; both run the
-			privileged kernel command through <code>SYS_SPAWN_KCMD</code>. The
-			bar notice and the right-aligned status never draw left of
+			window slot. The panel uses the control panel's theme: a flat
+			<code>theme.bg</code> surface with no rim, a dim
+			<code>Applications</code> caption as its first row, rounded hover
+			rows and a rounded Power tile. Every self-contained GUI
+			application in the pack gets a row with a coloured letter tile —
+			Terminal, Files, Web, Gallery, Chat, Clock, Text editor, Colors,
+			Mines, Cards, Disks, Tasks, Settings and Date &amp; Time — the
+			pointer highlights the hovered row, and an outside press dismisses
+			the panel. Row height shrinks to keep the whole list inside the
+			work area on short panels. The last row, Power, opens a submenu
+			with Reboot and Power off; both run the privileged kernel command
+			through <code>SYS_SPAWN_KCMD</code>. The bar notice and the
+			right-aligned status never draw left of
 			<code>WM_BAR_LEFT_END</code>.
 		</p>
 		<p>
@@ -205,7 +211,7 @@
 			panel. The kernel uses the window origin for content-relative
 			pointer and scroll coordinates. An outside press dismisses the
 			popover and the click then continues normally; a second click on
-			any status target toggles it. The panel itself is drawn with the
+			the status cluster toggles it. The panel itself is drawn with the
 			ngui components: a battery/AC and clock summary, a brightness
 			slider when the panel PWM is present, and Quick settings tiles for
 			Network, the CPU power mode (<code>SYS_CPUFREQ</code>) and Date
@@ -528,7 +534,7 @@
 		</p>
 		<ul>
 			<li><strong>Loading.</strong> <span class="file">cursor.c</span> copies the bundle out of the ramfs into its own pages after <code>ramfs_init()</code> and after every <code>ramfs_replace()</code> (the old pack is freed), then tells <span class="file">mouse.c</span> to re-fetch its image.</li>
-			<li><strong>Selection.</strong> On every <code>SYS_WM_POLL</code> the window server resolves the shape: the WM's override (<code>SYS_WM_SET_CURSOR</code>: resize arrows on the resize band and while resizing, the move cross during a title-bar drag, a hand over the start button, the start menu and the status area), else the cursor of the window holding the pointer capture, else the content cursor (<code>SYS_WIN_SET_CURSOR</code>) of the window under the pointer, else the arrow.</li>
+			<li><strong>Selection.</strong> On every <code>SYS_WM_POLL</code> the window server resolves the shape: the WM's override (<code>SYS_WM_SET_CURSOR</code>: resize arrows on the resize band and while resizing, the move cross during a title-bar drag, a hand over the start button, the start menu and the status cluster), else the cursor of the window holding the pointer capture, else the content cursor (<code>SYS_WIN_SET_CURSOR</code>) of the window under the pointer, else the arrow.</li>
 			<li><strong>Clients.</strong> ngui resets the cursor to the arrow for each redrawn frame, a hovered text field asks for the I-beam, <code>ngui_cursor_rect()</code>/<code>ngui_set_cursor()</code> serve apps, and <code>ngui_end_ex()</code> sends it when it changed.  The terminal uses the I-beam; the browser maps the inherited CSS <code>cursor</code> property and, for <code>auto</code>, a hand over links, an I-beam over text fields and the progress arrow while a page loads.  The gallery's Cursors section shows every shape.</li>
 			<li><strong>Drawing.</strong> <code>cur_x</code>/<code>cur_y</code> stay the hotspot; the image's top-left is the hotspot minus the image's hotspot and may be off-screen.  The software cursor saves up to 32&times;32 pixels under it and blends the premultiplied pixels over them.  Intel Ironlake and Radeon copy the ARGB image into their 64&times;64 planes (Intel uses CURPOS sign bits for negative positions and follows the matching primary plane's gamma enable, because the display palette is after the plane blender and a cursor-only gamma pass brightens its antialiased edges on a VBE mode whose primary bypasses the palette; Radeon uses <code>HORZ_VERT_OFF</code> plus a shifted <code>CUR_OFFSET</code>); Cirrus reduces it to its two colours and clamps the position at 0.  Animated frames advance from <code>mouse_poll_update()</code>.</li>
 		</ul>

+ 279 - 335
user/apps/wm/ucmd_wm.c

@@ -75,21 +75,22 @@ static int bar_temp_c = -1;
 static int bar_batt_pct = -1;
 static int bar_batt_charging;
 static int bar_ac_online = -1;
+/* Both top-bar buttons share this geometry: one rounded pill that stops one
+ * pixel above the rainbow separator (which starts at WM_BAR_H - 5). */
+#define BAR_BTN_Y 2
+#define BAR_BTN_H 22
+#define BAR_BTN_RADIUS 6
+
 /* 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. */
+ * with our own level fill otherwise.  The rightmost bar item. */
 #define BAR_PWR_W 24
 #define BAR_PWR_Y 7
-#define BAR_TIP_H 20
-static int bar_pwr_x = -1;
-static int bar_pwr_hot;
-static int bar_pwr_tip_x = -1;
-static int bar_pwr_tip_y;
-static unsigned int bar_pwr_tip_w, bar_pwr_tip_h;
-static int bar_pwr_tip_want;       /* tooltip computed for this frame */
-static int bar_pwr_tip_on;         /* tooltip pixels currently on screen */
-static int bar_pwr_tip_on_x, bar_pwr_tip_on_y;
-static unsigned int bar_pwr_tip_on_w, bar_pwr_tip_on_h;
+/* The clock, temperature, network and AC/battery labels are one status
+ * button.  draw_bar() records their bounding rectangle; only that rectangle
+ * opens the control panel, so the empty part of the bar is not clickable. */
+static int bar_status_x = -1;
+static unsigned int bar_status_w;
+static int bar_status_hot;
 /* Brightness OSD: a centered bubble shown after the kernel's backlight
  * seq changes, then hidden after OSD_MS. */
 #define OSD_MS    3000
@@ -106,11 +107,6 @@ static unsigned int osd_w, osd_h;
 static char bar_msg[24];
 static unsigned int bar_msg_until;
 static int bar_msg_dirty;
-/* Rectangle of the right-aligned date/time text, so a click there can open
- * the Date & Time app.  w == 0 means "not drawn" (e.g. kexec banner). */
-static int bar_clock_x = -1;
-static unsigned int bar_clock_w;
-static int bar_clock_hot;
 static unsigned int stat_frames, stat_ms, stat_px, stat_max, stat_last;
 
 /* ---- Start menu --------------------------------------------------------
@@ -120,12 +116,28 @@ static unsigned int stat_frames, stat_ms, stat_px, stat_max, stat_last;
  * lists every GUI app in the pack and ends with a Power row whose submenu
  * reboots or powers off the machine through the privileged kernel command
  * registry (SYS_SPAWN_KCMD). */
-#define SM_W        236
-#define SM_ROW_H    30
-#define SM_MIN_ROW  18
-#define SM_HDR_H    44
-#define SM_SEP_H    7
-#define SM_SUB_W    152
+/* The panel mirrors ngui_theme_dark and the netmenu popover: a flat
+ * theme.bg surface without a rim, rounded theme.panel summary cards,
+ * theme.panel_alt hover rows and the selection colour for an active item. */
+#define SM_BG       0x181C28u
+#define SM_PANEL    0x262B3Au
+#define SM_PANEL_ALT 0x32384Au
+#define SM_TEXT     0xE4E6F0u
+#define SM_TEXT_DIM 0x9197AAu
+#define SM_SEL      0x365CA6u
+#define SM_BTN_HOT  0x46516Cu
+#define SM_ERROR    0xEE7474u
+
+#define SM_W        252
+#define SM_PAD      12
+#define SM_TOP      10
+#define SM_GAP      6
+#define SM_SECT_H   22
+#define SM_ROW_H    26
+#define SM_MIN_ROW  20
+#define SM_BOTTOM   10
+#define SM_RADIUS   6
+#define SM_SUB_W    160
 #define SM_TILE     18
 
 #define SM_HIT_NONE     (-1)
@@ -133,6 +145,7 @@ static unsigned int stat_frames, stat_ms, stat_px, stat_max, stat_last;
 #define SM_HIT_POWER    (-3)
 #define SM_HIT_REBOOT   (-4)
 #define SM_HIT_POWEROFF (-5)
+#define SM_HIT_MENU     (-6)   /* inside the panel but not on an entry */
 
 #define SM_ACT_SPAWN    0
 #define SM_ACT_TERM     1
@@ -171,6 +184,8 @@ static const struct sm_app sm_apps[] = {
 struct sm_layout {
 	int x, y, w, h;
 	int row_h;
+	int sect_y;
+	int row_x, row_w;
 	int list_y;
 	int power_y;
 	int sub_x, sub_y, sub_w, sub_h;
@@ -196,9 +211,6 @@ static void sm_launch(int idx);
 #define BAR_NET_WIRED 1
 #define BAR_NET_WIFI  2
 #define BAR_NET_USB   3
-static int bar_net_x = -1;
-static unsigned int bar_net_w;
-static int bar_net_hot;
 static int bar_net_kind;
 static int bar_net_bars;
 static unsigned int bar_net_color = 0xFF5050u;
@@ -284,14 +296,102 @@ static void fill_clip(int x, int y, unsigned int w, unsigned int h,
 			   (unsigned int)(y1 - y0), rgb);
 }
 
+/* Rounded rectangle fill, matching ngui_fill_round_rect()'s pixel-centre
+ * corner sampling (the popover's cards and tiles use a 6 px radius). */
+static int sm_isqrt(int v)
+{
+	int r = 0, bit = 1 << 30;
+
+	if (v <= 0)
+		return 0;
+	while (bit > v)
+		bit >>= 2;
+	while (bit) {
+		if (v >= r + bit) {
+			v -= r + bit;
+			r = (r >> 1) + bit;
+		} else {
+			r >>= 1;
+		}
+		bit >>= 2;
+	}
+	return r;
+}
+
+static int sm_round_inset(int y, int h, int r)
+{
+	int dy2, d2;
+
+	if (r <= 0)
+		return 0;
+	if (y < r)
+		dy2 = 2 * r - 2 * y - 1;
+	else if (y >= h - r)
+		dy2 = 2 * (y - (h - r)) + 1;
+	else
+		return 0;
+	d2 = 4 * r * r - dy2 * dy2;
+	if (d2 < 0)
+		d2 = 0;
+	return r - (sm_isqrt(d2) + 1) / 2;
+}
+
+static void sm_fill_round(int x, int y, int w, int h, int r,
+			  unsigned int rgb)
+{
+	int yy, half;
+
+	if (w <= 0 || h <= 0)
+		return;
+	half = w < h ? w / 2 : h / 2;
+	if (r > half)
+		r = half;
+	if (r <= 0) {
+		usurf_fill(&screen, x, y, (unsigned int)w, (unsigned int)h,
+			   rgb);
+		return;
+	}
+	for (yy = 0; yy < h; yy++) {
+		int li = 0, ri = 0;
+
+		if (yy < r) {
+			li = sm_round_inset(yy, h, r);
+			ri = li;
+		}
+		if (yy >= h - r) {
+			int i = sm_round_inset(yy, h, r);
+
+			if (i > li)
+				li = i;
+			if (i > ri)
+				ri = i;
+		}
+		if (w - li - ri > 0)
+			usurf_fill(&screen, x + li, y + yy,
+				   (unsigned int)(w - li - ri), 1, rgb);
+	}
+}
+
+/* One shared renderer for the start and status buttons: the same height,
+ * corner radius and hover/active colours. */
+static void bar_button_bg(int x, int w, int active, int hot)
+{
+	if (active)
+		sm_fill_round(x, BAR_BTN_Y, w, BAR_BTN_H, BAR_BTN_RADIUS,
+			      SM_SEL);
+	else if (hot)
+		sm_fill_round(x, BAR_BTN_Y, w, BAR_BTN_H, BAR_BTN_RADIUS,
+			      SM_PANEL_ALT);
+}
+
 /* The NebOS banner doubles as the start button.  Its width follows the
  * proportional font, so the hit area and the highlight use the same
  * geometry. */
 static void bar_start_geom(int *x, int *y, int *w, int *h)
 {
 	*x = 2;
-	*y = 2;
-	*h = WM_BAR_H - 6;
+	*y = BAR_BTN_Y;
+	*h = BAR_BTN_H;
 	*w = (int)usurf_text_width(&screen, OS_NAME " v" OS_VERSION) + 20;
 }
 
@@ -309,13 +409,9 @@ static void bar_start_button(void)
 	int x, y, w, h;
 
 	bar_start_geom(&x, &y, &w, &h);
-	if (sm_open || sm_start_hot) {
-		usurf_fill(&screen, x, y, w, h,
-			   sm_open ? 0x365CA6u : 0x3A3A55u);
-		usurf_fill(&screen, x + 2, y + h - 2, w - 4, 2,
-			   sm_open ? 0x55FF55u : 0x70709Au);
-	}
-	usurf_text(&screen, x + 10, y + 4, OS_NAME " v" OS_VERSION,
+	bar_button_bg(x, w, sm_open, sm_start_hot);
+	usurf_text(&screen, x + 10, y + (h - 16) / 2,
+		   OS_NAME " v" OS_VERSION,
 		   sm_open ? COL_WHITE : COL_BANNER, 0, 0, fbw, WM_BAR_H);
 }
 
@@ -438,21 +534,6 @@ static unsigned int temp_text(char *b, int c)
 	return n;
 }
 
-/* "87%" (no libc printf here). */
-static unsigned int pct_text(char *b, int pct)
-{
-	unsigned int n = 0, v = (unsigned int)pct;
-
-	if (v >= 100)
-		b[n++] = (char)('0' + (v / 100) % 10);
-	if (v >= 10)
-		b[n++] = (char)('0' + (v / 10) % 10);
-	b[n++] = (char)('0' + v % 10);
-	b[n++] = '%';
-	b[n] = '\0';
-	return n;
-}
-
 static unsigned int batt_color(int pct)
 {
 	if (pct <= 10)
@@ -491,49 +572,6 @@ static void bar_icon_ac(int x, int y, unsigned int c)
 	(void)usurf_icon(&screen, x + 4, y, UWM_ICON_AC, c);
 }
 
-/* Percentage tooltip: a small box below the status icon.  It is drawn after
- * the windows (see bar_tooltip_overlay), so it always sits on top. */
-static void bar_draw_tooltip(void)
-{
-	char lb[8];
-	unsigned int lw;
-	int tx;
-
-	if (!bar_pwr_tip_want || bar_pwr_tip_x < 0)
-		return;
-	usurf_fill(&screen, bar_pwr_tip_x, bar_pwr_tip_y,
-		   bar_pwr_tip_w, bar_pwr_tip_h, 0x161622u);
-	usurf_fill(&screen, bar_pwr_tip_x, bar_pwr_tip_y,
-		   bar_pwr_tip_w, 1, 0x646464u);
-	usurf_fill(&screen, bar_pwr_tip_x,
-		   bar_pwr_tip_y + (int)bar_pwr_tip_h - 1,
-		   bar_pwr_tip_w, 1, 0x646464u);
-	usurf_fill(&screen, bar_pwr_tip_x, bar_pwr_tip_y,
-		   1, bar_pwr_tip_h, 0x646464u);
-	usurf_fill(&screen, bar_pwr_tip_x + (int)bar_pwr_tip_w - 1,
-		   bar_pwr_tip_y, 1, bar_pwr_tip_h, 0x646464u);
-	(void)pct_text(lb, bar_batt_pct);
-	lw = usurf_text_width(&screen, lb);
-	tx = bar_pwr_tip_x + ((int)bar_pwr_tip_w - (int)lw) / 2;
-	usurf_text(&screen, tx, bar_pwr_tip_y + 3, lb,
-		   batt_color(bar_batt_pct), 0, 0, fbw, fbh);
-}
-
-/* Publish the geometry computed by draw_bar() and redraw the tooltip. */
-static void bar_tooltip_commit(void)
-{
-	if (bar_pwr_tip_want) {
-		bar_draw_tooltip();
-		bar_pwr_tip_on = 1;
-		bar_pwr_tip_on_x = bar_pwr_tip_x;
-		bar_pwr_tip_on_y = bar_pwr_tip_y;
-		bar_pwr_tip_on_w = bar_pwr_tip_w;
-		bar_pwr_tip_on_h = bar_pwr_tip_h;
-	} else {
-		bar_pwr_tip_on = 0;
-	}
-}
-
 static void draw_bar(void)
 {
 	char dt[48];
@@ -559,14 +597,8 @@ static void draw_bar(void)
 		unsigned int dots = bar_kexec_total ?
 			(bar_kexec_progress * 12 / bar_kexec_total) : 0;
 
-		bar_clock_x = -1;
-		bar_clock_w = 0;
-		bar_clock_hot = 0;
-		bar_net_x = -1;
-		bar_net_w = 0;
-		bar_pwr_x = -1;
-		bar_pwr_tip_x = -1;
-		bar_pwr_tip_want = 0;
+		bar_status_x = -1;
+		bar_status_w = 0;
 		n = 0;
 		while (msg[n])
 			dt[n] = msg[n], n++;
@@ -578,117 +610,96 @@ static void draw_bar(void)
 			   (int)fbw - (int)usurf_text_width(&screen, dt) - 4,
 			   5, dt, 0xFFC864u, 0, 0, fbw, WM_BAR_H);
 	} else {
-		unsigned int clock_chars = 0;
 		int right = (int)fbw - 4;
 		int min_x = (int)WM_BAR_LEFT_END + 4;
-
-		bar_clock_x = -1;
-		bar_clock_w = 0;
-		bar_net_x = -1;
-		bar_net_w = 0;
-		bar_pwr_x = -1;
-		bar_pwr_tip_x = -1;
-		bar_pwr_tip_want = 0;
-		/* The AC/battery status icon is the rightmost item. */
+		int pwr_px = -1, net_nx = -1, clock_tx = -1, temp_tx = -1;
+		int temp_tw;
+		int left;
+		char cdt[12], tb[12];
+		const char *clock_txt = dt;
+
+		/* Lay the cluster out right to left: AC/battery, network, the
+		 * date/time and the CPU temperature. */
 		if (bar_batt_pct >= 0 || bar_ac_online > 0) {
-			int px = right - BAR_PWR_W;
-
-			if (px >= min_x) {
-				if (bar_pwr_hot)
-					usurf_fill(&screen, px - 3, 2,
-						   BAR_PWR_W + 6,
-						   WM_BAR_H - 7, 0x3A3A55u);
-				if (bar_ac_online > 0)
-					bar_icon_ac(px, BAR_PWR_Y, 0x55FF55u);
-				else
-					bar_icon_battery(px, BAR_PWR_Y,
-							 bar_batt_pct,
-							 batt_color(bar_batt_pct));
-				bar_pwr_x = px;
-				right = px - 8;
-				if (bar_pwr_hot && bar_batt_pct >= 0) {
-					char lb[8];
-					unsigned int lw, bw;
-					int bx;
-
-					(void)pct_text(lb, bar_batt_pct);
-					lw = usurf_text_width(&screen, lb);
-					bw = lw + 10;
-					bx = px + BAR_PWR_W - (int)bw;
-					if (bx < 4)
-						bx = 4;
-					if (bx + (int)bw > (int)fbw - 4)
-						bx = (int)fbw - 4 - (int)bw;
-					bar_pwr_tip_x = bx;
-					bar_pwr_tip_y = WM_BAR_H + 2;
-					bar_pwr_tip_w = bw;
-					bar_pwr_tip_h = BAR_TIP_H;
-					bar_pwr_tip_want = 1;
-				}
-			}
-		}
-		/* The network status sits to the left of the power icon, so it
-		 * survives narrow screens and a full temperature cluster. */
-		{
-			int nx = right - BAR_NET_W;
-
-			if (nx >= min_x) {
-				if (bar_net_hot)
-					usurf_fill(&screen, nx - 3, 2,
-						   BAR_NET_W + 6,
-						   WM_BAR_H - 7, 0x3A3A55u);
-				bar_draw_net_icon(nx, BAR_NET_Y);
-				bar_net_x = nx;
-				bar_net_w = BAR_NET_W;
-				right = nx - 8;
-			}
+			pwr_px = right - BAR_PWR_W;
+			if (pwr_px >= min_x)
+				right = pwr_px - 8;
+			else
+				pwr_px = -1;
 		}
+		net_nx = right - BAR_NET_W;
+		if (net_nx >= min_x)
+			right = net_nx - 8;
+		else
+			net_nx = -1;
 		if (u_rtc_datetime(dt, sizeof(dt)) == 0) {
-			char cdt[12];
-			const char *txt = dt;
 			int tw = (int)usurf_text_width(&screen, dt);
 			int tx = right - tw;
-			unsigned int i;
+			unsigned int k;
 
 			if (tx < min_x) {
 				/* Compact form "MM-DD HH:MM" from
-				 * "YYYY-MM-DD HH:MM:SS" when the launcher row is
-				 * too wide for the full date. */
-				for (i = 0; i < 11 && dt[5 + i]; i++)
-					cdt[i] = dt[5 + i];
-				cdt[i] = '\0';
-				txt = cdt;
+				 * "YYYY-MM-DD HH:MM:SS" when the status
+				 * cluster is too wide for the full date. */
+				for (k = 0; k < 11 && dt[5 + k]; k++)
+					cdt[k] = dt[5 + k];
+				cdt[k] = '\0';
+				clock_txt = cdt;
 				tw = (int)usurf_text_width(&screen, cdt);
 				tx = right - tw;
 			}
 			if (tx >= min_x) {
-				bar_clock_x = tx;
-				bar_clock_w = (unsigned int)tw;
-				if (bar_clock_hot)
-					usurf_fill(&screen, tx - 5, 2,
-						   (unsigned int)tw + 10,
-						   WM_BAR_H - 7, 0x3A3A55u);
-				usurf_text(&screen, tx, 5, txt, COL_BANNER, 0, 0,
-					   fbw, WM_BAR_H);
-				clock_chars = (unsigned int)tw;
+				clock_tx = tx;
+				right = tx - 8;
 			}
 		}
-		if (clock_chars)
-			right -= (int)clock_chars + 8;
 		if (bar_temp_c >= 0) {
-			char tb[12];
-			int tx;
-
 			(void)temp_text(tb, bar_temp_c);
-			tx = right - (int)usurf_text_width(&screen, tb);
+			temp_tw = (int)usurf_text_width(&screen, tb);
+			temp_tx = right - temp_tw;
+			if (temp_tx < min_x)
+				temp_tx = -1;
+		}
 
-			if (tx >= min_x) {
-				usurf_text(&screen, tx, 5, tb,
-					   temp_color(bar_temp_c), 0, 0,
-					   fbw, WM_BAR_H);
-				right = tx - 8;
-			}
+		/* The status labels form one click target: record the whole
+		 * cluster and paint one rounded hover pill behind it. */
+		left = pwr_px;
+		if (net_nx >= 0)
+			left = net_nx;
+		if (clock_tx >= 0)
+			left = clock_tx;
+		if (temp_tx >= 0)
+			left = temp_tx;
+		if (left >= 0) {
+			bar_status_x = left - 4;
+			if (bar_status_x < 0)
+				bar_status_x = 0;
+			bar_status_w = (unsigned int)((int)fbw - 2 -
+						      bar_status_x);
+			bar_button_bg(bar_status_x, (int)bar_status_w,
+				      control_pid > 0, bar_status_hot);
+		} else {
+			bar_status_x = -1;
+			bar_status_w = 0;
+		}
+
+		if (pwr_px >= 0) {
+			if (bar_ac_online > 0)
+				bar_icon_ac(pwr_px, BAR_PWR_Y, 0x55FF55u);
+			else
+				bar_icon_battery(pwr_px, BAR_PWR_Y,
+						 bar_batt_pct,
+						 batt_color(bar_batt_pct));
 		}
+		if (net_nx >= 0)
+			bar_draw_net_icon(net_nx, BAR_NET_Y);
+		if (clock_tx >= 0)
+			usurf_text(&screen, clock_tx, 5, clock_txt, COL_BANNER,
+				   0, 0, fbw, WM_BAR_H);
+		if (temp_tx >= 0)
+			usurf_text(&screen, temp_tx, 5, tb,
+				   temp_color(bar_temp_c), 0, 0, fbw,
+				   WM_BAR_H);
 	}
 }
 
@@ -1086,16 +1097,6 @@ static void add_rect(struct wm_present_info *p, int x, int y,
 	}
 }
 
-/* Redraw the power tooltip above whatever a render pass just painted. */
-static void bar_tooltip_overlay(struct wm_present_info *p)
-{
-	if (!bar_pwr_tip_on || !bar_pwr_tip_want)
-		return;
-	bar_draw_tooltip();
-	add_rect(p, bar_pwr_tip_on_x, bar_pwr_tip_on_y,
-		 bar_pwr_tip_on_w, bar_pwr_tip_on_h);
-}
-
 /* Center the brightness bubble in the work area, clamped on small screens. */
 static void osd_geom(void)
 {
@@ -1177,11 +1178,10 @@ static void osd_draw(void)
 		   0xFFD250u);
 }
 
-/* Put the power tooltip and the brightness OSD back on top after a render
- * pass that may have overwritten them. */
+/* Put the brightness OSD and the start menu back on top after a render pass
+ * that may have overwritten them. */
 static void wm_overlays(struct wm_present_info *p)
 {
-	bar_tooltip_overlay(p);
 	if (osd_show) {
 		osd_draw();
 		add_rect(p, osd_x, osd_y, osd_w, osd_h);
@@ -1410,70 +1410,49 @@ static void resist_geom(struct uwin *u, int idx, int *nx, int *ny)
 
 /* The top-bar date/time text is also a button: it opens the Date & Time
  * editor.  The rectangle is recorded by draw_bar(). */
-static int bar_clock_hit(unsigned int mx, unsigned int my)
-{
-	return bar_clock_w && bar_clock_x >= 0 && my < WM_BAR_H &&
-	       (int)mx >= bar_clock_x - 5 &&
-	       (int)mx < bar_clock_x + (int)bar_clock_w + 5;
-}
-
-static int bar_net_hit(unsigned int mx, unsigned int my)
-{
-	return bar_net_w && bar_net_x >= 0 && my < WM_BAR_H &&
-	       (int)mx >= bar_net_x - 3 &&
-	       (int)mx < bar_net_x + (int)bar_net_w + 3;
-}
-
-/* The AC/battery icon opens the control panel on a click; hovering it also
- * reveals the percentage tooltip below it.  The tooltip area keeps the hover
- * alive but is not a click target. */
-static int bar_pwr_hit(unsigned int mx, unsigned int my)
-{
-	if (my >= WM_BAR_H)
-		return bar_pwr_tip_on &&
-		       (int)mx >= bar_pwr_tip_on_x &&
-		       (int)mx < bar_pwr_tip_on_x + (int)bar_pwr_tip_on_w &&
-		       (int)my >= bar_pwr_tip_on_y &&
-		       (int)my < bar_pwr_tip_on_y + (int)bar_pwr_tip_on_h;
-	return bar_pwr_x >= 0 &&
-	       (int)mx >= bar_pwr_x - 3 &&
-	       (int)mx < bar_pwr_x + BAR_PWR_W + 3;
-}
-
-/* The whole right status area is one button: the clock, temperature, network
- * and power items plus the gaps between them.  The start button ends well
- * before WM_BAR_LEFT_END, so this never overlaps it. */
+/* The whole right status cluster is one button: the clock, temperature,
+ * network and power items plus the gaps between them.  Only the rectangle
+ * draw_bar() recorded is clickable, so the empty bar between the start
+ * button and the cluster does nothing. */
 static int bar_status_hit(unsigned int mx, unsigned int my)
 {
-	return my < WM_BAR_H && (int)mx >= WM_BAR_LEFT_END + 4;
+	return bar_status_w && bar_status_x >= 0 &&
+	       (int)my >= BAR_BTN_Y && (int)my < BAR_BTN_Y + BAR_BTN_H &&
+	       (int)mx >= bar_status_x &&
+	       (int)mx < bar_status_x + (int)bar_status_w;
 }
 
 static void sm_layout_get(struct sm_layout *l)
 {
 	int avail = (int)fbh - WM_BAR_H - 8;
 	int row = SM_ROW_H;
-	int total = SM_HDR_H + SM_NAPP * row + SM_SEP_H + row;
+	int total = SM_TOP + SM_SECT_H + SM_NAPP * row + SM_GAP + row +
+		    SM_BOTTOM;
 
 	/* Shrink the rows to the work area, so a 540-600 px panel still fits
 	 * the whole list.  The low bound is the smallest legible row. */
 	while (row > SM_MIN_ROW && total > avail) {
 		row--;
-		total = SM_HDR_H + SM_NAPP * row + SM_SEP_H + row;
+		total = SM_TOP + SM_SECT_H + SM_NAPP * row + SM_GAP + row +
+			SM_BOTTOM;
 	}
 	l->x = 4;
 	l->y = WM_BAR_H + 2;
 	l->w = SM_W;
 	l->h = total;
 	l->row_h = row;
-	l->list_y = l->y + SM_HDR_H;
-	l->power_y = l->list_y + SM_NAPP * row + SM_SEP_H;
+	l->sect_y = l->y + SM_TOP;
+	l->row_x = l->x + SM_PAD;
+	l->row_w = l->w - 2 * SM_PAD;
+	l->list_y = l->sect_y + SM_SECT_H;
+	l->power_y = l->list_y + SM_NAPP * row + SM_GAP;
 
 	l->sub_w = SM_SUB_W;
-	l->sub_h = 2 * row + 4;
-	l->sub_x = l->x + l->w + 2;
+	l->sub_h = 2 * row + 8;
+	l->sub_x = l->x + l->w + 4;
 	if (l->sub_x + l->sub_w > (int)fbw - 2) {
-		if (l->x - l->sub_w - 2 >= 0)
-			l->sub_x = l->x - l->sub_w - 2;
+		if (l->x - l->sub_w - 4 >= 0)
+			l->sub_x = l->x - l->sub_w - 4;
 		else
 			l->sub_x = (int)fbw - 2 - l->sub_w;
 	}
@@ -1488,15 +1467,6 @@ static void sm_layout_get(struct sm_layout *l)
 		l->sub_y = 0;
 }
 
-static void sm_frame(int x, int y, int w, int h)
-{
-	usurf_fill(&screen, x, y, (unsigned int)w, (unsigned int)h, 0x161622u);
-	usurf_fill(&screen, x, y, (unsigned int)w, 1, 0x5A5A7Au);
-	usurf_fill(&screen, x, y + h - 1, (unsigned int)w, 1, 0x5A5A7Au);
-	usurf_fill(&screen, x, y, 1, (unsigned int)h, 0x5A5A7Au);
-	usurf_fill(&screen, x + w - 1, y, 1, (unsigned int)h, 0x5A5A7Au);
-}
-
 static void sm_tile(int x, int y, int size, unsigned int rgb, char letter)
 {
 	char s[2];
@@ -1506,7 +1476,7 @@ static void sm_tile(int x, int y, int size, unsigned int rgb, char letter)
 		size = 12;
 	s[0] = letter;
 	s[1] = '\0';
-	usurf_fill(&screen, x, y, (unsigned int)size, (unsigned int)size, rgb);
+	sm_fill_round(x, y, size, size, 4, rgb);
 	tw = (int)usurf_text_width(&screen, s);
 	tx = x + (size - tw) / 2;
 	ty = y + (size - 16) / 2;
@@ -1519,77 +1489,76 @@ static void sm_draw_app(int i, const struct sm_layout *l)
 	const struct sm_app *a = &sm_apps[i];
 	int ry = l->list_y + i * l->row_h;
 	int ty = ry + (l->row_h - 16) / 2;
-	int tile = l->row_h - 4;
+	int tile = l->row_h - 8;
 
 	if (tile > SM_TILE)
 		tile = SM_TILE;
 	if (sm_hot == i)
-		usurf_fill(&screen, l->x + 4, ry + 1, l->w - 8,
-			   (unsigned int)(l->row_h - 2), 0x365CA6u);
-	sm_tile(l->x + 10, ry + (l->row_h - tile) / 2, tile,
+		sm_fill_round(l->row_x, ry + 1, l->row_w,
+			      l->row_h - 2, SM_RADIUS, SM_PANEL_ALT);
+	sm_tile(l->row_x + 10, ry + (l->row_h - tile) / 2, tile,
 		a->tile, a->letter);
-	usurf_text(&screen, l->x + 36, ty, a->label,
-		   sm_hot == i ? COL_WHITE : 0xE8E8F6u,
-		   l->x, l->y, l->w, l->h);
+	usurf_text(&screen, l->row_x + 36, ty, a->label, SM_TEXT,
+		   l->x, l->y, (unsigned int)l->w, (unsigned int)l->h);
 }
 
 static void sm_draw(void)
 {
 	struct sm_layout l;
-	unsigned int ver_w;
 	int i, ty;
 
 	if (!sm_open)
 		return;
 	sm_layout_get(&l);
-	sm_frame(l.x, l.y, l.w, l.h);
 
-	ver_w = usurf_text_width(&screen, "v" OS_VERSION);
-	usurf_text(&screen, l.x + 12, l.y + 6, OS_NAME, COL_WHITE,
-		   l.x, l.y, (unsigned int)l.w, (unsigned int)l.h);
-	usurf_text(&screen, l.x + l.w - 12 - (int)ver_w, l.y + 6,
-		   "v" OS_VERSION, 0x9A9AAEu,
-		   l.x, l.y, (unsigned int)l.w, (unsigned int)l.h);
-	usurf_text(&screen, l.x + 12, l.y + 25, "All apps", 0x9A9AAEu,
-		   l.x, l.y, (unsigned int)l.w, (unsigned int)l.h);
-	usurf_fill(&screen, l.x + 8, l.list_y - 1, l.w - 16, 1, 0x3A3A55u);
+	/* Flat theme.bg panel with no rim, exactly like the netmenu popover.
+	 * The Applications caption is the first item: there is no separate
+	 * banner card. */
+	usurf_fill(&screen, l.x, l.y, (unsigned int)l.w, (unsigned int)l.h,
+		   SM_BG);
+	usurf_text(&screen, l.x + SM_PAD, l.sect_y + 3, "Applications",
+		   SM_TEXT_DIM, l.x, l.y, (unsigned int)l.w,
+		   (unsigned int)l.h);
 
 	for (i = 0; i < SM_NAPP; i++)
 		sm_draw_app(i, &l);
 
-	/* Power row and the separator above it. */
-	usurf_fill(&screen, l.x + 8, l.power_y - 4, l.w - 16, 1, 0x3A3A55u);
-	if (sm_power_hot == 1 || sm_power_open)
-		usurf_fill(&screen, l.x + 4, l.power_y + 1, l.w - 8,
-			   (unsigned int)(l.row_h - 2), 0x365CA6u);
+	/* The Power row is a quick-settings tile rather than a plain list
+	 * row, so the submenu entry reads as the panel's last action. */
+	sm_fill_round(l.row_x, l.power_y, l.row_w, l.row_h, SM_RADIUS,
+		      sm_power_open ? SM_SEL :
+		      (sm_power_hot == 1 ? SM_BTN_HOT : SM_PANEL_ALT));
 	ty = l.power_y + (l.row_h - 16) / 2;
-	usurf_text(&screen, l.x + 12, ty, "Power",
-		   sm_power_hot == 1 || sm_power_open ? COL_WHITE : 0xE8E8F6u,
+	usurf_text(&screen, l.row_x + 12, ty, "Power",
+		   sm_power_open || sm_power_hot == 1 ? COL_WHITE : SM_TEXT,
 		   l.x, l.y, (unsigned int)l.w, (unsigned int)l.h);
 	{
 		const char *arrow = sm_power_open ? "v" : ">";
 		int aw = (int)usurf_text_width(&screen, arrow);
 
-		usurf_text(&screen, l.x + l.w - 12 - aw, ty, arrow,
-			   0x9A9AAEu, l.x, l.y, (unsigned int)l.w,
-			   (unsigned int)l.h);
+		usurf_text(&screen, l.row_x + l.row_w - 12 - aw, ty, arrow,
+			   sm_power_open || sm_power_hot == 1 ? COL_WHITE :
+						      SM_TEXT_DIM,
+			   l.x, l.y, (unsigned int)l.w, (unsigned int)l.h);
 	}
 
 	if (!sm_power_open)
 		return;
-	sm_frame(l.sub_x, l.sub_y, l.sub_w, l.sub_h);
+
+	/* Submenu: a rounded panel card with two rounded selection rows. */
+	sm_fill_round(l.sub_x, l.sub_y, l.sub_w, l.sub_h, SM_RADIUS,
+		      SM_PANEL);
 	for (i = 0; i < 2; i++) {
-		int sy = l.sub_y + 2 + i * l.row_h;
+		int sy = l.sub_y + 4 + i * l.row_h;
 		int sty = sy + (l.row_h - 16) / 2;
 
 		if (sm_power_hot == i + 2)
-			usurf_fill(&screen, l.sub_x + 3, sy + 1, l.sub_w - 6,
-				   (unsigned int)(l.row_h - 2), 0x365CA6u);
+			sm_fill_round(l.sub_x + 4, sy + 1, l.sub_w - 8,
+				      l.row_h - 2, 4, SM_SEL);
 		usurf_text(&screen, l.sub_x + 12, sty,
 			   i == 0 ? "Reboot" : "Power off",
-			   i == 1 ? (sm_power_hot == 3 ? COL_WHITE : 0xFF9090u)
-				  : (sm_power_hot == 2 ? COL_WHITE
-						       : 0xE8E8F6u),
+			   i == 1 ? (sm_power_hot == 3 ? COL_WHITE : SM_ERROR)
+				  : (sm_power_hot == 2 ? COL_WHITE : SM_TEXT),
 			   l.sub_x, l.sub_y, (unsigned int)l.sub_w,
 			   (unsigned int)l.sub_h);
 	}
@@ -1607,16 +1576,19 @@ static int sm_hit(unsigned int mx, unsigned int my)
 	sm_layout_get(&l);
 	if (sm_power_open &&
 	    x >= l.sub_x && x < l.sub_x + l.sub_w &&
-	    y >= l.sub_y + 2 && y < l.sub_y + 2 + 2 * l.row_h)
-		return (y - (l.sub_y + 2)) / l.row_h == 0 ?
-		       SM_HIT_REBOOT : SM_HIT_POWEROFF;
-	if (x < l.x || x >= l.x + l.w)
+	    y >= l.sub_y && y < l.sub_y + l.sub_h) {
+		if (y >= l.sub_y + 4 && y < l.sub_y + 4 + 2 * l.row_h)
+			return (y - (l.sub_y + 4)) / l.row_h == 0 ?
+			       SM_HIT_REBOOT : SM_HIT_POWEROFF;
+		return SM_HIT_MENU;
+	}
+	if (x < l.x || x >= l.x + l.w || y < l.y || y >= l.y + l.h)
 		return SM_HIT_NONE;
 	if (y >= l.list_y && y < l.list_y + SM_NAPP * l.row_h)
 		return (y - l.list_y) / l.row_h;
 	if (y >= l.power_y && y < l.power_y + l.row_h)
 		return SM_HIT_POWER;
-	return SM_HIT_NONE;
+	return SM_HIT_MENU;
 }
 
 static int sm_update_hover(unsigned int mx, unsigned int my)
@@ -1778,26 +1750,10 @@ static void do_update(struct wm_status *st)
 		}
 	}
 	{
-		int hot = bar_clock_hit(st->mouse.x, st->mouse.y);
-
-		if (hot != bar_clock_hot) {
-			bar_clock_hot = hot;
-			bar_dirty = 1;
-		}
-	}
-	{
-		int hot = bar_net_hit(st->mouse.x, st->mouse.y);
+		int hot = bar_status_hit(st->mouse.x, st->mouse.y);
 
-		if (hot != bar_net_hot) {
-			bar_net_hot = hot;
-			bar_dirty = 1;
-		}
-	}
-	{
-		int hot = bar_pwr_hit(st->mouse.x, st->mouse.y);
-
-		if (hot != bar_pwr_hot) {
-			bar_pwr_hot = hot;
+		if (hot != bar_status_hot) {
+			bar_status_hot = hot;
 			bar_dirty = 1;
 		}
 	}
@@ -1866,8 +1822,10 @@ static void do_update(struct wm_status *st)
 			}
 		}
 		if (!control_found && control_pid > 0 &&
-		    !u_alive((unsigned int)control_pid))
+		    !u_alive((unsigned int)control_pid)) {
 			control_pid = 0;
+			bar_dirty = 1;
+		}
 	}
 	/* The RTC is slow (CMOS polling) and the temperature/battery state only
 	 * changes once a second; query them at 1 Hz instead of every 10 ms. */
@@ -1943,7 +1901,6 @@ static void do_update(struct wm_status *st)
 		{
 			draw_rect(0, 0, fbw, fbh);
 			draw_bar();
-			bar_tooltip_commit();
 			if (osd_show)
 				osd_draw();
 			osd_visible = osd_show;
@@ -1995,14 +1952,6 @@ static void do_update(struct wm_status *st)
 		need = 1;
 	}
 
-	/* Repaint the previous tooltip area so hiding or moving it restores
-	 * the window/desktop underneath; the new one is drawn after the
-	 * windows below. */
-	if (bar_pwr_tip_on) {
-		need = 1;
-		add_rect(&present, bar_pwr_tip_on_x, bar_pwr_tip_on_y,
-			 bar_pwr_tip_on_w, bar_pwr_tip_on_h);
-	}
 	if (sm_dirty && sm_open)
 		need = 1;
 
@@ -2021,13 +1970,6 @@ static void do_update(struct wm_status *st)
 			  present.rect[i].w, present.rect[i].h);
 	if (bar_dirty)
 		draw_bar();
-	if (bar_pwr_tip_want) {
-		bar_tooltip_commit();
-		add_rect(&present, bar_pwr_tip_on_x, bar_pwr_tip_on_y,
-			 bar_pwr_tip_on_w, bar_pwr_tip_on_h);
-	} else {
-		bar_pwr_tip_on = 0;
-	}
 	if (osd_show) {
 		osd_draw();
 		add_rect(&present, osd_x, osd_y, osd_w, osd_h);
@@ -2266,7 +2208,9 @@ static void update_cursor(unsigned int mx, unsigned int my)
 	} else if (sm_open) {
 		/* The menu is modal: a hand over its items, the arrow
 		 * elsewhere, never a window's content cursor underneath. */
-		want = sm_hit(mx, my) == SM_HIT_NONE ?
+		int hit = sm_hit(mx, my);
+
+		want = (hit == SM_HIT_NONE || hit == SM_HIT_MENU) ?
 		       CURSOR_DEFAULT : CURSOR_POINTER;
 	} else if (my < WM_BAR_H) {
 		if (bar_start_hit(mx, my) || bar_status_hit(mx, my))
@@ -2316,7 +2260,7 @@ static void handle_mouse(struct wm_status *st)
 					bar_notice("poweroff failed");
 			} else if (hit >= 0) {
 				sm_launch(hit);
-			} else {
+			} else if (hit != SM_HIT_MENU) {
 				sm_close();
 			}
 			goto mouse_done;