Task manager: right-click a window's pill for Minimize/Restore, Maximize, Quit
CI / test (push) Failing after 16s
CI / test (push) Failing after 16s
- Right-clicking a pill in the task manager opens that window's menu (titled with the window's title): Minimize (Restore when minimized), Maximize (Restore size when maximized) and Quit, which asks the app to close the window (xdg_toplevel close, like the title-bar close button). Empty task-bar space keeps the module's own menu (Module settings, Replace with, Remove widget). - Modules only get left clicks, so the shell draws the menu and hit-tests the pills itself: the pill geometry moved to lib/panel/tasks.mbt, shared by the tasks module and the shell. No WIT change, so every host works as before. - New menu row kind 6 and ShellAction::Window(id, WindowCommand); the compositor runs it through the same WM requests as the title-bar buttons. WinInfo carries `maximized`. - Tests: native end-to-end (menu rows, minimize/restore, maximize/restore size, Quit sends close, empty space keeps the module menu) and lib/panel pill geometry tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DPL5hiX13fXK1eMboRe5oQ
This commit is contained in:
9 files changed
+238
-35
No files matched your search
@@ -655,6 +655,7 @@ fn ChandraCompositor::build_scene(
|
||||
title: if win.title.length() > 0 { win.title } else { win.app_id },
|
||||
focused: win.focused,
|
||||
minimized: false,
|
||||
maximized: win.maximized,
|
||||
})
|
||||
None => ()
|
||||
}
|
||||
@@ -668,6 +669,7 @@ fn ChandraCompositor::build_scene(
|
||||
title: if win.title.length() > 0 { win.title } else { win.app_id },
|
||||
focused: false,
|
||||
minimized: true,
|
||||
maximized: win.maximized,
|
||||
})
|
||||
None => ()
|
||||
}
|
||||
@@ -1122,6 +1124,29 @@ fn ChandraCompositor::activate_task(self : ChandraCompositor, wid : UInt64) -> U
|
||||
)
|
||||
}
|
||||
|
||||
///| A row of a task-bar pill's right-click menu: close (the app may still ask to save), minimize,
|
||||
/// restore, or maximize / restore the size of window `wid`.
|
||||
fn ChandraCompositor::window_command(
|
||||
self : ChandraCompositor,
|
||||
wid : UInt64,
|
||||
cmd : @shell.WindowCommand,
|
||||
) -> Unit {
|
||||
if self.wm.windows.get(wid) is None {
|
||||
return
|
||||
}
|
||||
match cmd {
|
||||
Close => self.press_title_button(wid, 3)
|
||||
Minimize => self.press_title_button(wid, 1)
|
||||
Restore => self.activate_task(wid)
|
||||
ToggleMaximize => {
|
||||
// A minimized window comes back first, then (un)maximizes in front.
|
||||
self.activate_task(wid)
|
||||
self.press_title_button(wid, 2)
|
||||
}
|
||||
}
|
||||
self.damage.mark_full()
|
||||
}
|
||||
|
||||
///| Use the dark (configured) or the light theme, as the shell's Dark mode setting says, for the
|
||||
/// shell, the panel modules, the window decorations and the switcher; redraws everything, and
|
||||
/// (in the login session) tells apps through the system preference.
|
||||
@@ -1142,6 +1167,7 @@ fn ChandraCompositor::run_shell_actions(self : ChandraCompositor) -> Unit {
|
||||
@shell.ShellAction::ThemeChanged => self.apply_theme()
|
||||
@shell.ShellAction::Screenshot(code) => self.screenshot_request(code)
|
||||
@shell.ShellAction::SystemPower(a) => self.system_power(a)
|
||||
@shell.ShellAction::Window(wid, cmd) => self.window_command(wid, cmd)
|
||||
@shell.ShellAction::SetLayout(m) =>
|
||||
match m {
|
||||
0 => self.set_layout_mode(@wm.LayoutMode::Tiling)
|
||||
|
||||
Reference in new issue
Block a user