RediWM is a Wayland compositor written in Zig (OpenGL ES) that includes everything in one process
Super+A window manager
oxydizer70ebb2f12295
diff --git a/README.md b/README.mdindex 1a27e21..f00e378 100644--- a/README.md+++ b/README.md@@ -77,6 +77,7 @@ For custom prefixes and distribution packages, see| Alt+Tab | window switcher || Super+1…5, Super+=/-/0 | window zoom || Super+Shift+=/-/0 | desktop zoom |+| Super+A | canvas window overview || Super+L | lock || Ctrl+Shift+S, Print | region / full-screen screenshot || Super+Z | undo the last window move or resize |diff --git a/TESTING.md b/TESTING.mdindex 0ed09c8..1e44e26 100644--- a/TESTING.md+++ b/TESTING.md@@ -152,3 +152,10 @@ logind services, fake sysfs events, and a fake brightnessctl. Repeat withqualify lid close/open, external-monitor removal with the lid closed, suspendand resume after unplugging, keyboard lighting and firmware charging-limitreadback. Keep real power actions out of automated tests.++Canvas overview: `python3 tests/overview.py` checks the rendered 2×2 and+2+3 grids, live minimized previews, restoration, pointer and keyboard selection,+consumed input, client teardown, config reload and reduced motion in a private headless session. Repeat with+`REDIWM_TEST_SCALE=1.5 REDIWM_TEST_OUTPUTS=2`. Also run `focus_zoom.py`,+`desktop_zoom.py`, `keyboard_shortcuts.py`, `shortcuts_inhibit.py`,+`pointer_constraints.py` and `switcher_ime.py` after changing its input routing.diff --git a/docs/agent-notes/map.md b/docs/agent-notes/map.mdindex a2374eb..1a0910b 100644--- a/docs/agent-notes/map.md+++ b/docs/agent-notes/map.md@@ -57,7 +57,7 @@ seam for other operating systems.| Host | Methods | What ||---|---|---|| `Server.zig` | `server/` | startup and teardown, outputs, frames, wakeups, wallpaper |-| `World.zig` | `world/` | window list, focus, the camera, zoom, pan and pinch |+| `World.zig` | `world/` | window list, focus, the camera, zoom, pan and pinch; `overview.zig` owns the temporary spread, `overview_cards.zig` its live presentation, `overview_layout.zig` its grid || `Toplevel.zig` | `toplevel/` | a window; `xdg.zig`, `xwayland_surface.zig` adapt the protocols || `Output.zig` | `output/` | one monitor: frames, layout, modes, panels, wallpaper || `Input.zig` | `input/` | seat, pointer, gestures, drags (`input/AGENTS.md`) |diff --git a/docs/wiki/Using-RediWM.md b/docs/wiki/Using-RediWM.mdindex a9793d3..0bd33b9 100644--- a/docs/wiki/Using-RediWM.md+++ b/docs/wiki/Using-RediWM.md@@ -14,6 +14,7 @@| Alt+Tab | window switcher || Super+1..5, Super+=/-/0 | window zoom || Super+Shift+=/-/0 | desktop zoom |+| Super+A | canvas window overview || Super+L | lock || Ctrl+Shift+S, Print | region / full-screen screenshot || Super+Z | undo the last window move or resize |@@ -41,6 +42,25 @@ The mini map shows where you are and hides itself after a moment.The volume/brightness OSD also shows the desktop zoom percentage.+Press **Super+A** to spread the canvas windows into separate live previews on+the monitor under the pointer. Four windows form a 2×2 grid; five form two+centred above three. Previews preserve aspect ratios, with gaps and readable+titles beneath them. Offscreen and minimized windows are included; hidden tabs+are excluded.++Click a preview, or select one with the arrow keys and press Enter, to visit it.+Selecting a minimized window restores it. Escape, Super+A again, or clicking+empty space returns to the previous view and leaves minimized windows minimized.+The spread changes only presentation: window positions, sizes and saved depths+stay intact. This overview applies to canvas mode.++With `focus_zoom` enabled, accepting a window applies its normal focus boost or+camera depth. Cancelling still restores the original view.++The action is `toggle_overview`. Its default Super+A binding is added to existing+canvas configs unless that key is already assigned. Set `"super+a" = "noop"`+under `[keybinds]` to disable it, or change it in Settings → Keyboard Shortcuts.+## Window switcherAlt+Tab cycles windows; Alt+Shift+Tab cycles backwards. Release Alt to focusdiff --git a/src/Input.zig b/src/Input.zigindex 0fe1cc5..19360c9 100644--- a/src/Input.zig+++ b/src/Input.zig@@ -213,6 +213,7 @@ mini_map_buttons: u32 = 0,/// A click can accept/cancel the switcher mid-press; its matching release/// must still be swallowed rather than reaching whatever is now focused.switcher_buttons: u32 = 0,+overview_buttons: u32 = 0,/// Last known (surface-local, world) correspondence for whichever ordinary/// client surface currently holds pointer focus, refreshed on every real/// hit. Lets passthroughMotion's implicit grab (see below) keep reportingdiff --git a/src/Output.zig b/src/Output.zigindex d2729aa..0a61880 100644--- a/src/Output.zig+++ b/src/Output.zig@@ -520,6 +520,7 @@ pub const CursorState = struct {pub fn handleDestroy(listener: *wl.Listener(*wlr.Output), _: *wlr.Output) void {const output: *Output = @fieldParentPtr("destroy", listener);+ output.server.world.overview.cancel(&output.server.world);if (output.tearing_idle) |source| source.remove();output.tearing_idle = null;if (output.server.screenshot_selector.output == output) output.server.screenshot_selector.cancel();diff --git a/src/World.zig b/src/World.zigindex 4ec4c24..5c5c85c 100644--- a/src/World.zig+++ b/src/World.zig@@ -27,6 +27,7 @@ toplevels: wl.list.Head(Toplevel, .link) = undefined,closing: wl.list.Head(Toplevel, .closing_link) = undefined,workspaces: @import("workspaces.zig") = .{},camera: camera_mod.Camera = .{},+overview: @import("world/overview.zig") = .{},bounds: camera_mod.Bounds = .{},mini_map: @import("mini_map.zig") = .{},camera_event_pending: bool = false,@@ -111,7 +112,7 @@ pub fn syncPresentation(world: *World) void {const now = anim.nowMs();var it = world.toplevels.iterator(.forward);while (it.next()) |toplevel| {- if (toplevel.zoom_boost_value != 0 or world.server.config.compositor.focus_zoom == .camera) {+ if (world.overview.active() or toplevel.zoom_boost_value != 0 or world.server.config.compositor.focus_zoom == .camera) {toplevel.applyVisualTransform(now);toplevel.applyOpacity(now);}diff --git a/src/config/default.zig b/src/config/default.zigindex 2a888de..35f31de 100644--- a/src/config/default.zig+++ b/src/config/default.zig@@ -407,6 +407,7 @@ pub const source =\\"super+0" = "zoom_reset"\\\\# Camera+ \\"super+a" = "toggle_overview"\\"super+shift+equal" = "camera_zoom_in"\\"super+shift+minus" = "camera_zoom_out"\\"super+shift+0" = "camera_zoom_reset"diff --git a/src/config/keybinds.zig b/src/config/keybinds.zigindex ac3140e..26980ef 100644--- a/src/config/keybinds.zig+++ b/src/config/keybinds.zig@@ -62,6 +62,7 @@ pub const Action = union(enum) {zoom_in,zoom_out,zoom_reset,+ toggle_overview,camera_zoom_in,camera_zoom_out,camera_zoom_reset,diff --git a/src/config/loader_parse.zig b/src/config/loader_parse.zigindex 3ba5bcd..ed268ad 100644--- a/src/config/loader_parse.zig+++ b/src/config/loader_parse.zig@@ -250,13 +250,13 @@ const ParseState = struct {if (state.seen_keybinds) {// Keep laptop controls, System Monitor, nested-session switching, the- // input source shortcut and the way out of an inhibiting client+ // overview, input source shortcut and the way out of an inhibiting client// available in existing configs too.// Explicit bindings (including noop) always take precedence.const defaults = try parseKeybindsOnly(cfg.arena.allocator(), default_file.source);for (defaults) |bind| {const nested_switcher = bind.modifiers.ctrl and (bind.action == .focus_next or bind.action == .focus_prev);- if (!keybinds.isHardwareAction(bind.action) and !nested_switcher and bind.action != .restore_shortcuts and bind.action != .open_system_monitor and bind.action != .input_source_next) continue;+ if (!keybinds.isHardwareAction(bind.action) and !nested_switcher and bind.action != .restore_shortcuts and bind.action != .open_system_monitor and bind.action != .input_source_next and bind.action != .toggle_overview) continue;const key = keybinds.pack(bind.modifiers, bind.sym);var overridden = false;for (state.bind_list.items) |custom| {diff --git a/src/config_runtime/actions.zig b/src/config_runtime/actions.zigindex 252aeca..6677b02 100644--- a/src/config_runtime/actions.zig+++ b/src/config_runtime/actions.zig@@ -17,6 +17,7 @@ pub fn executeAction(server: *Server, action: Action) void {if (keybinds.worksWhileLocked(action)) if (server.input_sources) |sources| sources.cycleLayouts();return;}+ if (action != .toggle_overview and !keybinds.isHardwareAction(action)) server.world.overview.cancel(&server.world);if (server.world.workspaces.active) switch (action) {.set_depth, .zoom_in, .zoom_out, .zoom_reset, .camera_zoom_in, .camera_zoom_out, .camera_zoom_reset, .pan_left, .pan_right, .pan_up, .pan_down => return,else => {},@@ -49,6 +50,7 @@ pub fn executeAction(server: *Server, action: Action) void {.zoom_in => zoomFocused(server, -1),.zoom_out => zoomFocused(server, 1),.zoom_reset => setFocusedZoom(server, 0),+ .toggle_overview => server.world.overview.toggle(&server.world),.camera_zoom_in => cameraZoom(server, -1),.camera_zoom_out => cameraZoom(server, 1),.camera_zoom_reset => cameraZoomReset(server),diff --git a/src/config_runtime/apply.zig b/src/config_runtime/apply.zigindex a63bfae..6f93485 100644--- a/src/config_runtime/apply.zig+++ b/src/config_runtime/apply.zig@@ -23,6 +23,7 @@ const themeEql = loader.themeEql;const wheelAccel = loader.wheelAccel;pub const applyInactiveOpacity = applyWindowOpacity;pub fn applyDiff(server: *Server, old: Config, new: Config) void {+ server.world.overview.cancel(&server.world);const pack_changed = !std.mem.eql(u8, old.theme_base, new.theme_base) or!std.mem.eql(u8, if (old.theme_pack) |p| p.root else "", if (new.theme_pack) |p| p.root else "") or!std.mem.eql(u8, if (old.theme_pack) |p| p.bytes else "", if (new.theme_pack) |p| p.bytes else "");diff --git a/src/control_center/sections/shortcuts.zig b/src/control_center/sections/shortcuts.zigindex 3e764b3..bdb9c69 100644--- a/src/control_center/sections/shortcuts.zig+++ b/src/control_center/sections/shortcuts.zig@@ -99,7 +99,7 @@ pub const Section = struct {fn group(action: keys.Action) usize {return switch (action) {.toggle_floating, .toggle_split, .toggle_workspace_tiling, .swap_left, .swap_right, .swap_up, .swap_down, .resize_split_left, .resize_split_right, .resize_split_up, .resize_split_down, .close_window, .toggle_fullscreen, .toggle_maximize, .tile_left, .tile_right, .tile_up, .tile_down => 0,- .set_depth, .zoom_in, .zoom_out, .zoom_reset, .camera_zoom_in, .camera_zoom_out, .camera_zoom_reset, .pan_left, .pan_right, .pan_up, .pan_down, .focus_next, .focus_prev, .focus_left, .focus_right, .focus_up, .focus_down, .save_layout, .restore_layout, .undo => 1,+ .toggle_overview, .set_depth, .zoom_in, .zoom_out, .zoom_reset, .camera_zoom_in, .camera_zoom_out, .camera_zoom_reset, .pan_left, .pan_right, .pan_up, .pan_down, .focus_next, .focus_prev, .focus_left, .focus_right, .focus_up, .focus_down, .save_layout, .restore_layout, .undo => 1,.spawn, .toggle_start_menu, .input_source_next, .input_source_prev => 2,.screenshot_region, .screenshot_output => 3,.volume_up, .volume_down, .volume_mute, .mic_mute, .brightness_up, .brightness_down, .power_profile_cycle => 4,@@ -253,6 +253,7 @@ fn descriptionFor(action: keys.Action, buf: []u8) []const u8 {.zoom_in => i18n.tr("Increase the focused window's size."),.zoom_out => i18n.tr("Decrease the focused window's size."),.zoom_reset => i18n.tr("Restore the focused window's size."),+ .toggle_overview => i18n.tr("Spread all canvas windows into a grid, including minimized windows."),.camera_zoom_in => i18n.tr("Zoom into the desktop canvas."),.camera_zoom_out => i18n.tr("Zoom out of the desktop canvas."),.camera_zoom_reset => i18n.tr("Restore the desktop zoom."),@@ -339,6 +340,7 @@ fn actionTitle(action: keys.Action) []const u8 {.zoom_in => i18n.tr("Zoom In"),.zoom_out => i18n.tr("Zoom Out"),.zoom_reset => i18n.tr("Zoom Reset"),+ .toggle_overview => i18n.tr("Window Overview"),.camera_zoom_in => i18n.tr("Camera Zoom In"),.camera_zoom_out => i18n.tr("Camera Zoom Out"),.camera_zoom_reset => i18n.tr("Camera Zoom Reset"),diff --git a/src/input/axis.zig b/src/input/axis.zigindex adfcc50..0483fe9 100644--- a/src/input/axis.zig+++ b/src/input/axis.zig@@ -49,7 +49,7 @@ pub fn processAxis(}if (input.server.polkit_dialog != null or input.server.screenshot_selector.output != null) return;if (input.server.world.mini_map.dragging) return;- if (input.server.switcher.active()) return;+ if (input.server.switcher.active() or input.server.world.overview.active()) return;// Flip here, before zoom/UI/client branches, so `invert_scroll` behaves// like `natural_scroll` would if libinput's device toggle applied to// this device: a single, uniform reversal rather than one per consumer.diff --git a/src/input/buttons.zig b/src/input/buttons.zigindex 639bf1c..666b17b 100644--- a/src/input/buttons.zig+++ b/src/input/buttons.zig@@ -43,6 +43,10 @@ pub fn processButton(input.processCursorMotion(time_msec);return;}+ if (state == .released and input.overview_buttons & map_bit != 0) {+ input.overview_buttons &= ~map_bit;+ return;+ }if (input.server.locker) |lock| {// Before the client: a drag begun on the built-in screen must end.if (state == .released and button == btn_left) lock.pointerReleased();@@ -61,6 +65,13 @@ pub fn processButton(if (button == btn_left) dialog.button(state == .pressed, input.cursor.x, input.cursor.y);return;}+ if (input.server.world.overview.active()) {+ if (state == .pressed) {+ input.overview_buttons |= map_bit;+ input.server.world.overview.press(&input.server.world, button);+ }+ return;+ }const screenshot_bit: u32 = if (button >= 272 and button < 304) @as(u32, 1) << @as(u5, @intCast(button - 272)) else 0;if (state == .released and input.screenshot_buttons & screenshot_bit != 0) {input.screenshot_buttons &= ~screenshot_bit;diff --git a/src/input/gestures.zig b/src/input/gestures.zigindex 71ef614..6126875 100644--- a/src/input/gestures.zig+++ b/src/input/gestures.zig@@ -55,7 +55,7 @@ pub fn cursorHoldEnd(listener: *wl.Listener(*wlr.Pointer.event.HoldEnd), event:/// Camera changes cannot invalidate an in-flight client or compositor grab.pub fn canZoom(input: *Input) bool {- if (input.server.world.workspaces.active) return false;+ if (input.server.world.workspaces.active or input.server.world.overview.active()) return false;if (input.server.world.mini_map.dragging) return false;if (input.active_buttons != 0 or input.resize_session != null or input.seat.pointerHasGrab()) return false;if (input.server.world.pinching) return false;@@ -71,14 +71,14 @@ pub fn clientSurfaceHit(hit: scene_data.Hit) bool {}pub fn compositorOwnsPinch(input: *Input) bool {- if (input.server.world.workspaces.active) return false;+ if (input.server.world.workspaces.active or input.server.world.overview.active()) return false;if (input.server.locker != null or input.server.polkit_dialog != null or input.server.switcher.active()) return false;if (input.cursor_mode == .move or input.cursor_mode == .resize or input.resize_session != null) return false;return !clientSurfaceHit(scene_data.hitTest(input.server, input.cursor.x, input.cursor.y));}pub fn compositorOwnsSwipe(input: *Input, fingers: u32) bool {- if (input.server.world.workspaces.active) return false;+ if (input.server.world.workspaces.active or input.server.world.overview.active()) return false;if (fingers != 2) return false;if (input.server.locker != null or input.server.polkit_dialog != null or input.server.switcher.active()) return false;if (input.cursor_mode != .passthrough or input.resize_session != null) return false;@@ -86,7 +86,7 @@ pub fn compositorOwnsSwipe(input: *Input, fingers: u32) bool {}pub fn handlePinchBegin(input: *Input, time_msec: u32, fingers: u32) void {- if (input.server.polkit_dialog != null) return;+ if (input.server.polkit_dialog != null or input.server.world.overview.active()) return;if (input.server.idle) |im| im.notifyActivity(.pointer);if (input.gesture == .compositor_swipe) {input.server.world.endPanGesture();@@ -103,7 +103,7 @@ pub fn handlePinchBegin(input: *Input, time_msec: u32, fingers: u32) void {}pub fn handlePinchUpdate(input: *Input, time_msec: u32, dx: f64, dy: f64, scale: f64, rotation: f64) void {- if (input.server.polkit_dialog != null) return;+ if (input.server.polkit_dialog != null or input.server.world.overview.active()) return;if (input.gesture == .compositor_pinch) {input.server.world.pinchTo(scale);return;@@ -125,7 +125,7 @@ pub fn handlePinchEnd(input: *Input, time_msec: u32, cancelled: bool) void {}pub fn handleSwipeBegin(input: *Input, time_msec: u32, fingers: u32) void {- if (input.server.polkit_dialog != null) return;+ if (input.server.polkit_dialog != null or input.server.world.overview.active()) return;if (input.server.idle) |im| im.notifyActivity(.pointer);if (input.gesture == .compositor_pinch) {input.server.world.endPinch(false);@@ -141,7 +141,7 @@ pub fn handleSwipeBegin(input: *Input, time_msec: u32, fingers: u32) void {}pub fn handleSwipeUpdate(input: *Input, time_msec: u32, dx: f64, dy: f64) void {- if (input.server.polkit_dialog != null) return;+ if (input.server.polkit_dialog != null or input.server.world.overview.active()) return;if (input.gesture == .compositor_swipe) {const z = input.server.world.camera.zoom();const pan_speed = input.server.config.input.pan_speed;diff --git a/src/input/motion.zig b/src/input/motion.zigindex 3816745..ca72423 100644--- a/src/input/motion.zig+++ b/src/input/motion.zig@@ -232,6 +232,10 @@ fn updateWidgetProximity(input: *Input) void {pub fn processCursorMotion(input: *Input, time_msec: u32) void {if (input.server.locker != null or input.server.polkit_dialog != null) return;+ if (input.server.world.overview.active()) {+ input.server.world.overview.motion(&input.server.world, input.cursor.x, input.cursor.y);+ return;+ }if (input.server.switcher.active()) {input.server.switcher.motion(input.cursor.x, input.cursor.y);return;diff --git a/src/input/targets.zig b/src/input/targets.zigindex 0a50d18..85c8032 100644--- a/src/input/targets.zig+++ b/src/input/targets.zig@@ -36,7 +36,7 @@ pub fn isSuperHeld(input: *Input) bool {/// The `.super_key` pan trigger: `[input] pan_modifier` held on any keyboards.pub fn isPanModifierHeld(input: *Input) bool {- if (input.server.world.workspaces.active) return false;+ if (input.server.world.workspaces.active or input.server.world.overview.active()) return false;return switch (input.server.config.input.pan_modifier) {.super => input.isSuperHeld(),.super_alt => input.isDesktopZoomHeld(),@@ -103,7 +103,7 @@ pub fn focusedSurfaceToLayout(input: *const Input, sx: f64, sy: f64) geometry.Ve/// rather than to a compositor grab, pan, selector, menu or lock.pub fn motionReachesClient(input: *const Input) bool {const server = input.server;- if (server.locker != null or server.polkit_dialog != null or server.switcher.active()) return false;+ if (server.locker != null or server.polkit_dialog != null or server.switcher.active() or server.world.overview.active()) return false;if (server.screenshot_selector.output != null) return false;if (input.cursor_mode != .passthrough or input.grabbed_toplevel != null or input.resize_session != null) return false;if (input.server.world.mini_map.dragging) return false;@@ -118,7 +118,7 @@ pub fn motionReachesClient(input: *const Input) bool {/// menus, grabs and click-outside dismissal behave as for a mouse.pub fn directInputReachesClients(input: *Input) bool {const server = input.server;- if (server.locker != null or server.polkit_dialog != null or server.switcher.active()) return false;+ if (server.locker != null or server.polkit_dialog != null or server.switcher.active() or server.world.overview.active()) return false;if (server.screenshot_selector.output != null) return false;if (input.cursor_mode != .passthrough or input.grabbed_toplevel != null or input.resize_session != null) return false;if (input.server.world.mini_map.dragging) return false;diff --git a/src/input/text_input.zig b/src/input/text_input.zigindex a36275a..c45083f 100644--- a/src/input/text_input.zig+++ b/src/input/text_input.zig@@ -71,7 +71,7 @@ pub const GrabPurpose = enum { new_input, state };pub fn keyboardGrab(self: *Self, keyboard: *wlr.Keyboard, purpose: GrabPurpose) ?*wlr.InputMethodV2.KeyboardGrab {const input = &self.server.input;if (self.server.locker != null or self.server.polkit_dialog != null) return null;- if (purpose == .new_input and (self.server.switcher.active() or+ if (purpose == .new_input and (self.server.switcher.active() or self.server.world.overview.active() orinput.open_wifi != null or input.open_battery != null or input.open_calendar != null or input.open_start_menu != null or (if (input.open_control_center) |cc| cc.hasKeyboardFocus() else false) or input.open_power_menu != null)) return null;const method = self.method orelse return null;const grab = self.grab orelse return null;@@ -380,7 +380,7 @@ pub fn updatePopups(self: *Self) void {while (it.next()) |popup| {const visible = visible: {const shell = &self.server.input;- if (self.server.locker != null or self.server.polkit_dialog != null or self.server.switcher.active() or+ if (self.server.locker != null or self.server.polkit_dialog != null or self.server.switcher.active() or self.server.world.overview.active() orshell.open_start_menu != null or shell.open_wifi != null or shell.open_battery != null or shell.open_calendar != null or shell.open_power_menu != null or(if (shell.open_control_center) |cc| cc.hasKeyboardFocus() else false)) break :visible false;const input = (self.active orelse break :visible false).input;diff --git a/src/keyboard/overview.zig b/src/keyboard/overview.zignew file mode 100644index 0000000..42cc317--- /dev/null+++ b/src/keyboard/overview.zig@@ -0,0 +1,47 @@+//! Overview owns new presses, while processKey routes pre-existing releases+//! back to their recipients and keeps hardware, lock/auth and Monitor priority.+const Keyboard = @import("../Keyboard.zig");+const wl = @import("wayland").server.wl;+const xkb = @import("xkbcommon");++pub fn process(keyboard: *Keyboard, code: u32, state: wl.Keyboard.KeyState) bool {+ const world = &keyboard.server.world;+ const mods = keyboard.device.toKeyboard().getModifiers();+ if (!world.overview.active()) {+ if (state != .pressed or keyboard.server.input.shortcuts_inhibit.inhibiting()) return false;+ // The configured shortcut also works over shell panels. Shortcut+ // recording, lock/auth and hardware routing have already run.+ for (keyboard.bindingSyms(code + 8)) |sym| {+ const action = keyboard.server.config.lookupKeybind(mods, sym) orelse continue;+ if (action != .toggle_overview) continue;+ if (code < keyboard.shortcut_consumed.len) keyboard.shortcut_consumed[code] = true;+ world.overview.toggle(world);+ return true;+ }+ return false;+ }+ if (state != .pressed) return true;+ if (code < keyboard.shortcut_consumed.len) keyboard.shortcut_consumed[code] = true;+ for (keyboard.bindingSyms(code + 8)) |sym| {+ if (keyboard.server.config.lookupKeybind(mods, sym)) |action| {+ if (action == .toggle_overview) {+ world.overview.dismiss(world);+ return true;+ }+ if (action == .lock_screen) {+ keyboard.server.executeAction(action);+ return true;+ }+ }+ switch (sym) {+ xkb.Keysym.Escape => world.overview.dismiss(world),+ xkb.Keysym.Return, xkb.Keysym.KP_Enter => world.overview.accept(world),+ xkb.Keysym.Left => world.overview.navigate(world, -1, 0),+ xkb.Keysym.Right => world.overview.navigate(world, 1, 0),+ xkb.Keysym.Up => world.overview.navigate(world, 0, -1),+ xkb.Keysym.Down => world.overview.navigate(world, 0, 1),+ else => {},+ }+ }+ return true;+}diff --git a/src/keyboard/process.zig b/src/keyboard/process.zigindex 7fe5fa6..e96681e 100644--- a/src/keyboard/process.zig+++ b/src/keyboard/process.zig@@ -174,6 +174,8 @@ pub fn processKey(keyboard: *Keyboard, time_msec: u32, event_keycode: u32, state}}+ if (@import("overview.zig").process(keyboard, event_keycode, state)) return;+if (event_keycode < keyboard.battery_consumed.len and state == .released and keyboard.battery_consumed[event_keycode]) {keyboard.battery_consumed[event_keycode] = false;return;diff --git a/src/polkit/dialog.zig b/src/polkit/dialog.zigindex 0d0202b..105c3cb 100644--- a/src/polkit/dialog.zig+++ b/src/polkit/dialog.zig@@ -64,6 +64,7 @@ pub const Dialog = struct {@import("../extra_protocols.zig").rediwm_protocols_revoke(server.extra_protocols);// End active capture before any authentication pixels are presented.if (server.capture_mgr) |manager| manager.stopAll();+ server.world.overview.cancel(&server.world);server.switcher.cancel();server.screenshot_selector.cancel();server.input.clearGrab();diff --git a/src/server/teardown.zig b/src/server/teardown.zigindex 1a28c52..cd839c5 100644--- a/src/server/teardown.zig+++ b/src/server/teardown.zig@@ -19,6 +19,7 @@ pub fn deinit(server: *Server) void {// here. In both cases save before tearing down Xwayland or native clients.const already_terminating = server.shutting_down;server.shutting_down = true;+ server.world.overview.cancel(&server.world);server.startup_tasks.deinit();server.reveal.deinit();server.session_startup.deinit();diff --git a/src/session/lock.zig b/src/session/lock.zigindex 709e356..fcafc1b 100644--- a/src/session/lock.zig+++ b/src/session/lock.zig@@ -138,6 +138,7 @@ pub const Lock = struct {announce(server, true);_ = c.mlock(&self.password, self.password.len);platform.process.denyDumps() catch {};+ server.world.overview.cancel(&server.world);server.switcher.cancel();server.screenshot_selector.cancel();server.locker = self;diff --git a/src/toplevel/appearance.zig b/src/toplevel/appearance.zigindex bc0bc1b..4843328 100644--- a/src/toplevel/appearance.zig+++ b/src/toplevel/appearance.zig@@ -37,7 +37,11 @@ pub fn effectiveOpacity(toplevel: *Toplevel, now_ms: i64) f32 {const inactive = std.math.clamp(toplevel.server.config.compositor.inactive_opacity, 0, 1);const normal = (toplevel.live_rules.opacity orelse 1) * (if (toplevel == focused) @as(f32, 1) else inactive);const mix = toplevel.peek_mix.value(now_ms);- return (normal * (1 - mix) + toplevel.peek_level.value(now_ms) * mix) * toplevel.cameraFocusOpacity();+ const overview = &toplevel.server.world.overview;+ const spread = if (overview.contains(toplevel.id)) @as(f32, @floatCast(overview.amount(now_ms))) else 0;+ const hidden = overview.contains(toplevel.id) and toplevel.minimized and overview.activate != toplevel.id;+ const opacity = if (hidden) 0 else (normal * (1 - mix) + toplevel.peek_level.value(now_ms) * mix) * toplevel.cameraFocusOpacity();+ return opacity + (1 - opacity) * spread;}/// 1 for a window that should show dimmed: not the focus, unless the dim is off,@@ -55,7 +59,9 @@ pub fn dimTarget(toplevel: *Toplevel) f32 {pub fn applyDim(toplevel: *Toplevel, now_ms: i64) void {const target = toplevel.dimTarget();if (toplevel.dim_anim.to != target) toplevel.dim_anim.retargetTo(now_ms, target, anim.curveFor(.window_dim));- const level = toplevel.dim_anim.value(now_ms) * (1 - toplevel.peek_mix.value(now_ms));+ const overview = &toplevel.server.world.overview;+ const spread = if (overview.contains(toplevel.id)) @as(f32, @floatCast(overview.amount(now_ms))) else 0;+ const level = toplevel.dim_anim.value(now_ms) * (1 - toplevel.peek_mix.value(now_ms)) * (1 - spread);// Whole levels of an 8-bit channel: a finer step shows nothing and would only repaint.const amount = std.math.clamp(@round(level * toplevel.server.config.compositor.inactive_dim_amount * 255) / 255, 0, 1);if (amount == toplevel.dim_shown) return;diff --git a/src/toplevel/chrome_sync.zig b/src/toplevel/chrome_sync.zigindex 2278576..a289dc9 100644--- a/src/toplevel/chrome_sync.zig+++ b/src/toplevel/chrome_sync.zig@@ -70,9 +70,14 @@ pub fn releaseIcon(toplevel: *Toplevel) void {/// Density of the sharpest output touched by the displayed frame. Keep the/// previous density while offscreen to avoid repainting invisible windows.pub fn syncOutputScale(toplevel: *Toplevel) void {- const origin = toplevel.server.world.toLayout(@floatFromInt(toplevel.x), @floatFromInt(toplevel.y));- const width = @as(f64, @floatFromInt(toplevel.chrome_width)) * toplevel.zoom();- const height = @as(f64, @floatFromInt(toplevel.chrome_height)) * toplevel.zoom();+ var origin = toplevel.server.world.toLayout(@floatFromInt(toplevel.x), @floatFromInt(toplevel.y));+ var width = @as(f64, @floatFromInt(toplevel.chrome_width)) * toplevel.zoom();+ var height = @as(f64, @floatFromInt(toplevel.chrome_height)) * toplevel.zoom();+ if (@import("../world/overview_cards.zig").find(&toplevel.server.world.overview, toplevel.id)) |card| {+ origin = .{ .x = card.presented.x, .y = card.presented.y };+ width = card.presented.width;+ height = card.presented.height;+ }var scale: f32 = 0;var it = toplevel.server.outputs.iterator(.forward);while (it.next()) |out| {diff --git a/src/toplevel/motion.zig b/src/toplevel/motion.zigindex 2d36c01..97995ee 100644--- a/src/toplevel/motion.zig+++ b/src/toplevel/motion.zig@@ -79,7 +79,7 @@ pub fn ignoreCloseInput(_: *sn.Buffer, _: *f64, _: *f64) callconv(.c) bool {pub fn applyVisualTransform(toplevel: *Toplevel, now_ms: i64) void {const zoom_scale = toplevel.worldScale();if (toplevel.in_world and !toplevel.closing) {- toplevel.frame_tree.node.setEnabled(toplevel.switch_leaving or (@import("../window_tabs.zig").visible(toplevel) and toplevel.cameraFocusOpacity() > 0));+ toplevel.frame_tree.node.setEnabled(toplevel.switch_leaving or toplevel.server.world.overview.contains(toplevel.id) or (@import("../window_tabs.zig").visible(toplevel) and toplevel.cameraFocusOpacity() > 0));}// Open keeps tree zoom at the logical window zoom so scene picking and// client-local coordinates stay 1:1 with the mapped frame (existing@@ -92,6 +92,7 @@ pub fn applyVisualTransform(toplevel: *Toplevel, now_ms: i64) void {const lift = toplevel.dragLiftOffset();const x = visualX(toplevel, now_ms) + animOffset(toplevel.dodge_x, now_ms) + animOffset(toplevel.switch_x, now_ms) - lift.x;const y = visualY(toplevel, now_ms) + animOffset(toplevel.dodge_y, now_ms) + animOffset(toplevel.switch_y, now_ms) - lift.y;+ if (toplevel.server.world.overview.apply(toplevel, x, y, zoom_scale * factor * toplevel.drag_lift_value, now_ms)) return;if (!toplevel.closing) if (toplevel.launch_origin) |origin| {const grow = launchGrowth(toplevel, origin, x, y, zoom_scale * toplevel.drag_lift_value, toplevel.map_motion.value(now_ms));_ = @import("../projection.zig").setTreeZoom(&toplevel.frame_tree.node, grow.zoom);diff --git a/src/ui_tests.zig b/src/ui_tests.zigindex 6744c8b..b16ae89 100644--- a/src/ui_tests.zig+++ b/src/ui_tests.zig@@ -58,6 +58,7 @@ test {_ = @import("panel_paint.zig");_ = @import("resize.zig");_ = @import("camera.zig");+ _ = @import("world/overview_layout.zig");_ = @import("mini_map_geometry.zig");_ = @import("switcher/layout.zig");_ = @import("calendar.zig");diff --git a/src/workspaces.zig b/src/workspaces.zigindex bf66ad9..65d28d8 100644--- a/src/workspaces.zig+++ b/src/workspaces.zig@@ -92,6 +92,7 @@ pub fn reveal(self: *Self, top: *Top) void {}pub fn cancelGestures(server: *Server) void {+ server.world.overview.cancel(&server.world);server.switcher.cancel();_ = server.input.cancelDrag();server.input.clearGrab();diff --git a/src/world/camera.zig b/src/world/camera.zigindex e7a4519..0b25f40 100644--- a/src/world/camera.zig+++ b/src/world/camera.zig@@ -97,13 +97,13 @@ pub fn applyCamera(world: *World) void {}pub fn allowsOverscroll(world: *const World) bool {- return world.panning or world.pan_x.active() or world.pan_y.active();+ return world.overview.active() or world.panning or world.pan_x.active() or world.pan_y.active();}/// True while the camera is being dragged or its springs/fling are in flight./// Glass holds every backdrop for that interval and refreshes on the settle frame.pub fn holdingGlass(world: *const World) bool {- return world.panning or world.pinching or world.pan_x.active() or world.pan_y.active() or world.zoom_anim.active();+ return (world.overview.active() and world.overview.spread.active()) or world.panning or world.pinching or world.pan_x.active() or world.pan_y.active() or world.zoom_anim.active();}/// Analytic camera at `now_ms`, for IPC. Presentation still uses `world.camera`@@ -301,10 +301,10 @@ pub fn tickCamera(world: *World, now_ms: i64) bool {if (!world.panning and !world.zoom_keeps_anchor) {const pan_x_live = world.pan_x.active();const pan_y_live = world.pan_y.active();- if (tickPanAxis(&world.pan_x, &world.camera.offset_x, now_ms, true, world.bounds, world.camera.zoom())) {+ if (tickPanAxis(&world.pan_x, &world.camera.offset_x, now_ms, true, world.bounds, world.camera.zoom(), !world.overview.active())) {animating = true;}- if (tickPanAxis(&world.pan_y, &world.camera.offset_y, now_ms, false, world.bounds, world.camera.zoom())) {+ if (tickPanAxis(&world.pan_y, &world.camera.offset_y, now_ms, false, world.bounds, world.camera.zoom(), !world.overview.active())) {animating = true;}if (pan_x_live or pan_y_live) moved = true;@@ -324,6 +324,7 @@ pub fn tickPanAxis(is_x: bool,bounds: camera_mod.Bounds,zoom: f64,+ constrain: bool,) bool {if (!a.active()) return false;_ = a.sampleChanged(now_ms, anim.quantum_px);@@ -343,7 +344,7 @@ pub fn tickPanAxis(dest.* = value;if (a.settled(now_ms)) {const rest: f64 = a.to;- dest.* = if (rest < lo) lo else if (rest > hi) hi else rest;+ dest.* = if (!constrain) rest else if (rest < lo) lo else if (rest > hi) hi else rest;a.cancel(@floatCast(dest.*));return false;}diff --git a/src/world/focus.zig b/src/world/focus.zigindex 8259128..65e2ced 100644--- a/src/world/focus.zig+++ b/src/world/focus.zig@@ -34,6 +34,7 @@ pub fn isSurfaceOrOwnPopupOf(surface: *wlr.Surface, toplevel_surface: *wlr.Surfa/// subsurface, or the window's own surface when null).pub fn focusSurface(world: *World, toplevel: *Toplevel, surface: ?*wlr.Surface) void {if (world.server.locker != null or world.server.polkit_dialog != null) return;+ world.overview.cancel(world);// Only windows in the stack can be raised; the reorder below needs the link.if (!toplevel.in_world) return;world.workspaces.reveal(toplevel);@@ -178,7 +179,7 @@ pub fn cycleFocusPrev(world: *World) void {/// after leaving the taskbar. Also called from input events so a quick release/// and re-press between frames cannot retain the previous preview.pub fn peekTarget(world: *World) ?*Toplevel {- if (world.workspaces.active) return null;+ if (world.workspaces.active or world.overview.active()) return null;const input = &world.server.input;var held = false;var keyboards = input.keyboards.iterator(.forward);@@ -252,6 +253,8 @@ pub fn tickHover(world: *World, now_ms: i64) bool {if (!toplevel.peek_mix.settled(now_ms) or !toplevel.peek_level.settled(now_ms)) animating = true;}+ if (world.overview.update(world, now_ms)) animating = true;+var close_it = world.closing.iterator(.forward);while (close_it.next()) |toplevel| {const still = toplevel.tickMap(now_ms);diff --git a/src/world/overview.zig b/src/world/overview.zignew file mode 100644index 0000000..9b365cc--- /dev/null+++ b/src/world/overview.zig@@ -0,0 +1,296 @@+//! Temporary spread of live windows, including minimized windows. Presentation+//! transforms leave client geometry, saved positions and focus intact until a+//! selection is accepted. IDs survive client teardown while overview is open.+const std = @import("std");+const World = @import("../World.zig");+const Top = @import("../Toplevel.zig");+const Output = @import("../Output.zig");+const camera = @import("../camera.zig");+const anim = @import("ui").anim;+const sn = @import("../node.zig");+const Self = @This();+const cards_mod = @import("overview_cards.zig");+const gpa = @import("../main.zig").gpa;++saved: ?camera.Camera = null,+destination: camera.Camera = .{},+returning: bool = false,+selected: ?u64 = null,+activate: ?u64 = null,+boosted: ?u64 = null,+output: ?*Output = null,+tree: ?*sn.Tree = null,+edges: [4]*sn.Buffer = undefined,+pointer_x: f64 = 0,+pointer_y: f64 = 0,+cards: std.ArrayList(cards_mod.Card) = .empty,+spread: anim.Anim = .{},++pub const apply = cards_mod.apply;++pub fn amount(self: *const Self, now: i64) f64 {+ return if (self.active()) std.math.clamp(self.spread.value(now), 0, 1) else 0;+}++pub fn contains(self: *Self, id: u64) bool {+ return self.active() and cards_mod.find(self, id) != null;+}++pub fn active(self: *const Self) bool {+ return self.saved != null;+}++pub fn eligible(top: *Top) bool {+ return top.in_world and !top.backend_gone and !top.closing and+ !top.tab_hidden and top.chrome_width > 0 and top.chrome_height > 0;+}++pub fn find(world: *World, id: ?u64) ?*Top {+ var it = world.toplevels.iterator(.forward);+ while (it.next()) |top| if (id == top.id and eligible(top)) return top;+ return null;+}++pub fn toggle(self: *Self, world: *World) void {+ if (self.active()) {+ self.dismiss(world);+ return;+ }+ const server = world.server;+ const input = &server.input;+ if (world.workspaces.active or server.locker != null or server.polkit_dialog != null or+ input.cursor_mode != .passthrough or input.active_buttons != 0 or input.seat.drag != null or+ input.seat.pointerHasGrab() or input.gesture != .none or input.desktop_grab or input.dock_drag.active()) return;+ const output = server.getDefaultOutput() orelse return;+ if (!output.isLogicallyEnabled() or output.idle_blanked) return;+ self.output = output;+ if (output.usableBox().width <= 80 or output.usableBox().height <= 80) return;+ self.createOutline(server.overlay_tree) catch {+ self.output = null;+ return;+ };+ cards_mod.prepare(self, world) catch {+ self.clear();+ return;+ };+ if (self.cards.items.len == 0) {+ self.clear();+ return;+ }+ self.saved = world.sampledCamera(anim.nowMs());+ // Preserve the view actually on screen, even when invoked mid-animation.+ if (@abs(self.saved.?.targetZoom() - self.saved.?.zoom()) > 1e-9) self.saved.?.focus_zoom = self.saved.?.zoom();+ self.returning = false;+ self.activate = null;+ self.boosted = null;+ var it = world.toplevels.iterator(.forward);+ while (it.next()) |top| {+ @import("../effects/window_minimize.zig").cancelFor(server, top.id);+ if (top.zoom_boost.to > 0) self.boosted = top.id;+ top.setZoomBoost(false);+ if (self.selected == null and eligible(top)) self.selected = top.id;+ }+ server.switcher.cancel();+ server.screenshot_selector.cancel();+ input.window_menu.close();+ if (server.tray) |tray| tray.closeMenu();+ var outputs = server.outputs.iterator(.forward);+ while (outputs.next()) |out| {+ out.closeStartMenu();+ out.closePowerMenu();+ out.closeWifi();+ out.closeBattery();+ out.closeCalendar();+ }+ var keyboards = input.keyboards.iterator(.forward);+ while (keyboards.next()) |keyboard| {+ keyboard.stopRepeat();+ keyboard.stopShellRepeat();+ keyboard.stopSwitcherRepeat();+ }+ world.peek_window_id = null;+ world.mini_map.hide();+ input.seat.pointerClearFocus();+ input.pointer_constraints.sync();+ input.setDefaultCursor();+ self.pointer_x = input.cursor.x;+ self.pointer_y = input.cursor.y;+ self.spread.retargetTo(anim.nowMs(), 1, anim.curveFor(.camera_zoom));+ self.transition(world, self.saved.?);+}++fn transition(self: *Self, world: *World, target: camera.Camera) void {+ self.destination = target;+ const now = anim.nowMs();+ world.panning = false;+ world.pinching = false;+ world.zoom_keeps_anchor = false;+ world.camera.zoom_index = target.zoom_index;+ world.camera.focus_zoom = target.targetZoom();+ world.camera.zoom_limit = @max(world.camera.zoom_limit, target.zoom());+ world.pan_target = .camera_reveal;+ world.pan_x = .{ .from = @floatCast(world.camera.offset_x), .to = @floatCast(world.camera.offset_x) };+ world.pan_y = .{ .from = @floatCast(world.camera.offset_y), .to = @floatCast(world.camera.offset_y) };+ world.zoom_anim = .{ .from = @floatCast(world.camera.zoom()), .to = @floatCast(world.camera.zoom()) };+ world.pan_x.retargetTo(now, @floatCast(target.offset_x), anim.curveFor(.camera_reveal));+ world.pan_y.retargetTo(now, @floatCast(target.offset_y), anim.curveFor(.camera_reveal));+ world.zoom_anim.retargetTo(now, @floatCast(target.zoom()), anim.curveFor(.camera_zoom));+ if (!world.pan_x.active() and !world.pan_y.active() and !world.zoom_anim.active()) {+ world.camera = target;+ } else {+ _ = world.tickCamera(now);+ }+ world.applyCamera();+}++pub fn dismiss(self: *Self, world: *World) void {+ const saved = self.saved orelse return;+ if (self.returning) return;+ self.returning = true;+ self.activate = null;+ self.spread.retargetTo(anim.nowMs(), 0, anim.curveFor(.camera_zoom));+ self.transition(world, saved);+}++pub fn accept(self: *Self, world: *World) void {+ var target = self.saved orelse return;+ if (self.returning) return;+ const top = find(world, self.selected) orelse return self.dismiss(world);+ const mode = world.server.config.compositor.focus_zoom;+ const floating = top.layout() == .floating and !top.isFullscreen();+ // Camera-focus windows live at different depths. Visiting one must use+ // its depth, or the restored camera can pass it and make it invisible.+ if (mode == .camera and floating) {+ target.zoom_value = 1 / top.zoom_scale;+ target.focus_zoom = target.zoom_value;+ target.zoom_limit = @max(1, target.zoom_value);+ }+ const scale = if (mode == .boost and floating) 1 / target.zoom() else top.zoom_scale;+ if (world.windowFocusOffset(top, self.output.?, target, scale, true)) |offset| {+ target.offset_x = offset.x;+ target.offset_y = offset.y;+ }+ self.activate = top.id;+ self.returning = true;+ self.spread.retargetTo(anim.nowMs(), 0, anim.curveFor(.camera_zoom));+ self.transition(world, target);+}++/// Immediate teardown for lock/auth, config reload, output removal and shutdown.+pub fn cancel(self: *Self, world: *World) void {+ const saved = self.saved orelse return;+ world.camera = saved;+ self.finish(world, false);+}++fn finish(self: *Self, world: *World, accepted: bool) void {+ const chosen = if (accepted) self.activate else null;+ const boosted = self.boosted;+ self.clear();+ world.snapCamera();+ if (find(world, chosen)) |top| {+ if (top.minimized) top.restore() else world.focus(top);+ top.setZoomBoost(world.server.config.compositor.focus_zoom == .boost);+ }+ if (chosen == null) if (find(world, boosted)) |top| top.setZoomBoost(true);+ var it = world.toplevels.iterator(.forward);+ while (it.next()) |top| {+ top.applyVisualTransform(anim.nowMs());+ top.applyOpacity(anim.nowMs());+ }+ world.applyCamera();+ world.server.input.processCursorMotion(0);+}++fn clear(self: *Self) void {+ if (self.tree) |tree| tree.node.destroy();+ self.cards.deinit(gpa);+ self.* = .{};+}++/// Update captions and selection after the live window geometry has settled.+pub fn update(self: *Self, world: *World, now: i64) bool {+ if (!self.active()) return false;+ if (!self.output.?.isLogicallyEnabled() or self.output.?.idle_blanked) {+ self.cancel(world);+ return false;+ }+ _ = self.spread.sampleChanged(now, 0.001);+ const moving = !self.spread.settled(now);+ if (!moving) self.spread.cancel(self.spread.to);+ if (self.returning) {+ if (!moving and !world.pan_x.active() and !world.pan_y.active() and !world.zoom_anim.active()) {+ world.camera = self.destination;+ self.finish(world, true);+ return false;+ }+ } else {+ cards_mod.prepare(self, world) catch self.dismiss(world);+ if (self.cards.items.len == 0) self.dismiss(world);+ if (find(world, self.selected) == null) self.selected = if (self.cards.items.len > 0) self.cards.items[0].id else null;+ }+ for (self.cards.items) |card| if (find(world, card.id)) |top| top.applyVisualTransform(now);+ cards_mod.paint(self, now);+ return moving or (self.active() and !self.spread.settled(now));+}++pub fn motion(self: *Self, world: *World, x: f64, y: f64) void {+ if (self.returning or (x == self.pointer_x and y == self.pointer_y)) return;+ self.pointer_x = x;+ self.pointer_y = y;+ if (cards_mod.picked(self, world, x, y)) |id| {+ if (self.selected == id) return;+ self.selected = id;+ world.server.scheduleFrames();+ }+}++pub fn press(self: *Self, world: *World, button: u32) void {+ if (self.returning) return;+ const cursor = world.server.input.cursor;+ if (button == 272) {+ if (cards_mod.picked(self, world, cursor.x, cursor.y)) |id| {+ self.selected = id;+ self.accept(world);+ } else self.dismiss(world);+ } else if (button == 273) self.dismiss(world);+}++pub fn navigate(self: *Self, world: *World, dx: f64, dy: f64) void {+ if (self.returning) return;+ const current = cards_mod.find(self, self.selected orelse return) orelse return;+ const from = current.target;+ var score: f64 = std.math.inf(f64);+ for (self.cards.items) |card| {+ if (card.id == current.id) continue;+ const x = card.target.x + card.target.width / 2 - from.x - from.width / 2;+ const y = card.target.y + card.target.height / 2 - from.y - from.height / 2;+ const along = x * dx + y * dy;+ if (along <= 1) continue;+ const across = @abs(x * dy - y * dx);+ const distance = along + across * 2;+ if (distance < score) {+ score = distance;+ self.selected = card.id;+ }+ }+ world.server.scheduleFrames();+}++fn createOutline(self: *Self, parent: *sn.Tree) !void {+ const tree = try parent.createSceneTree();+ errdefer tree.node.destroy();+ const pixel = try @import("../panel_buffer.zig").PanelBuffer.create(1, 1, 1);+ defer pixel.base.drop();+ const rgba = @import("ui").theme.global.switcher_selected_border;+ pixel.pixels[0] = (@import("../color.zig").Straight{ .r = rgba[0], .g = rgba[1], .b = rgba[2], .a = rgba[3] }).premultiply().argb();+ for (&self.edges) |*edge| {+ edge.* = try tree.createSceneBuffer(&pixel.base);+ edge.*.point_accepts_input = ignoreInput;+ }+ self.tree = tree;+}++pub fn ignoreInput(_: *sn.Buffer, _: *f64, _: *f64) callconv(.c) bool {+ return false;+}diff --git a/src/world/overview_cards.zig b/src/world/overview_cards.zignew file mode 100644index 0000000..d8382a9--- /dev/null+++ b/src/world/overview_cards.zig@@ -0,0 +1,155 @@+//! Overview presentation: stable window IDs, balanced grid, live frame transforms+//! and cached readable captions. No client size or saved window geometry changes.+const std = @import("std");+const World = @import("../World.zig");+const Top = @import("../Toplevel.zig");+const Self = @import("overview.zig");+const sn = @import("../node.zig");+const layout = @import("overview_layout.zig");+const ui = @import("ui");+const gpa = @import("../main.zig").gpa;++pub const Card = struct {+ id: u64,+ label: *sn.Buffer,+ label_hash: u64 = 0,+ label_width: i32 = 0,+ label_height: i32 = 0,+ label_scale: f32 = 0,+ target: layout.Rect = .{},+ caption: layout.Rect = .{},+ presented: layout.Rect = .{},+};++pub fn find(self: *Self, id: u64) ?*Card {+ for (self.cards.items) |*card| if (card.id == id) return card;+ return null;+}++pub fn prepare(self: *Self, world: *World) !void {+ var i: usize = 0;+ while (i < self.cards.items.len) {+ if (Self.find(world, self.cards.items[i].id) == null) {+ self.cards.items[i].label.node.destroy();+ _ = self.cards.orderedRemove(i);+ } else i += 1;+ }+ var it = world.toplevels.iterator(.forward);+ while (it.next()) |top| {+ if (!Self.eligible(top) or find(self, top.id) != null) continue;+ try self.cards.ensureUnusedCapacity(gpa, 1);+ const label = try self.tree.?.createSceneBuffer(null);+ label.point_accepts_input = Self.ignoreInput;+ self.cards.appendAssumeCapacity(.{ .id = top.id, .label = label });+ }+ // Stable spatial order, including identical overlapping frames. Focusing+ // a window changes stacking order but must not shuffle the next overview.+ std.mem.sort(Card, self.cards.items, world, struct {+ fn less(w: *World, a: Card, b: Card) bool {+ const left = Self.find(w, a.id).?;+ const right = Self.find(w, b.id).?;+ if (left.y != right.y) return left.y < right.y;+ if (left.x != right.x) return left.x < right.x;+ return left.id < right.id;+ }+ }.less);+ const area = self.output.?.usableBox();+ const bounds: layout.Rect = .{ .x = @floatFromInt(area.x), .y = @floatFromInt(area.y), .width = @floatFromInt(area.width), .height = @floatFromInt(area.height) };+ for (self.cards.items, 0..) |*card, index| {+ const top = Self.find(world, card.id).?;+ const p = layout.place(self.cards.items.len, index, bounds, @floatFromInt(top.chrome_width), @floatFromInt(top.chrome_height), ui.theme.global.switcher_title_size + 12);+ card.target = p.frame;+ card.caption = p.label;+ try paintLabel(self, card, top);+ }+}++fn paintLabel(self: *Self, card: *Card, top: *Top) !void {+ const title = top.title();+ const hash = std.hash.Wyhash.hash(@intFromBool(top.minimized), title);+ const width: i32 = @max(1, @as(i32, @intFromFloat(@round(card.caption.width))));+ const height: i32 = @max(1, @as(i32, @intFromFloat(@round(card.caption.height))));+ const scale = self.output.?.wlr_output.scale;+ if (card.label_width == width and card.label_height == height and card.label_hash == hash and card.label_scale == scale) return;+ const image = try @import("../panel_buffer.zig").PanelBuffer.create(width, height, self.output.?.wlr_output.scale);+ defer image.base.drop();+ const t = ui.theme.global;+ var renderer = ui.paint.Renderer.init(image.pixels, image.width, image.height, self.output.?.wlr_output.scale);+ renderer.fillRect(0, 0, @floatFromInt(width), @floatFromInt(height), .{ .color = t.switcher_item_bg, .radius = 5 });+ const font = @min(t.switcher_title_size, @as(f32, @floatFromInt(height)) - 4);+ renderer.drawText(8, 0, @floatFromInt(@max(1, width - 16)), @floatFromInt(height), .{+ .content = if (title.len > 0) title else top.appId(),+ .font_size = @max(1, font),+ .color = if (top.minimized) t.switcher_dim else t.switcher_fg,+ });+ card.label.setBuffer(&image.base);+ card.label.setDestSize(width, height);+ card.label_width = width;+ card.label_height = height;+ card.label_hash = hash;+ card.label_scale = scale;+}++/// Override the source frame's presentation only. The projection still draws+/// the real client buffers, subsurfaces, chrome and shapes and paces their frames.+pub fn apply(self: *Self, top: *Top, x: i32, y: i32, scale: f64, now: i64) bool {+ if (!self.active() or top.closing) return false;+ const card = find(self, top.id) orelse return false;+ const world = &top.server.world;+ const amount = self.amount(now);+ const normal = world.toLayout(@floatFromInt(x), @floatFromInt(y));+ const z = world.camera.zoom();+ const displayed_scale = scale * z + (card.target.width / @as(f64, @floatFromInt(top.chrome_width)) - scale * z) * amount;+ const left = normal.x + (card.target.x - normal.x) * amount;+ const upper = normal.y + (card.target.y - normal.y) * amount;+ const p = world.toWorld(left, upper);+ const wx: i32 = @intFromFloat(@round(p.x));+ const wy: i32 = @intFromFloat(@round(p.y));+ _ = @import("../projection.zig").setTreeZoom(&top.frame_tree.node, displayed_scale / z);+ top.frame_tree.node.setPosition(wx, wy);+ top.frame_tree.node.setEnabled(true);+ const snapped = world.toLayout(@floatFromInt(wx), @floatFromInt(wy));+ card.presented = .{ .x = snapped.x, .y = snapped.y, .width = @as(f64, @floatFromInt(top.chrome_width)) * displayed_scale, .height = @as(f64, @floatFromInt(top.chrome_height)) * displayed_scale };+ return true;+}++pub fn paint(self: *Self, now: i64) void {+ const alpha: f32 = @floatCast(self.amount(now));+ for (self.cards.items) |*card| {+ card.label.node.setPosition(@intFromFloat(@round(card.caption.x)), @intFromFloat(@round(card.caption.y)));+ card.label.setOpacity(alpha);+ }+ const selected = if (self.selected) |id| find(self, id) else null;+ for (self.edges) |edge| edge.node.setEnabled(selected != null and !self.returning);+ const card = selected orelse return;+ const p = card.presented;+ const x: i32 = @intFromFloat(@round(p.x) - 3);+ const y: i32 = @intFromFloat(@round(p.y) - 3);+ const w: i32 = @max(6, @as(i32, @intFromFloat(@round(p.x + p.width) - @round(p.x))) + 6);+ const h: i32 = @max(6, @as(i32, @intFromFloat(@round(p.y + p.height) - @round(p.y))) + 6);+ const rects = [_][4]i32{ .{ x, y, w, 3 }, .{ x, y + h - 3, w, 3 }, .{ x, y, 3, h }, .{ x + w - 3, y, 3, h } };+ for (self.edges, rects) |edge, rect| {+ edge.node.setPosition(rect[0], rect[1]);+ edge.setDestSize(rect[2], rect[3]);+ edge.setOpacity(alpha);+ }+}++pub fn picked(self: *Self, world: *World, x: f64, y: f64) ?u64 {+ const now = ui.anim.nowMs();+ var i = self.cards.items.len;+ while (i > 0 and self.amount(now) > 0.01) {+ i -= 1;+ const card = self.cards.items[i];+ if (card.caption.contains(x, y)) return card.id;+ }+ // While spreading/returning, frames can still overlap. The projection+ // knows their actual stacking order, clips and subsurfaces at this instant.+ const top = switch (@import("../scene_data.zig").hitTest(world.server, x, y)) {+ .surface => |hit| hit.toplevel,+ .chrome => |hit| hit.toplevel,+ .control_center => |hit| hit.cc.toplevel,+ else => return null,+ };+ return if (self.contains(top.id) and top.effectiveOpacity(now) > 0.001) top.id else null;+}diff --git a/src/world/overview_layout.zig b/src/world/overview_layout.zignew file mode 100644index 0000000..1bd11a5--- /dev/null+++ b/src/world/overview_layout.zig@@ -0,0 +1,57 @@+//! Balanced rows of aspect-preserving previews. Short rows are centred and+//! extra windows go in the bottom rows: four is 2+2, five is 2+3.+const std = @import("std");++pub const Rect = struct {+ x: f64 = 0,+ y: f64 = 0,+ width: f64 = 0,+ height: f64 = 0,++ pub fn contains(self: Rect, x: f64, y: f64) bool {+ return x >= self.x and y >= self.y and x < self.x + self.width and y < self.y + self.height;+ }+};++pub const Placement = struct { frame: Rect, label: Rect };++pub fn place(count: usize, index: usize, bounds: Rect, width: f64, height: f64, label_height: f64) Placement {+ if (count == 0 or index >= count or bounds.width <= 0 or bounds.height <= 0 or width <= 0 or height <= 0)+ return .{ .frame = .{}, .label = .{} };+ const columns: usize = @intFromFloat(@ceil(@sqrt(@as(f64, @floatFromInt(count)))));+ const rows = std.math.divCeil(usize, count, columns) catch unreachable;+ const short = count / rows;+ const long_rows = count % rows;+ var row: usize = 0;+ var column = index;+ while (row + 1 < rows) : (row += 1) {+ const items = short + @intFromBool(row >= rows - long_rows);+ if (column < items) break;+ column -= items;+ }+ const items = short + @intFromBool(row >= rows - long_rows);+ const padding = @min(40, @min(bounds.width, bounds.height) * 0.05);+ const available_w = bounds.width - padding * 2;+ const available_h = bounds.height - padding * 2;+ const cols: f64 = @floatFromInt(columns);+ const lines: f64 = @floatFromInt(rows);+ const gap = @min(24, @min(available_w / (cols * 4), available_h / (lines * 4)));+ const cell_w = (available_w - gap * (cols - 1)) / cols;+ const cell_h = (available_h - gap * (lines - 1)) / lines;+ const caption = @min(label_height, cell_h / 4);+ const caption_gap = @min(8, cell_h / 10);+ const preview_h = cell_h - caption - caption_gap;+ const x = bounds.x + padding + (available_w - (@as(f64, @floatFromInt(items)) * (cell_w + gap) - gap)) / 2 + @as(f64, @floatFromInt(column)) * (cell_w + gap);+ const y = bounds.y + padding + @as(f64, @floatFromInt(row)) * (cell_h + gap);+ const scale = @min(1, @min(cell_w / width, preview_h / height));+ const w = width * scale;+ const h = height * scale;+ return .{+ .frame = .{ .x = x + (cell_w - w) / 2, .y = y + (preview_h - h) / 2, .width = w, .height = h },+ .label = .{ .x = x, .y = y + preview_h + caption_gap, .width = cell_w, .height = caption },+ };+}++test {+ _ = @import("overview_layout_tests.zig");+}diff --git a/src/world/overview_layout_tests.zig b/src/world/overview_layout_tests.zignew file mode 100644index 0000000..8ee79f9--- /dev/null+++ b/src/world/overview_layout_tests.zig@@ -0,0 +1,43 @@+const std = @import("std");+const expect = std.testing.expect;+const layout = @import("overview_layout.zig");++test "four windows use two equal rows; five centre two above three" {+ const area: layout.Rect = .{ .x = 1280, .y = -100, .width = 1280, .height = 720 };+ const a = layout.place(4, 0, area, 1000, 800, 28).frame;+ const b = layout.place(4, 1, area, 1000, 800, 28).frame;+ const c = layout.place(4, 2, area, 1000, 800, 28).frame;+ const d = layout.place(4, 3, area, 1000, 800, 28).frame;+ try expect(a.y == b.y and c.y == d.y and a.y < c.y);+ try expect(a.x == c.x and b.x == d.x);+ const p = layout.place(5, 0, area, 1000, 800, 28).frame;+ const q = layout.place(5, 1, area, 1000, 800, 28).frame;+ const r = layout.place(5, 2, area, 1000, 800, 28).frame;+ const s = layout.place(5, 3, area, 1000, 800, 28).frame;+ const t = layout.place(5, 4, area, 1000, 800, 28).frame;+ try expect(p.y == q.y and r.y == s.y and s.y == t.y and p.y < r.y);+ try std.testing.expectApproxEqAbs(area.x + area.width / 2, (p.x + q.x + q.width) / 2, 0.001);+ try expect(p.x > r.x and q.x < t.x);+}++test "mixed aspect previews and captions fit without intersections on small and large outputs" {+ for ([_]f64{ 320, 1280, 2560 }) |width| for (1..65) |count| {+ const area: layout.Rect = .{ .x = -320, .y = 20, .width = width, .height = width * 0.6 };+ for (0..count) |i| {+ const w: f64 = if (i % 2 == 0) 2200 else 240;+ const h: f64 = if (i % 2 == 0) 300 else 1500;+ const a = layout.place(count, i, area, w, h, 28);+ try expect(a.frame.width > 0 and a.frame.height > 0);+ try std.testing.expectApproxEqAbs(w / h, a.frame.width / a.frame.height, 0.0001);+ try expect(a.frame.x >= area.x and a.frame.y >= area.y);+ try expect(a.frame.x + a.frame.width <= area.x + area.width);+ try expect(a.label.y >= a.frame.y + a.frame.height);+ try expect(a.label.y + a.label.height <= area.y + area.height + 0.001);+ for (0..i) |j| {+ const b = layout.place(count, j, area, if (j % 2 == 0) 2200 else 240, if (j % 2 == 0) 300 else 1500, 28);+ try expect(a.frame.x + a.frame.width <= b.frame.x or b.frame.x + b.frame.width <= a.frame.x or+ a.frame.y + a.frame.height <= b.frame.y or b.frame.y + b.frame.height <= a.frame.y);+ }+ }+ };+}diff --git a/tests/overview.py b/tests/overview.pynew file mode 100644index 0000000..8f5dd9c--- /dev/null+++ b/tests/overview.py@@ -0,0 +1,324 @@+#!/usr/bin/env python3+"""Live spread overview: overlapping/minimized windows, balanced rows and restoration."""+import os+from pathlib import Path+import subprocess+import tempfile+import time++from PIL import Image+from desktop_zoom import build_client, wait_for+from ipc_client import IPCClient, spawn_compositor, stop_process+++def runs(values):+ result = []+ for value in values:+ if result and value == result[-1][-1] + 1:+ result[-1].append(value)+ else:+ result.append([value])+ return result+++def blue_windows(image):+ """Locate the fixture's blue client bodies, independently of grid geometry."""+ pixels = image.load()+ rows = []+ for y in range(image.height):+ xs = [x for x in range(image.width)+ if pixels[x, y][2] > 245 and pixels[x, y][0] < 10 and pixels[x, y][1] < 10]+ rows.append(xs)+ boxes = []+ for band in runs(y for y, xs in enumerate(rows) if len(xs) >= 25):+ if len(band) < 12:+ continue+ occupied = sorted({x for y in band for x in rows[y]})+ row = []+ for columns in runs(occupied):+ if len(columns) >= 25:+ row.append((columns[0], band[0], columns[-1], band[-1]))+ if row:+ boxes.append(row)+ return boxes+++def run():+ with tempfile.TemporaryDirectory(prefix="rediwm-spread-") as directory:+ tmp = Path(directory)+ build_client(tmp)+ base = ('[input]\ninvert_scroll = false\n'+ '[theme]\nswitcher_selected_border = "#ff00ff"\n'+ '[keybinds]\n"super+t" = "noop"\n')+ isolated = {"DBUS_SESSION_BUS_ADDRESS": ""}+ for variable, name in (("HOME", "home"), ("XDG_CONFIG_HOME", "config"),+ ("XDG_DATA_HOME", "data"), ("XDG_CACHE_HOME", "cache")):+ (tmp / name).mkdir(mode=0o700)+ isolated[variable] = str(tmp / name)+ process, log = spawn_compositor(+ tmp, scale=os.environ.get("REDIWM_TEST_SCALE", "1"),+ outputs=os.environ.get("REDIWM_TEST_OUTPUTS", "1"),+ config_content=base, env_extra=isolated,+ binary=os.environ.get("REDIWM_TEST_BINARY"))+ clients, handles, ids = [], [], []+ try:+ with IPCClient(tmp) as ipc:+ ipc.wait_for("wallpaper_presented", timeout_ms=10000)+ clock = int(time.monotonic() * 1000) + 2000+ display = next(p.name for p in tmp.glob("wayland-*") if not p.name.endswith(".lock"))+ outputs = ipc.get_outputs()+ output = outputs[0]++ def tick(dt=1500):+ nonlocal clock+ clock += dt+ ipc.action("set_anim_time", {"ms": clock})+ ipc.wait_for_frame(output=output["name"])++ def camera():+ return ipc.action("get_camera")++ def toggle():+ ipc.key(125, True)+ ipc.key_down_up(30)+ ipc.key(125, False)++ def geometry():+ return sorted((w["id"], w["x"], w["y"], w["width"], w["height"], w["zoom_percent"])+ for w in ipc.get_windows())++ def minimized(wid):+ return ipc.get_window_debug(wid)["minimized"]++ def reload(extra=""):+ (tmp / "rediwm-config.toml").write_text(base + extra)+ ipc.action("reload_config")+ tick()++ def spawn():+ i = len(clients)+ handle = (tmp / f"client-{i}.log").open("w")+ handles.append(handle)+ clients.append(subprocess.Popen(+ [str(tmp / "client"), "--app-id", f"overview-{i}"],+ env=dict(os.environ, XDG_RUNTIME_DIR=str(tmp), WAYLAND_DISPLAY=display,+ **({"REDIWM_TEST_PERF": "1", "REDIWM_TEST_PERF_HZ": "30"} if i == 4 else {})),+ stdout=handle, stderr=handle))+ ipc.wait_for("window_mapped", app_id=f"overview-{i}")+ ids.append(next(w["id"] for w in ipc.get_windows() if w["app_id"] == f"overview-{i}"))+ tick()+ # Identical positions deliberately hide all but one normally.+ ipc.action("move_window_to", {"id": ids[-1], "x": 500, "y": 100})+ tick()++ def picture(name="spread"):+ path = tmp / (name + ".png")+ path.unlink(missing_ok=True)+ ipc.screenshot(str(path), output=output["name"])+ with Image.open(path) as image:+ return image.convert("RGB").resize((output["logical_width"], output["logical_height"]))++ def grid(counts):+ image = picture()+ if keep := os.environ.get("REDIWM_TEST_LOG_DIR"):+ image.save(Path(keep) / ("overview-" + "-".join(map(str, counts)) + ".png"))+ boxes = blue_windows(image)+ assert [len(row) for row in boxes] == counts, boxes+ for row in boxes:+ for left, right in zip(row, row[1:]):+ assert right[0] - left[2] >= 20, row+ for upper, lower in zip(boxes, boxes[1:]):+ assert lower[0][1] - upper[0][3] >= 20, boxes+ rgb = image.tobytes()+ assert any(r > 240 and g < 15 and b > 240 for r, g, b in zip(rgb[::3], rgb[1::3], rgb[2::3])), "no selection outline"+ return [box for row in boxes for box in row]++ tick()+ empty = camera()+ toggle()+ tick()+ assert camera() == empty+ for _ in range(4):+ spawn()+ ipc.focus_window(ids[0])+ ipc.action("set_zoom", {"percent": 70})+ tick()+ ipc.action("set_camera", {"x": 150, "y": 70})+ tick()+ original, positions = camera(), geometry()+ before = [(tmp / f"client-{i}.log").read_text() for i in range(4)]+ ipc.open_start_menu()+ tick()+ toggle()+ tick()+ grid([2, 2])+ assert camera() == original and geometry() == positions+ assert ipc.get_focused_window()["id"] == ids[0]+ ipc.key_down_up(45)+ ipc.key_down_up(1)+ tick()+ assert camera() == original and geometry() == positions+ assert sum(map(len, blue_windows(picture("restored")))) == 1, "windows stayed spread after cancelling"+ for i, old in enumerate(before):+ now = (tmp / f"client-{i}.log").read_text()+ assert "key 45 1" not in now[len(old):]+ assert now.count("configure ") == old.count("configure "), "spread resized a client"++ # A click before the frames separate must choose the visible+ # front window, rather than the grid's last rectangle.+ toggle()+ tick(0)+ frame = ipc.get_window_debug(ids[0])["chrome_box"]+ z = original["zoom_percent"] / 100+ ipc.move_cursor(round((frame["x"] + frame["width"] / 2 - original["x"]) * z),+ round((frame["y"] + frame["height"] / 2 - original["y"]) * z),+ output=output["name"])+ ipc.action("pointer_button", {"button": 272, "pressed": True})+ ipc.action("pointer_button", {"button": 272, "pressed": False})+ tick()+ assert ipc.get_focused_window()["id"] == ids[0]++ spawn()+ ipc.minimize(ids[4])+ tick()+ ipc.focus_window(ids[0])+ tick()+ original, positions = camera(), geometry()+ toggle()+ tick()+ boxes = grid([2, 3])+ assert minimized(ids[4]), "overview restored the minimized window"+ assert geometry() == positions+ # Previously occluded and minimized clients continue receiving frame callbacks.+ frames = (tmp / "client-4.log").read_text().count("frame ")+ wait_for(lambda: (tmp / "client-4.log").read_text().count("frame ") > frames,+ "minimized preview stopped producing frames")+ ipc.key_down_up(1)+ tick()+ assert minimized(ids[4]) and camera() == original++ # Arrow keys follow the preview grid, even for identical source positions.+ toggle()+ tick()+ ipc.key_down_up(106)+ ipc.key_down_up(28)+ tick()+ assert ipc.get_focused_window()["id"] == ids[1]+ assert geometry() == positions+ assert camera()["zoom_percent"] == original["zoom_percent"]++ # Clicking the last card restores only that minimized window.+ toggle()+ tick()+ boxes = grid([2, 3])+ x0, y0, x1, y1 = boxes[-1]+ ipc.move_cursor((x0 + x1) // 2, (y0 + y1) // 2, output=output["name"])+ old = (tmp / "client-4.log").read_text()+ ipc.action("pointer_button", {"button": 272, "pressed": True})+ tick()+ ipc.action("pointer_button", {"button": 272, "pressed": False})+ assert ipc.get_focused_window()["id"] == ids[4] and not minimized(ids[4])+ assert "button 272" not in (tmp / "client-4.log").read_text()[len(old):]+ assert geometry() == positions++ # All minimized is still a useful overview; cancel leaves all minimized.+ for wid in ids:+ ipc.minimize(wid)+ tick()+ toggle()+ tick()+ grid([2, 3])+ ipc.key_down_up(1)+ tick()+ assert all(minimized(wid) for wid in ids)+ assert not blue_windows(picture("minimized")), "minimized previews remained on the desktop"+ for wid in ids:+ ipc.restore(wid)+ tick()++ if len(outputs) > 1:+ output = outputs[1]+ ipc.move_cursor(100, 100, output=output["name"])+ saved = camera()+ toggle()+ tick()+ grid([2, 3])+ ipc.key_down_up(1)+ tick()+ assert camera() == saved+ output = outputs[0]+ ipc.move_cursor(0, 0, output=output["name"])++ # Camera distance must not dictate thumbnail size.+ ipc.action("move_window_to", {"id": ids[4], "x": 12000, "y": 100})+ tick()+ for extra in ('[animations]\nenabled = false\n', '[animations]\nreduced_motion = "on"\n',+ '[compositor]\nfocus_zoom = "boost"\n', '[compositor]\nfocus_zoom = "camera"\n'):+ reload(extra)+ ipc.set_zoom(ids[0], 55)+ ipc.focus_window(ids[0])+ tick()+ saved, positions = camera(), geometry()+ toggle()+ tick()+ grid([2, 3])+ ipc.key_down_up(1)+ tick()+ tick()+ assert camera() == saved and geometry() == positions+ toggle()+ tick()+ reload(extra)+ assert camera() == saved++ reload()+ saved = camera()+ toggle()+ tick(40)+ toggle()+ tick()+ assert camera() == saved+ # Entering during a minimize effect drops its old scene snapshot.+ reload('[effects.window_minimize]\nenabled = true\n')+ ipc.minimize(ids[1])+ toggle()+ tick()+ grid([2, 3])+ ipc.key_down_up(1)+ tick()+ assert minimized(ids[1])+ reload()+ toggle()+ tick()+ stop_process(clients[0])+ wait_for(lambda: all(w["id"] != ids[0] for w in ipc.get_windows()), "client stayed mapped")+ tick()+ ipc.key_down_up(1)+ tick()++ # A compositor-owned Settings body also participates in the spread.+ ipc.action("open_control_center")+ tick()+ toggle()+ tick()+ ipc.key_down_up(1)+ tick()+ ipc.close_panel("control_center")+ tick()+ toggle()+ tick()+ stop_process(process)+ compositor_log = Path(log.name).read_text()+ assert "error(gpa)" not in compositor_log and "panic:" not in compositor_log+ print("overview: 2x2 and 2+3 live grids, minimized previews, restoration and input isolation passed")+ finally:+ for client in clients:+ stop_process(client)+ stop_process(process)+ for handle in handles:+ handle.close()+ log.close()+++if __name__ == "__main__":+ run()