Task manager panel module and Alt+Tab window switcher
CI / test (push) Failing after 18s

- components/tasks: the 'tasks' module the panel and components.txt already named but whose source
  was missing. One pill per window in opening order (stable, not stacking order), focused lit,
  minimized dimmed, hover, titles shortened, pills shrink to fit; click focuses/restores.
  Tests that loaded it (task list, title-bar minimize/restore) pass again.
- compositor/host/switcher.mbt: hold Alt, press Tab: most-recently-used window list with the
  previous window selected; Tab/Shift+Tab/arrows move, releasing Alt switches (restoring a
  minimized window), Escape cancels. Tab is not forwarded to clients.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
nandiandClaude Sonnet 5.5 committed 2026-11-25 03:39:19 -08:00
1 parent 095bbc5906
commit 70ad87f2d2
18 files changed
+1094 -3

No files matched your search

+54 -2
View File
@@ -251,8 +251,8 @@ test "title-bar buttons minimize, maximize and close windows" {
assert_true(comp.wm.windows.get(1UL).unwrap().minimized)
assert_true(!comp.wm.stacking_order().contains(1UL))
let tasks = rect_of(comp, "tasks")
// pills: the visible window first, the minimized one second (140 wide, 6 apart)
click((tasks.x + 146 + 20, tasks.y + tasks.h / 2), 30U)
// pills are in opening order (140 wide, 6 apart): window 1, the minimized one, is first
click((tasks.x + 20, tasks.y + tasks.h / 2), 30U)
assert_true(!comp.wm.windows.get(1UL).unwrap().minimized)
// Close window 2: the client receives xdg_toplevel.close (opcode 1 on its toplevel).
ignore(drain_msgs(c))
@@ -978,3 +978,55 @@ test "a window dragged somewhere reopens there, saved per app in state.edn" {
assert_eq(g2.y, g1.y)
}
}
///|
test "alt-tab switches to the previous window, tab again goes further back, escape cancels" {
let socket_path = "/tmp/wayland-moon-alt-" + @sys.getpid().to_string() + ".sock"
let theme = @scene.ThemeTokens::moon_night()
let comp = @host.MoonPlasmaCompositor::new(socket_path, theme, 1280, 720).unwrap()
ignore(open_and_configure_client(comp, socket_path, "A", "a"))
ignore(open_and_configure_client(comp, socket_path, "B", "b"))
ignore(open_and_configure_client(comp, socket_path, "C", "c"))
ignore(comp.compose_frame())
let focused = fn() {
let mut f = 0UL
for id, w in comp.windows {
if w.focused {
f = id
}
}
f
}
let key = fn(code : UInt, down : Bool, t : UInt) {
comp.handle_input(@nested.InputEvent::Key(code, down), t)
}
assert_eq(focused(), 3UL)
// Alt+Tab, release Alt: the window used before this one.
key(56U, true, 1U)
key(15U, true, 2U)
key(15U, false, 3U)
assert_true(comp.switcher_open())
ignore(comp.compose_frame())
assert_true(comp.frame_changed) // the switcher is drawn
assert_eq(focused(), 3UL) // nothing switches until Alt is released
key(56U, false, 4U)
assert_false(comp.switcher_open())
assert_eq(focused(), 2UL)
// Alt+Tab+Tab: two back in use order (3 was used before 2, then 1).
key(56U, true, 10U)
key(15U, true, 11U)
key(15U, true, 12U)
key(56U, false, 13U)
assert_eq(focused(), 1UL)
// Escape closes it without switching.
key(56U, true, 20U)
key(15U, true, 21U)
assert_true(comp.switcher_open())
key(1U, true, 22U)
assert_false(comp.switcher_open())
key(56U, false, 23U)
assert_eq(focused(), 1UL)
// With the Alt not held, Tab is an ordinary key.
key(15U, true, 30U)
assert_false(comp.switcher_open())
}