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
@@ -5,6 +5,7 @@ import {
|
||||
"chandra/desktop/interface/chandra/desktop/icons" @icons,
|
||||
"chandra/desktop/lib/ui" @ui,
|
||||
"chandra/desktop/lib/dock" @dock,
|
||||
"chandra/desktop/lib/panel" @panel,
|
||||
}
|
||||
|
||||
warnings = "-44"
|
||||
@@ -3,17 +3,12 @@
|
||||
/// Each pill starts with the app's icon: the one its .desktop file names, from the icon theme (the
|
||||
/// `icons` capability), else the coloured letter tile the dock shows for that app id.
|
||||
/// The focused window's pill is lit, a minimized window's is dimmed; a click focuses the window and
|
||||
/// restores it if it was minimized. When the bar is too narrow the pills shrink to fit, and below
|
||||
/// restores it if it was minimized; a right-click opens the window's menu (drawn by the shell). When the bar is too narrow the pills shrink to fit, and below
|
||||
/// `icon_only_w` they show just the icon.
|
||||
|
||||
///| Widest a pill gets, the gap between pills, and the narrowest before titles stop being readable.
|
||||
let pill_max : Int = 140
|
||||
|
||||
///|
|
||||
let gap : Int = 6
|
||||
|
||||
///|
|
||||
let pill_min : Int = 56
|
||||
///| Pill geometry is shared with the shell (lib/panel/tasks.mbt): it hit-tests right-clicks
|
||||
/// on pills to show the window's menu (Quit, Minimize, Maximize).
|
||||
let gap : Int = @panel.task_pill_gap
|
||||
|
||||
///| Pills narrower than this drop the title and show only the centred icon.
|
||||
let icon_only_w : Int = 72
|
||||
@@ -69,31 +64,12 @@ fn windows_sorted() -> Array[@windows.WindowInfo] {
|
||||
|
||||
///| Pill width for `n` windows in a bar `w` wide.
|
||||
fn pill_w(n : Int, w : Int) -> Int {
|
||||
if n <= 0 {
|
||||
return pill_max
|
||||
}
|
||||
let fit = (w - gap * (n - 1)) / n
|
||||
if fit > pill_max {
|
||||
pill_max
|
||||
} else if fit < pill_min {
|
||||
pill_min
|
||||
} else {
|
||||
fit
|
||||
}
|
||||
@panel.task_pill_w(n, w)
|
||||
}
|
||||
|
||||
///| The pill under a widget-local x, or -1.
|
||||
fn pill_at(x : Int, n : Int) -> Int {
|
||||
let pw = pill_w(n, last_w.val)
|
||||
if x < 0 {
|
||||
return -1
|
||||
}
|
||||
let i = x / (pw + gap)
|
||||
if i < n && x - i * (pw + gap) < pw {
|
||||
i
|
||||
} else {
|
||||
-1
|
||||
}
|
||||
@panel.task_pill_at(x, n, last_w.val)
|
||||
}
|
||||
|
||||
///| `s` shortened with an ellipsis until it fits `max_w` pixels.
|
||||
|
||||
Reference in new issue
Block a user