Session settings panel module: switch session restore and window placement on or off
CI / test (push) Failing after 16s
CI / test (push) Failing after 16s
- New 'session-settings' capability (wit/capabilities.wit: settings, is-on, set-setting) and 'session-settings' panel module: a "Session" button whose popup lists the session settings, each with an on/off switch. Clicking a row flips it at once (the list stays open); Up/Down move the highlight, Enter or Space flips it, Escape or a click elsewhere closes. In the default panel, between Wallpaper and Log out. - Two settings to start with, kept in state.edn and written only when off (absent means on): "Reopen windows at login" (:restore-session, the key session restore already read) and "Remember window positions" (:remember-windows; when off, floating windows aren't placed where their app was left and new places aren't recorded, but the saved ones are kept). - Served by both hosts: wasmer stub (native; settings table 6, bit mask in host int 3, requests 10/11) and host-wasm (publish-session-settings, set-session-setting request). - Tests: native end-to-end (open, click both rows, keyboard, Escape), a state.edn round trip that checks both settings take effect, and a host-wasm module test. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DPL5hgxf6exeYrDGcy4WW3
This commit is contained in:
32 files changed
+1192
-44
No files matched your search
@@ -608,6 +608,7 @@ pub(all) enum HostTable {
|
||||
Modules
|
||||
Instances
|
||||
Wallpapers
|
||||
SessionSettings
|
||||
}
|
||||
|
||||
///| Publish `t` as the data behind `which` for every module's next call.
|
||||
@@ -619,6 +620,7 @@ pub fn publish(which : HostTable, t : Table) -> Unit {
|
||||
Modules => 3
|
||||
Instances => 4
|
||||
Wallpapers => 5
|
||||
SessionSettings => 6
|
||||
}
|
||||
let out : Array[Byte] = []
|
||||
for k = 0; k < 4; k = k + 1 {
|
||||
@@ -641,6 +643,11 @@ pub fn publish_wallpaper(current : Int) -> Unit {
|
||||
c_host_set_int(2, current)
|
||||
}
|
||||
|
||||
///| Publish which session settings are on: bit i for row i of the SessionSettings table.
|
||||
pub fn publish_session_settings(on : Int) -> Unit {
|
||||
c_host_set_int(3, on)
|
||||
}
|
||||
|
||||
///| Something a module asked the host to do during a call.
|
||||
pub(all) enum HostRequest {
|
||||
Launch(String)
|
||||
@@ -652,6 +659,8 @@ pub(all) enum HostRequest {
|
||||
Browse
|
||||
Logout
|
||||
SetWallpaper(Int)
|
||||
/// Turn session setting `index` on or off.
|
||||
SetSessionSetting(Int, Bool)
|
||||
} derive(Eq, Debug)
|
||||
|
||||
///|
|
||||
@@ -673,6 +682,8 @@ pub fn next_request() -> HostRequest? {
|
||||
7 => Some(Browse)
|
||||
8 => Some(Logout)
|
||||
9 => Some(SetWallpaper(c_host_req_int()))
|
||||
10 => Some(SetSessionSetting(c_host_req_int(), false))
|
||||
11 => Some(SetSessionSetting(c_host_req_int(), true))
|
||||
_ => None
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user