Panel: add a Show Desktop module at the panel's end

- Clicking it hides every window, as Super+D does; it stays lit while the desktop is shown.
- A second click brings the hidden windows back.
- New show-desktop capability (wit toggle and publish-desktop-shown) for the wasm module.
- Added to the default panel after session settings; existing panels are unchanged.
- Test covers hiding, the lit state, and restoring the windows.
This commit is contained in:
nandi committed 2026-11-30 12:24:01 -08:00
1 parent 51852f0dac
commit 44bb77871d
31 files changed
+869 -49

No files matched your search

+9 -2
View File
@@ -69,7 +69,8 @@ enum {
K_DESKTOPS, K_DESKTOP_CUR, K_SET_DESKTOP,
K_FU_STATUS, K_FU_FACES, K_FU_ENROLL, K_FU_REMOVE, K_FU_SET_IN_USE, K_FU_REFRESH,
K_GL_STATUS, K_GL_GAMES, K_GL_MODES, K_GL_LAUNCH, K_GL_STOP, K_GL_FOCUS, K_GL_REFRESH,
K_OSK_IS_VISIBLE, K_OSK_SET_VISIBLE, K_ROT_CURRENT, K_ROT_SET
K_OSK_IS_VISIBLE, K_OSK_SET_VISIBLE, K_ROT_CURRENT, K_ROT_SET,
K_DESK_SHOWN, K_DESK_TOGGLE
};
typedef struct Env { Inst *inst; int kind; } Env;
@@ -87,7 +88,7 @@ static int32_t host_ints[24] = {[7] = -1, [10] = -1}; /* 0 layout mode, 1 inspec
5 screen-off minutes, 6 suspend minutes (0: never),
7 battery percent (-1: none), 8 battery charge-state, 9 battery seconds left,
10 backlight brightness percent (-1: none), 11 osk visible (0/1),
12 display rotation (0..3) */
12 display rotation (0..3), 13 desktop shown (show-desktop hid the windows) */
/* ---- requests a guest made of the host (launch, focus, ...) ; drained by the shell after each call ---- */
typedef struct { int kind; int32_t n; char *s; } Req;
@@ -503,6 +504,10 @@ static wasm_trap_t *host_import(void *env, const wasm_val_vec_t *args, wasm_val_
if (results->size >= 1) results->data[0] = (wasm_val_t)WASM_I32_VAL(host_ints[12]);
break;
case K_ROT_SET: push_req(22, a0, NULL); break;
case K_DESK_SHOWN:
if (results->size >= 1) results->data[0] = (wasm_val_t)WASM_I32_VAL(host_ints[13] != 0);
break;
case K_DESK_TOGGLE: push_req(23, 0, NULL); break;
case K_MOD_BROWSE: push_req(7, 0, NULL); break;
case K_MOD_LOAD: { char *s = guest_str(in, a0, a1); push_req(5, 0, s); free(s); break; }
case K_MOD_UNLOAD: { char *s = guest_str(in, a0, a1); push_req(6, 0, s); free(s); break; }
@@ -716,6 +721,8 @@ static int classify_import(const wasm_name_t *m, const wasm_name_t *f) {
if (!strcmp(iface, "osk") && !strcmp(fn, "set-visible")) return K_OSK_SET_VISIBLE;
if (!strcmp(iface, "rotation") && !strcmp(fn, "current")) return K_ROT_CURRENT;
if (!strcmp(iface, "rotation") && !strcmp(fn, "set-rotation")) return K_ROT_SET;
if (!strcmp(iface, "show-desktop") && !strcmp(fn, "is-shown")) return K_DESK_SHOWN;
if (!strcmp(iface, "show-desktop") && !strcmp(fn, "toggle")) return K_DESK_TOGGLE;
if (!strcmp(iface, "modules") && !strcmp(fn, "available")) return K_MOD_AVAILABLE;
if (!strcmp(iface, "modules") && !strcmp(fn, "loaded")) return K_MOD_LOADED;
if (!strcmp(iface, "modules") && !strcmp(fn, "load-module")) return K_MOD_LOAD;