فهرست منبع

wm: add a Disks launcher to the top bar

The new last launcher spawns /ramfs/bin/disks; WM_BTN_END_X moves to its
right edge, so the bar notice and the right-aligned status start 70 px
further right.

Co-Authored-By: Claude <noreply@anthropic.com>
Johannes Zellner 3 روز پیش
والد
کامیت
06a7aa59be
6فایلهای تغییر یافته به همراه24 افزوده شده و 8 حذف شده
  1. 4 3
      AGENTS.md
  2. 2 1
      docs/filesystems.html
  3. 4 0
      docs/graphics.html
  4. 1 1
      docs/userland.html
  5. 5 1
      include/wm_abi.h
  6. 8 2
      user/apps/wm/ucmd_wm.c

+ 4 - 3
AGENTS.md

@@ -454,7 +454,8 @@ it to `0x7E00`.  The kernel region itself only has one wall (`_end` below
   window uses the 1 px border plus title bar).  An outside press dismisses the
   window uses the 1 px border plus title bar).  An outside press dismisses the
   popover and then continues with the normal click handling; a second click
   popover and then continues with the normal click handling; a second click
   on a status target toggles it.
   on a status target toggles it.
-  The last launcher, `Chat`, spawns `/ramfs/bin/chat`; `WM_BTN_END_X`
+  `Chat` spawns `/ramfs/bin/chat` and the last launcher, `Disks`, spawns
+  `/ramfs/bin/disks` (the storage manager); `WM_BTN_END_X`
   (`wm_abi.h`) is the launchers' right edge, and the bar notice and the
   (`wm_abi.h`) is the launchers' right edge, and the bar notice and the
   right-aligned status never draw left of it.
   right-aligned status never draw left of it.
   `terminal.c` keeps the privileged kernel command
   `terminal.c` keeps the privileged kernel command
@@ -711,8 +712,8 @@ it to `0x7E00`.  The kernel region itself only has one wall (`_end` below
   it when absent.  It refuses a raw runtime pack (`cmds-dev`/`net-cmds`/
   it when absent.  It refuses a raw runtime pack (`cmds-dev`/`net-cmds`/
   `kernel-dev`); use `net-install` for that.  `target=auto` picks the only
   `kernel-dev`); use `net-install` for that.  `target=auto` picks the only
   non-USB NebOS disk.
   non-USB NebOS disk.
-- **Storage manager / mount policies**: `ucmd_disks.c` (`disks`, and the
-  `Disks` button in the `files` toolbar) is the ngui view of storage; the
+- **Storage manager / mount policies**: `ucmd_disks.c` (`disks`, the
+  top-bar `Disks` launcher and the `Disks` button in the `files` toolbar) is the ngui view of storage; the
   `storage` command stays the text view.  It lists the present block
   `storage` command stays the text view.  It lists the present block
   devices (empty IDE/eMMC slots are hidden), reads sector 0 and each
   devices (empty IDE/eMMC slots are hidden), reads sector 0 and each
   partition's first sector with `SYS_BLK_READ` (119, one 512-byte sector,
   partition's first sector with `SYS_BLK_READ` (119, one 512-byte sector,

+ 2 - 1
docs/filesystems.html

@@ -325,7 +325,8 @@
 		<h2>Storage manager &amp; mount policies</h2>
 		<h2>Storage manager &amp; mount policies</h2>
 		<p>
 		<p>
 			<code>disks</code> (<span class="file">ucmd_disks.c</span>, also the
 			<code>disks</code> (<span class="file">ucmd_disks.c</span>, also the
-			<em>Disks</em> button in <code>files</code>) is the ngui front end to
+			top-bar <em>Disks</em> launcher and the <em>Disks</em> button in
+			<code>files</code>) is the ngui front end to
 			storage; <code>storage</code> stays the text view. It lists every
 			storage; <code>storage</code> stays the text view. It lists every
 			present block device (<code>SYS_BLKDEV</code>), reads sector 0 and
 			present block device (<code>SYS_BLKDEV</code>), reads sector 0 and
 			each partition's first sector through <code>SYS_BLK_READ</code>
 			each partition's first sector through <code>SYS_BLK_READ</code>

+ 4 - 0
docs/graphics.html

@@ -406,6 +406,10 @@
 				<h3>chat</h3>
 				<h3>chat</h3>
 				<p>Cloudron Chat client: native OIDC login, channel/DM sidebar with unread badges and presence dots, a wrapped timeline with avatars, day headers and reply snippets, a composer and browse/new-DM pickers. Media downloads use a warm <code>curl __serve</code> helper; message images are also decoded there (480&times;320 bounds), while avatars decode at 32&times;32 on the chat thread, so the window keeps drawing. Saved sessions resume from <code>/data</code>. The top-bar <em>Chat</em> button launches it.</p>
 				<p>Cloudron Chat client: native OIDC login, channel/DM sidebar with unread badges and presence dots, a wrapped timeline with avatars, day headers and reply snippets, a composer and browse/new-DM pickers. Media downloads use a warm <code>curl __serve</code> helper; message images are also decoded there (480&times;320 bounds), while avatars decode at 32&times;32 on the chat thread, so the window keeps drawing. Saved sessions resume from <code>/data</code>. The top-bar <em>Chat</em> button launches it.</p>
 			</div>
 			</div>
+			<div class="card">
+				<h3>disks</h3>
+				<p>Storage manager: devices, MBR partitions and mounts, per-volume mount name, read-only and automount, and Format / Install NebOS dialogs that show the kernel command's output. The top-bar <em>Disks</em> button and the <em>Disks</em> button in <code>files</code> launch it.</p>
+			</div>
 			<div class="card">
 			<div class="card">
 				<h3>solitaire</h3>
 				<h3>solitaire</h3>
 				<p>Klondike with drag-and-drop, draw-one/three, scoring, animation and pixel-art cards on the canvas service.</p>
 				<p>Klondike with drag-and-drop, draw-one/three, scoring, animation and pixel-art cards on the canvas service.</p>

+ 1 - 1
docs/userland.html

@@ -346,7 +346,7 @@
 		<h2>GUI applications</h2>
 		<h2>GUI applications</h2>
 		<ul>
 		<ul>
 			<li><strong>files</strong> — browser for the VFS; opens text in <code>edit</code>, images in <code>view</code>, HTML in <code>browser</code>. First user of ngui.</li>
 			<li><strong>files</strong> — browser for the VFS; opens text in <code>edit</code>, images in <code>view</code>, HTML in <code>browser</code>. First user of ngui.</li>
-			<li><strong>disks</strong> — storage manager (also the <em>Disks</em> button in <code>files</code>): devices, MBR partitions and mounts; per-volume mount name, read-only and automount saved to <code>/data/MOUNTS.CFG</code>; Format and Install NebOS dialogs that run <code>format -y</code>/<code>install -y</code> on a private tty and show the log. See <a href="filesystems.html#disks">Filesystems → Storage manager</a>.</li>
+			<li><strong>disks</strong> — storage manager (top-bar <em>Disks</em> button, or the <em>Disks</em> button in <code>files</code>): devices, MBR partitions and mounts; per-volume mount name, read-only and automount saved to <code>/data/MOUNTS.CFG</code>; Format and Install NebOS dialogs that run <code>format -y</code>/<code>install -y</code> on a private tty and show the log. See <a href="filesystems.html#disks">Filesystems → Storage manager</a>.</li>
 			<li><strong>gallery</strong> — live widget and primitive showcase; the real app ships in the pack.</li>
 			<li><strong>gallery</strong> — live widget and primitive showcase; the real app ships in the pack.</li>
 			<li><strong>chat</strong> — native Cloudron Chat client (top-bar <em>Chat</em> button, or <code>chat [config-path]</code>): username/password/TOTP login through the Cloudron OIDC API or a pasted session cookie, channels and DMs with unread badges and presence, history with older paging, inline image attachments and profile-picture avatars, sending, REST polling, read markers, browse/join and new DM.  The session cookie (never the password) is saved in <code>/data/CHAT.CFG</code> when the persistent volume is mounted, or in the RAM-only <code>/share/chat.cfg</code> otherwise.  Keys: Enter sends, PgUp/PgDn scroll, Home at the top pages in older history, Ctrl+B browse, Ctrl+N new DM, Ctrl+R refresh, and with the composer unfocused (Esc) Up/Down switch conversations.  See <a href="network.html#chat">Network → Chat client</a>.</li>
 			<li><strong>chat</strong> — native Cloudron Chat client (top-bar <em>Chat</em> button, or <code>chat [config-path]</code>): username/password/TOTP login through the Cloudron OIDC API or a pasted session cookie, channels and DMs with unread badges and presence, history with older paging, inline image attachments and profile-picture avatars, sending, REST polling, read markers, browse/join and new DM.  The session cookie (never the password) is saved in <code>/data/CHAT.CFG</code> when the persistent volume is mounted, or in the RAM-only <code>/share/chat.cfg</code> otherwise.  Keys: Enter sends, PgUp/PgDn scroll, Home at the top pages in older history, Ctrl+B browse, Ctrl+N new DM, Ctrl+R refresh, and with the composer unfocused (Esc) Up/Down switch conversations.  See <a href="network.html#chat">Network → Chat client</a>.</li>
 			<li><strong>solitaire</strong> — Klondike with drag-and-drop, scoring and a win animation.</li>
 			<li><strong>solitaire</strong> — Klondike with drag-and-drop, scoring and a win animation.</li>

+ 5 - 1
include/wm_abi.h

@@ -46,9 +46,13 @@
 #define WM_BTN_CHAT_Y WM_BTN_Y
 #define WM_BTN_CHAT_Y WM_BTN_Y
 #define WM_BTN_CHAT_W 56
 #define WM_BTN_CHAT_W 56
 #define WM_BTN_CHAT_H WM_BTN_H
 #define WM_BTN_CHAT_H WM_BTN_H
+#define WM_BTN_DISKS_X (WM_BTN_CHAT_X + WM_BTN_CHAT_W + WM_BTN_GAP)
+#define WM_BTN_DISKS_Y WM_BTN_Y
+#define WM_BTN_DISKS_W 64
+#define WM_BTN_DISKS_H WM_BTN_H
 /* Right edge of the launcher buttons: the notice text and the right-aligned
 /* Right edge of the launcher buttons: the notice text and the right-aligned
  * status (clock, sensors, power) never draw left of it. */
  * status (clock, sensors, power) never draw left of it. */
-#define WM_BTN_END_X (WM_BTN_CHAT_X + WM_BTN_CHAT_W)
+#define WM_BTN_END_X (WM_BTN_DISKS_X + WM_BTN_DISKS_W)
 #define WM_TITLE_H 22
 #define WM_TITLE_H 22
 #define WM_CLOSE_W 16
 #define WM_CLOSE_W 16
 
 

+ 8 - 2
user/apps/wm/ucmd_wm.c

@@ -452,6 +452,8 @@ static void draw_bar(void)
 		   WM_BTN_GALLERY_H, "Gallery");
 		   WM_BTN_GALLERY_H, "Gallery");
 	bar_button(WM_BTN_CHAT_X, WM_BTN_CHAT_Y, WM_BTN_CHAT_W,
 	bar_button(WM_BTN_CHAT_X, WM_BTN_CHAT_Y, WM_BTN_CHAT_W,
 		   WM_BTN_CHAT_H, "Chat");
 		   WM_BTN_CHAT_H, "Chat");
+	bar_button(WM_BTN_DISKS_X, WM_BTN_DISKS_Y, WM_BTN_DISKS_W,
+		   WM_BTN_DISKS_H, "Disks");
 	if (bar_msg_until &&
 	if (bar_msg_until &&
 	    (int)(u_ticks_ms() - bar_msg_until) < 0)
 	    (int)(u_ticks_ms() - bar_msg_until) < 0)
 		usurf_text(&screen, (int)(WM_BTN_END_X + 8),
 		usurf_text(&screen, (int)(WM_BTN_END_X + 8),
@@ -1731,12 +1733,12 @@ static int bar_launcher_hit(unsigned int mx, unsigned int my)
 	static const int x0[] = {
 	static const int x0[] = {
 		WM_BTN_X, WM_BTN_CLOCK_X, WM_BTN_COLORS_X, WM_BTN_FILES_X,
 		WM_BTN_X, WM_BTN_CLOCK_X, WM_BTN_COLORS_X, WM_BTN_FILES_X,
 		WM_BTN_MINES_X, WM_BTN_WEB_X, WM_BTN_CARDS_X, WM_BTN_GALLERY_X,
 		WM_BTN_MINES_X, WM_BTN_WEB_X, WM_BTN_CARDS_X, WM_BTN_GALLERY_X,
-		WM_BTN_CHAT_X
+		WM_BTN_CHAT_X, WM_BTN_DISKS_X
 	};
 	};
 	static const int w[] = {
 	static const int w[] = {
 		WM_BTN_W, WM_BTN_CLOCK_W, WM_BTN_COLORS_W, WM_BTN_FILES_W,
 		WM_BTN_W, WM_BTN_CLOCK_W, WM_BTN_COLORS_W, WM_BTN_FILES_W,
 		WM_BTN_MINES_W, WM_BTN_WEB_W, WM_BTN_CARDS_W, WM_BTN_GALLERY_W,
 		WM_BTN_MINES_W, WM_BTN_WEB_W, WM_BTN_CARDS_W, WM_BTN_GALLERY_W,
-		WM_BTN_CHAT_W
+		WM_BTN_CHAT_W, WM_BTN_DISKS_W
 	};
 	};
 	unsigned int i;
 	unsigned int i;
 
 
@@ -1836,6 +1838,10 @@ static void handle_mouse(struct wm_status *st)
 			   mx < WM_BTN_CHAT_X + WM_BTN_CHAT_W &&
 			   mx < WM_BTN_CHAT_X + WM_BTN_CHAT_W &&
 			   my < WM_BTN_CHAT_Y + WM_BTN_CHAT_H) {
 			   my < WM_BTN_CHAT_Y + WM_BTN_CHAT_H) {
 			spawn_app_checked("/ramfs/bin/chat");
 			spawn_app_checked("/ramfs/bin/chat");
+		} else if (mx >= WM_BTN_DISKS_X && my >= WM_BTN_DISKS_Y &&
+			   mx < WM_BTN_DISKS_X + WM_BTN_DISKS_W &&
+			   my < WM_BTN_DISKS_Y + WM_BTN_DISKS_H) {
+			spawn_app_checked("/ramfs/bin/disks");
 		} else {
 		} else {
 			int idx = window_at((int)mx, (int)my);
 			int idx = window_at((int)mx, (int)my);