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:
1 parent
51852f0dac
commit
44bb77871d
31 files changed
+869
-49
No files matched your search
@@ -0,0 +1 @@
|
||||
Show the desktop (Super+D): hide every window of the active workspace, and bring them back.
|
||||
@@ -0,0 +1,8 @@
|
||||
// Generated by `wit-bindgen` 0.63.0. DO NOT EDIT!
|
||||
|
||||
///|
|
||||
fn wasmImportIsShown() -> Int = "chandra:desktop/show-desktop@0.1.0" "is-shown"
|
||||
|
||||
///|
|
||||
fn wasmImportToggle() = "chandra:desktop/show-desktop@0.1.0" "toggle"
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
warnings = "-44"
|
||||
@@ -0,0 +1,18 @@
|
||||
// Generated by `wit-bindgen` 0.63.0. DO NOT EDIT!
|
||||
///|
|
||||
/// True while the windows are hidden and `toggle` would bring them back.
|
||||
pub fn is_shown() -> Bool {
|
||||
|
||||
let result : Int = wasmImportIsShown();
|
||||
let ret = (result != 0)
|
||||
return ret
|
||||
|
||||
}
|
||||
///|
|
||||
/// Hide the windows to show the desktop, or (while it is shown) bring back the ones it hid.
|
||||
pub fn toggle() -> Unit {
|
||||
|
||||
wasmImportToggle();
|
||||
|
||||
}
|
||||
|
||||
@@ -66,6 +66,9 @@ fn wasmImportPublishOsk(p0 : Int) = "chandra:host/plasmoids@0.1.0" "publish-osk
|
||||
///|
|
||||
fn wasmImportPublishRotation(p0 : Int) = "chandra:host/plasmoids@0.1.0" "publish-rotation"
|
||||
|
||||
///|
|
||||
fn wasmImportPublishDesktopShown(p0 : Int) = "chandra:host/plasmoids@0.1.0" "publish-desktop-shown"
|
||||
|
||||
///|
|
||||
fn wasmImportPublishSystem(p0 : Int, p1 : Int64, p2 : Int64, p3 : Int, p4 : Int, p5 : Int64, p6 : Int64, p7 : Int64, p8 : Int) = "chandra:host/plasmoids@0.1.0" "publish-system"
|
||||
|
||||
@@ -88,16 +91,13 @@ fn wasmImportPickerStart() -> Int = "chandra:host/plasmoids@0.1.0" "picker-start
|
||||
fn wasmImportPickerPoll(p0 : Int) = "chandra:host/plasmoids@0.1.0" "picker-poll"
|
||||
|
||||
///|
|
||||
extern "wasm" fn mbt_ffi_load32(offset : Int) -> Int =
|
||||
#|(func (param i32) (result i32) local.get 0 i32.load)
|
||||
extern "wasm" fn mbt_ffi_load8_u(offset : Int) -> Int =
|
||||
#|(func (param i32) (result i32) local.get 0 i32.load8_u)
|
||||
|
||||
///|
|
||||
extern "wasm" fn mbt_ffi_free(position : Int) =
|
||||
#|(func (param i32) local.get 0 call $moonbit.decref)
|
||||
|
||||
///|
|
||||
extern "wasm" fn mbt_ffi_store32(offset : Int, value : Int) =
|
||||
#|(func (param i32) (param i32) local.get 0 local.get 1 i32.store)
|
||||
#owned(bytes)
|
||||
extern "wasm" fn mbt_ffi_bytes2ptr(bytes : FixedArray[Byte]) -> Int =
|
||||
#|(func (param i32) (result i32) local.get 0)
|
||||
|
||||
///|
|
||||
extern "wasm" fn mbt_ffi_ptr2str(ptr : Int, len : Int) -> String =
|
||||
@@ -113,29 +113,32 @@ extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int =
|
||||
#| local.tee 1 i32.const 0 call $moonbit.init_array8
|
||||
#| local.get 1)
|
||||
|
||||
///|
|
||||
#owned(str)
|
||||
extern "wasm" fn mbt_ffi_str2ptr(str : String) -> Int =
|
||||
#|(func (param i32) (result i32) local.get 0)
|
||||
|
||||
///|
|
||||
extern "wasm" fn mbt_ffi_store64(offset : Int, value : Int64) =
|
||||
#|(func (param i32) (param i64) local.get 0 local.get 1 i64.store)
|
||||
|
||||
///|
|
||||
#owned(bytes)
|
||||
extern "wasm" fn mbt_ffi_bytes2ptr(bytes : FixedArray[Byte]) -> Int =
|
||||
#|(func (param i32) (result i32) local.get 0)
|
||||
|
||||
///|
|
||||
extern "wasm" fn mbt_ffi_load64(offset : Int) -> Int64 =
|
||||
#|(func (param i32) (result i64) local.get 0 i64.load)
|
||||
|
||||
///|
|
||||
extern "wasm" fn mbt_ffi_store8(offset : Int, value : Int) =
|
||||
#|(func (param i32) (param i32) local.get 0 local.get 1 i32.store8)
|
||||
|
||||
///|
|
||||
extern "wasm" fn mbt_ffi_load8_u(offset : Int) -> Int =
|
||||
#|(func (param i32) (result i32) local.get 0 i32.load8_u)
|
||||
extern "wasm" fn mbt_ffi_load64(offset : Int) -> Int64 =
|
||||
#|(func (param i32) (result i64) local.get 0 i64.load)
|
||||
|
||||
///|
|
||||
extern "wasm" fn mbt_ffi_store32(offset : Int, value : Int) =
|
||||
#|(func (param i32) (param i32) local.get 0 local.get 1 i32.store)
|
||||
|
||||
///|
|
||||
extern "wasm" fn mbt_ffi_free(position : Int) =
|
||||
#|(func (param i32) local.get 0 call $moonbit.decref)
|
||||
|
||||
///|
|
||||
#owned(str)
|
||||
extern "wasm" fn mbt_ffi_str2ptr(str : String) -> Int =
|
||||
#|(func (param i32) (result i32) local.get 0)
|
||||
|
||||
///|
|
||||
extern "wasm" fn mbt_ffi_load32(offset : Int) -> Int =
|
||||
#|(func (param i32) (result i32) local.get 0 i32.load)
|
||||
|
||||
@@ -110,6 +110,11 @@ fn wasmImportPublishRotation(p0 : Int) -> Unit {
|
||||
abort("wasm-only host import")
|
||||
}
|
||||
|
||||
///|
|
||||
fn wasmImportPublishDesktopShown(p0 : Int) -> Unit {
|
||||
abort("wasm-only host import")
|
||||
}
|
||||
|
||||
///|
|
||||
fn wasmImportPublishSystem(p0 : Int, p1 : Int64, p2 : Int64, p3 : Int, p4 : Int, p5 : Int64, p6 : Int64, p7 : Int64, p8 : Int) -> Unit {
|
||||
abort("wasm-only host import")
|
||||
@@ -146,17 +151,12 @@ fn wasmImportPickerPoll(p0 : Int) -> Unit {
|
||||
}
|
||||
|
||||
///|
|
||||
fn mbt_ffi_load32(offset : Int) -> Int {
|
||||
fn mbt_ffi_load8_u(offset : Int) -> Int {
|
||||
abort("wasm-only")
|
||||
}
|
||||
|
||||
///|
|
||||
fn mbt_ffi_free(position : Int) -> Unit {
|
||||
abort("wasm-only")
|
||||
}
|
||||
|
||||
///|
|
||||
fn mbt_ffi_store32(offset : Int, value : Int) -> Unit {
|
||||
fn mbt_ffi_bytes2ptr(bytes : FixedArray[Byte]) -> Int {
|
||||
abort("wasm-only")
|
||||
}
|
||||
|
||||
@@ -170,32 +170,37 @@ fn mbt_ffi_malloc(size : Int) -> Int {
|
||||
abort("wasm-only")
|
||||
}
|
||||
|
||||
///|
|
||||
fn mbt_ffi_str2ptr(str : String) -> Int {
|
||||
abort("wasm-only")
|
||||
}
|
||||
|
||||
///|
|
||||
fn mbt_ffi_store64(offset : Int, value : Int64) -> Unit {
|
||||
abort("wasm-only")
|
||||
}
|
||||
|
||||
///|
|
||||
fn mbt_ffi_bytes2ptr(bytes : FixedArray[Byte]) -> Int {
|
||||
abort("wasm-only")
|
||||
}
|
||||
|
||||
///|
|
||||
fn mbt_ffi_load64(offset : Int) -> Int64 {
|
||||
abort("wasm-only")
|
||||
}
|
||||
|
||||
///|
|
||||
fn mbt_ffi_store8(offset : Int, value : Int) -> Unit {
|
||||
abort("wasm-only")
|
||||
}
|
||||
|
||||
///|
|
||||
fn mbt_ffi_load8_u(offset : Int) -> Int {
|
||||
fn mbt_ffi_load64(offset : Int) -> Int64 {
|
||||
abort("wasm-only")
|
||||
}
|
||||
|
||||
///|
|
||||
fn mbt_ffi_store32(offset : Int, value : Int) -> Unit {
|
||||
abort("wasm-only")
|
||||
}
|
||||
|
||||
///|
|
||||
fn mbt_ffi_free(position : Int) -> Unit {
|
||||
abort("wasm-only")
|
||||
}
|
||||
|
||||
///|
|
||||
fn mbt_ffi_str2ptr(str : String) -> Int {
|
||||
abort("wasm-only")
|
||||
}
|
||||
|
||||
///|
|
||||
fn mbt_ffi_load32(offset : Int) -> Int {
|
||||
abort("wasm-only")
|
||||
}
|
||||
@@ -72,6 +72,7 @@ pub(all) enum Request {
|
||||
SetBrightness(Int)
|
||||
SetOskVisible(Bool)
|
||||
SetRotation(Int)
|
||||
ToggleDesktop
|
||||
}
|
||||
///|
|
||||
/// A native file-chooser dialog (zenity on the host session) for "Add widget".
|
||||
@@ -520,6 +521,13 @@ pub fn publish_rotation(rot : UInt) -> Unit {
|
||||
|
||||
wasmImportPublishRotation((rot).reinterpret_as_int());
|
||||
|
||||
}
|
||||
///|
|
||||
/// Whether show-desktop has the windows hidden (a toggle would bring them back).
|
||||
pub fn publish_desktop_shown(shown : Bool) -> Unit {
|
||||
|
||||
wasmImportPublishDesktopShown((if shown { 1 } else { 0 }));
|
||||
|
||||
}
|
||||
///|
|
||||
pub fn publish_system(s : SystemSnapshot) -> Unit {
|
||||
@@ -683,6 +691,10 @@ pub fn next_request() -> Request? {
|
||||
|
||||
Request::SetRotation(mbt_ffi_load32((return_area) + 8))
|
||||
}
|
||||
25 => {
|
||||
|
||||
Request::ToggleDesktop
|
||||
}
|
||||
_ => panic()
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user