Dock and task manager are one module: titled window pills, pins, Super+1..9
CI / test (push) Failing after 30s

The panel had a task list and, beside it, a dock showing the same running
apps again. They are now one module, the dock, in the task list's place:

- Pinned apps, then running ones; an app with windows is a pill with its
  window's title (or name and window count) while there is room, an icon
  when the panel is crowded ("Show window titles" in Dock settings).
- Its right-click menu has the task list's window commands (Minimize /
  Restore, Maximize) for a single window, or the app's windows by title.
- It stretches like the task list did; new panels get it instead of
  tasks. A saved panel's "tasks" becomes the dock (one dock, where the
  task list was); pins are the dock's own setting, so they carry over.
- An empty dock shows a "+ Add apps" tile that opens the Applications
  menu, where right-clicking an app offers Open and Pin to dock (adding a
  dock to the panel if there is none).
- Super+1 .. Super+9 open the dock's first nine apps like a click
  (shortcut "dock-apps", rebindable in Settings > Shortcuts).
- "New window" / "Open" only for apps the catalog can start.

The tasks component, lib/panel's pill geometry and the taskbar-widget
world are gone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DPL5hiPCFHRxaJQvwex6ry
This commit is contained in:
Claude committed 2026-11-26 00:08:05 +00:00
1 parent 42aa770452
commit 6253371cb3
28 files changed
+801 -1131

No files matched your search

+94 -2
View File
@@ -6,9 +6,8 @@
test "dock screenshots: hover label and an app's menu" {
let socket_path = "/tmp/wayland-moon-dockshot-" + @sys.getpid().to_string() + ".sock"
let comp = @host.ChandraCompositor::new(socket_path, @scene.ThemeTokens::moon_night(), 1280, 720).unwrap()
assert_true(comp.shell.load_path("build/components/dock.wasm") is Some(_))
ignore(comp.compose_frame())
let slot = comp.shell.slots().filter(s => comp.shell.slot_module(s).contains("dock"))[0]
let slot = comp.shell.slot_of("dock")
// Room for the dock's running apps on a 1280-wide screen.
for s in comp.shell.slots() {
let m = comp.shell.slot_module(s)
@@ -19,6 +18,8 @@ test "dock screenshots: hover label and an app's menu" {
comp.shell.set_module_setting(
slot, "pinned", "libreoffice-writer;libreoffice-calc;libreoffice-impress;debian-xterm;vim",
)
// Icons only, to see the magnification (titles are the default).
comp.shell.set_module_setting(slot, "titles", "off")
let _a = open_and_configure_client(comp, socket_path, "Report.odt", "libreoffice-writer")
let _b = open_and_configure_client(comp, socket_path, "Notes.odt", "libreoffice-writer")
let _c = open_and_configure_client(comp, socket_path, "Terminal", "xterm")
@@ -39,3 +40,94 @@ test "dock screenshots: hover label and an app's menu" {
assert_true(comp.shell.menu_rows.map(m => m.label).contains("Close 2 windows"))
ignore(@sys.write_file_bytes("_build/dock_menu.png", @renderer.encode_png(comp.compose_frame())))
}
///| Pick row `label` of the open right-click menu (rows: 26px title, then 28px each).
fn dock_pick(comp : @host.ChandraCompositor, label : String, t : UInt) -> Unit raise {
let i = comp.shell.menu_rows.map(r => r.label).search(label).unwrap()
let m = comp.shell.menu_rect
click_at(comp, m.x + m.w / 2, m.y + 26 + 28 * i + 14, t)
}
///| A key pressed and released with Super held (evdev codes).
fn super_key(comp : @host.ChandraCompositor, code : UInt, t : UInt) -> Unit {
comp.handle_input(@nested.InputEvent::Key(125U, true), t)
comp.handle_input(@nested.InputEvent::Key(code, true), t + 1U)
comp.handle_input(@nested.InputEvent::Key(code, false), t + 2U)
comp.handle_input(@nested.InputEvent::Key(125U, false), t + 3U)
ignore(comp.compose_frame())
}
///|
test "the dock is the panel's task manager: empty + opens Applications, pin from there, Super+number" {
let socket_path = "/tmp/wayland-moon-dockbar-" + @sys.getpid().to_string() + ".sock"
let comp = @host.ChandraCompositor::new(socket_path, @scene.ThemeTokens::moon_night(), 1280, 720).unwrap()
ignore(comp.compose_frame())
// A fresh panel has the dock where the task list was; the old id is an alias of it.
let slot = comp.shell.slot_of("dock")
assert_true(slot.length() > 0)
assert_eq(comp.shell.slot_of("tasks"), slot)
// It stretches: the clock still packs against the right edge.
let r = comp.shell.slot_rect(slot)
assert_true(r.w > 300)
let clock = comp.shell.slot_rect(comp.shell.slot_of("clock-digital"))
assert_true(clock.x > 900)
// Nothing pinned, nothing running: a "+" that opens the Applications menu.
comp.shell.set_module_setting(slot, "pinned", ";")
ignore(comp.compose_frame())
comp.handle_input(@nested.InputEvent::PointerMove((r.x + 14).to_double(), (r.y + r.h / 2).to_double()), 8U)
ignore(@sys.write_file_bytes("_build/dock_empty.png", @renderer.encode_png(comp.compose_frame())))
click_at(comp, r.x + 14, r.y + r.h / 2, 10U)
let launcher = comp.shell.slot_of("launcher")
let pr = comp.shell.slot_popup_rect(launcher)
assert_true(pr.w > 0)
// Right-click the first app there: Open, Pin to dock. Pinning keeps the menu open.
click_at(comp, pr.x + 40, pr.y + 60, 20U, btn=273U)
assert_true(comp.shell.menu_open)
assert_eq(comp.shell.menu_rows.map(r => r.label), ["Open", "Pin to dock"])
let first = comp.shell.menu_title
ignore(@sys.write_file_bytes("_build/dock_pin_from_menu.png", @renderer.encode_png(comp.compose_frame())))
dock_pick(comp, "Pin to dock", 25U)
assert_true(comp.shell.slot_popup_rect(launcher).w > 0)
let pinned = comp.shell.module_setting("dock", "pinned").unwrap_or("")
assert_true(pinned.length() > 1 && pinned != ";")
// The same app's menu now offers Unpin.
click_at(comp, pr.x + 40, pr.y + 60, 30U, btn=273U)
assert_eq(comp.shell.menu_title, first)
assert_true(comp.shell.menu_rows.map(r => r.label).contains("Unpin from dock"))
comp.handle_input(@nested.InputEvent::Key(1U, true), 35U) // Escape closes the menu
comp.handle_input(@nested.InputEvent::Key(1U, false), 36U)
comp.handle_input(@nested.InputEvent::Key(1U, true), 37U) // and the Applications menu
comp.handle_input(@nested.InputEvent::Key(1U, false), 38U)
// Two running apps pinned in front: Super+2 brings the second one's window forward.
comp.shell.set_module_setting(slot, "pinned", "libreoffice-writer;libreoffice-calc;vim")
let _a = open_and_configure_client(comp, socket_path, "Report.odt", "libreoffice-writer")
let _b = open_and_configure_client(comp, socket_path, "Budget.ods", "libreoffice-calc")
let _c = open_and_configure_client(comp, socket_path, "Notes.odt", "libreoffice-writer")
ignore(comp.compose_frame())
let focused = fn() {
let mut f = ""
for _, w in comp.windows {
if w.focused {
f = w.title
}
}
f
}
super_key(comp, 3U, 40U) // Super+2
assert_eq(focused(), "Budget.ods")
super_key(comp, 2U, 50U) // Super+1: Writer's newest window, then its other one
assert_eq(focused(), "Notes.odt")
super_key(comp, 2U, 60U)
assert_eq(focused(), "Report.odt")
// Writer's menu lists its two windows by title; picking one brings it forward.
let r = comp.shell.slot_rect(slot)
click_at(comp, r.x + 6 + 12, r.y + r.h / 2, 70U, btn=273U)
let labels = comp.shell.menu_rows.map(r => r.label)
assert_true(labels.contains("Report.odt") && labels.contains("Notes.odt"))
ignore(@sys.write_file_bytes("_build/dock_bar_menu.png", @renderer.encode_png(comp.compose_frame())))
dock_pick(comp, "Notes.odt", 80U)
ignore(comp.compose_frame())
assert_eq(focused(), "Notes.odt")
comp.handle_input(@nested.InputEvent::PointerMove((r.x + 6 + 30 + 12).to_double(), (r.y + r.h / 2).to_double()), 90U)
ignore(@sys.write_file_bytes("_build/dock_bar.png", @renderer.encode_png(comp.compose_frame())))
}
+34 -27
View File
@@ -262,8 +262,11 @@ test "title-bar buttons minimize, maximize and close windows" {
click(btn(1UL, 1), 20U)
assert_true(comp.wm.windows.get(1UL).unwrap().minimized)
assert_true(!comp.wm.stacking_order().contains(1UL))
let tasks = rect_of(comp, "tasks")
// pills are in opening order (140 wide, 6 apart): window 1, the minimized one, is first
// The dock with nothing pinned: one titled pill per app, in opening order (150 wide, 6 apart):
// window 1's app, the minimized one, is first.
comp.shell.set_module_setting(comp.shell.slot_of("dock"), "pinned", ";")
ignore(comp.compose_frame())
let tasks = rect_of(comp, "dock")
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).
@@ -277,7 +280,7 @@ test "title-bar buttons minimize, maximize and close windows" {
}
///|
test "the task list module focuses the window whose pill is clicked" {
test "the dock focuses the window whose pill is clicked" {
let socket_path = "/tmp/wayland-moon-tasks-" +
@sys.getpid().to_string() +
".sock"
@@ -285,6 +288,7 @@ test "the task list module focuses the window whose pill is clicked" {
let comp = @host.ChandraCompositor::new(socket_path, theme, 1280, 720).unwrap()
let _a = open_and_configure_client(comp, socket_path, "A", "a")
let _b = open_and_configure_client(comp, socket_path, "B", "b")
comp.shell.set_module_setting(comp.shell.slot_of("dock"), "pinned", ";")
ignore(comp.compose_frame())
let focused = fn() {
let mut f = 0UL
@@ -295,18 +299,18 @@ test "the task list module focuses the window whose pill is clicked" {
}
f
}
let tasks = rect_of(comp, "tasks")
let tasks = rect_of(comp, "dock")
assert_true(tasks.w > 300) // the stretching module takes the free space
let first = comp.wm.stacking_order()[0]
click_at(comp, tasks.x + 20, tasks.y + tasks.h / 2, 1U) // pill 0
assert_eq(focused(), first)
let other = comp.wm.stacking_order()
click_at(comp, tasks.x + 146 + 20, tasks.y + tasks.h / 2, 10U) // pill 1
click_at(comp, tasks.x + 156 + 20, tasks.y + tasks.h / 2, 10U) // pill 1
assert_true(focused() != first || other.length() == 1)
}
///|
test "right-click a task-bar pill for the window's menu: Minimize, Maximize, Quit" {
test "right-click an app in the dock for its window's menu: Minimize, Maximize, Quit" {
let socket_path = "/tmp/wayland-moon-taskmenu-" +
@sys.getpid().to_string() +
".sock"
@@ -314,8 +318,9 @@ test "right-click a task-bar pill for the window's menu: Minimize, Maximize, Qui
let comp = @host.ChandraCompositor::new(socket_path, theme, 1280, 720).unwrap()
let (c, _shm, _surf, _xdg, tl, _deco) = open_and_configure_client(comp, socket_path, "A", "a")
let _b = open_and_configure_client(comp, socket_path, "B", "b")
comp.shell.set_module_setting(comp.shell.slot_of("dock"), "pinned", ";")
ignore(comp.compose_frame())
let tasks = rect_of(comp, "tasks")
let tasks = rect_of(comp, "dock")
let cy = tasks.y + tasks.h / 2
let labels = fn() { comp.shell.menu_rows.map(r => r.label) }
// Pick menu row `label` (rows: 26px title, then 28px each).
@@ -324,17 +329,17 @@ test "right-click a task-bar pill for the window's menu: Minimize, Maximize, Qui
let m = comp.shell.menu_rect
click_at(comp, m.x + m.w / 2, m.y + 26 + 28 * i + 14, t)
}
// Pill 0 is window 1 (opening order): its menu, titled with its title.
// Pill 0 is window 1's app (opening order): its menu, titled with the app's name.
click_at(comp, tasks.x + 20, cy, 1U, btn=273U)
assert_true(comp.shell.menu_open)
assert_eq(comp.shell.menu_title, "A")
assert_eq(labels(), ["Minimize", "Maximize", "Quit"])
assert_eq(comp.shell.menu_title, "a")
assert_eq(labels(), ["Pin to dock", "Minimize", "Maximize", "Quit", "Dock settings..."])
// Minimize, then the same pill's menu offers Restore, which brings it back.
pick("Minimize", 10U)
assert_true(!comp.shell.menu_open)
assert_true(comp.wm.windows.get(1UL).unwrap().minimized)
click_at(comp, tasks.x + 20, cy, 20U, btn=273U)
assert_eq(labels(), ["Restore", "Maximize", "Quit"])
assert_eq(labels(), ["Pin to dock", "Restore", "Maximize", "Quit", "Dock settings..."])
pick("Restore", 30U)
assert_true(!comp.wm.windows.get(1UL).unwrap().minimized)
// Maximize, then Restore size.
@@ -343,12 +348,12 @@ test "right-click a task-bar pill for the window's menu: Minimize, Maximize, Qui
pick("Maximize", 50U)
assert_true(comp.windows.get(1UL).unwrap().geometry.w > w0)
click_at(comp, tasks.x + 20, cy, 60U, btn=273U)
assert_eq(labels(), ["Minimize", "Restore size", "Quit"])
assert_eq(labels(), ["Pin to dock", "Minimize", "Restore size", "Quit", "Dock settings..."])
pick("Restore size", 70U)
assert_eq(comp.windows.get(1UL).unwrap().geometry.w, w0)
// Pill 1 is window 2.
click_at(comp, tasks.x + 146 + 20, cy, 80U, btn=273U)
assert_eq(comp.shell.menu_title, "B")
// Pill 1 is window 2's app.
click_at(comp, tasks.x + 156 + 20, cy, 80U, btn=273U)
assert_eq(comp.shell.menu_title, "b")
comp.handle_input(@nested.InputEvent::Key(1U, true), 85U) // Escape
assert_true(!comp.shell.menu_open)
// Quit asks the app to close its window (xdg_toplevel.close, opcode 1 on its toplevel).
@@ -360,9 +365,9 @@ test "right-click a task-bar pill for the window's menu: Minimize, Maximize, Qui
@sys.sleep_ms(2)
}
assert_true(has_msg(drain_msgs(c), tl, 1U))
// Empty task-bar space keeps the module's own menu.
// Empty dock space keeps the module's own menu.
click_at(comp, tasks.x + tasks.w - 10, cy, 110U, btn=273U)
assert_eq(comp.shell.menu_title, "Task Manager")
assert_eq(comp.shell.menu_title, "Dock")
assert_true(labels().contains("Remove widget"))
}
@@ -614,9 +619,9 @@ test "the wasm picker opens the settings module's Panel tab, which loads and unl
assert_true(texts.contains("Browse for a module file..."))
// The Add list leaves out what is already in the panel (but a clock can be added twice) and
// has no cryptic instance counts.
assert_eq(texts.filter(t => t == "Task Manager").length(), 1)
assert_eq(texts.filter(t => t == "Dock").length(), 1)
assert_false(texts.contains("x1"))
assert_true(texts.contains("Pinned apps, one click away")) // the Dock's description
assert_true(texts.contains("The time in binary")) // the Binary Clock's description
let loaded = comp.shell.slots().length()
assert_eq(comp.shell.slot_of("clock-binary"), "")
let by = row_y("Binary Clock", false)
@@ -930,25 +935,24 @@ test "the dock: pinned and running apps, window dots, the hover label and the pe
comp.shell.apps.clear()
for id in ["foot", "firefox", "gimp"] {
comp.shell.apps.push({ id, name: id.to_upper(), comment: "", category: "", glyph: "x" })
comp.shell.exec.set(id, id)
}
comp.shell.apps_dirty = true
assert_true(comp.shell.load_path("build/components/dock.wasm") is Some(_))
ignore(comp.compose_frame())
let slot = comp.shell.slots().filter(s => comp.shell.slot_module(s).contains("dock"))[0]
// The dock is in the default panel; icons only here (titled pills are the default).
let slot = comp.shell.slot_of("dock")
comp.shell.set_module_setting(slot, "titles", "off")
let pinned = fn() {
comp.shell.slot_config(slot).filter(it => it.key == "pinned")[0].value
}
// Nothing chosen yet: the catalog's first apps, saved so launches don't reorder them.
assert_eq(pinned(), "foot;firefox;gimp")
// The pinned list isn't a row of the dock's settings menu.
let w0 = comp.shell.slot_rect(slot).w
// A foot window joins foot's icon; an unknown app gets its own icon after the pinned ones.
let _a = open_and_configure_client(comp, socket_path, "Term", "foot")
let _b = open_and_configure_client(comp, socket_path, "Other", "zzz")
ignore(comp.compose_frame())
ignore(comp.compose_frame())
let r = comp.shell.slot_rect(slot)
assert_true(r.w > w0) // the dock grew for the running app
let cy = r.y + r.h / 2
let pitch = 24 + 6 // medium icons
let x_of = fn(i : Int) { r.x + 6 + i * pitch + 12 + (if i >= 3 { 11 } else { 0 }) }
@@ -968,7 +972,9 @@ test "the dock: pinned and running apps, window dots, the hover label and the pe
click_at(comp, x_of(0), cy, 10U, btn=273U)
assert_true(comp.shell.menu_open)
assert_eq(comp.shell.menu_title, "FOOT")
assert_eq(labels(), ["New window", "Unpin from dock", "Move right", "Quit", "Dock settings..."])
assert_eq(labels(), [
"New window", "Unpin from dock", "Move right", "Minimize", "Maximize", "Quit", "Dock settings...",
])
assert_eq(comp.shell.dock_hover_name(), "") // no label over the menu
pick("Move right", 20U)
assert_eq(pinned(), "firefox;foot;gimp")
@@ -983,7 +989,8 @@ test "the dock: pinned and running apps, window dots, the hover label and the pe
let x2 = r.x + 6 + 2 * pitch + 11 + 12
click_at(comp, x2, cy, 50U, btn=273U)
assert_eq(comp.shell.menu_title, "zzz")
assert_eq(labels(), ["New window", "Pin to dock", "Quit", "Dock settings..."])
// Not in the app catalog: nothing to start a new window with.
assert_eq(labels(), ["Pin to dock", "Minimize", "Maximize", "Quit", "Dock settings..."])
pick("Pin to dock", 60U)
assert_eq(pinned(), "foot;gimp;zzz")
// Dock settings: the visible settings only.
@@ -998,7 +1005,7 @@ test "the dock: pinned and running apps, window dots, the hover label and the pe
pick("Large", 90U)
comp.handle_input(@nested.InputEvent::Key(1U, true), 95U) // Escape
ignore(comp.compose_frame())
assert_true(comp.shell.slot_rect(slot).w > r.w) // bigger icons, wider dock
assert_eq(comp.shell.module_setting("dock", "icon-size"), Some("Large"))
// A left click on a running app's icon focuses its window.
let focused = fn() {
let mut f = 0UL
+26 -2
View File
@@ -84,9 +84,21 @@ fn ChandraCompositor::shortcut_key(self : ChandraCompositor, code : UInt, presse
if @shell.is_modifier_key(code) || self.shell.inspecting() {
return false
}
match self.shell.shortcuts.lookup({ mods: self.held_mods(), key: code }) {
let combo : @shell.KeyCombo = { mods: self.held_mods(), key: code }
match self.shell.shortcuts.lookup(combo) {
// Window switching is the switcher's (switcher_key runs before this).
None | Some(SwitchWindows) => false
Some(SwitchWindows) => false
// Super+2 .. Super+9 aren't in the table: they follow the "Open dock app" combo.
None | Some(DockApps) =>
match self.shell.shortcuts.dock_app(combo) {
Some(n) if self.open_dock_app(n) => {
self.sc_swallow.push(code)
self.super_solo = false
true
}
Some(_) => false
None => false
}
Some(action) => {
self.sc_swallow.push(code)
self.run_shortcut(action)
@@ -117,8 +129,20 @@ pub fn ChandraCompositor::run_shortcut(self : ChandraCompositor, action : @shell
RecordRegion => self.toggle_recording(ShotMode::Region)
RecordScreen => self.toggle_recording(ShotMode::FullScreen)
RecordWindow => self.toggle_recording(ShotMode::WindowUnderCursor)
DockApps => ignore(self.open_dock_app(1))
}
}
///| Super+`n`: the dock's `n`-th app, as if its icon were clicked. False when there is no dock
/// or no such app (the key then goes to the focused window as usual).
fn ChandraCompositor::open_dock_app(self : ChandraCompositor, n : Int) -> Bool {
if self.shell.inspecting() || !self.shell.open_dock_item(n) {
return false
}
self.run_shell_actions()
self.damage.mark_full()
true
}
///| evdev code of Backspace (unbinds while capturing).
let key_backspace : UInt = 14
+1
View File
@@ -34,6 +34,7 @@ test "the default shortcuts are the compositor's long-standing combos" {
("record-region", "Super+Shift+R"),
("record-screen", "Super+Alt+R"),
("record-window", "Super+Ctrl+R"),
("dock-apps", "Super+1"),
]
let sc = @shell.Shortcuts::defaults()
assert_eq(@shell.shortcut_table.length(), want.length())