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

+69 -14
View File
@@ -10,8 +10,8 @@ fn apps() -> Array[@types.AppEntry] {
}
///|
fn win(id : Int, app : String, focused? : Bool = false) -> DockWindow {
{ id: id.to_uint64(), app_id: app, focused }
fn win(id : Int, app : String, focused? : Bool = false, minimized? : Bool = false) -> DockWindow {
{ id: id.to_uint64(), app_id: app, focused, title: app + " window", minimized }
}
///|
@@ -41,10 +41,10 @@ fn tokens() -> @theme.Tokens {
test "without a choice the dock pins the catalog's first apps; the choice round-trips" {
let c = DockConfig::new()
assert_eq(c.pins(apps()), ["foot", "firefox", "org.gnome.Nautilus", "gimp", "org.kde.kate"])
assert_eq(c.items()[3].value, "")
assert_eq(c.items()[4].value, "")
assert_true(c.set("pinned", "vlc;foot"))
assert_eq(c.pins(apps()), ["vlc", "foot"])
assert_eq(c.items()[3], { key: "pinned", label: "", choices: [], value: "vlc;foot" })
assert_eq(c.items()[4], { key: "pinned", label: "", choices: [], value: "vlc;foot" })
// Unpinning everything is a choice too, not "back to the defaults".
assert_true(c.set("pinned", encode_pins([])))
assert_eq(c.pins(apps()), [])
@@ -102,7 +102,7 @@ test "pinned apps come first in their order, then running ones, with their windo
///|
test "items are hit-tested by slot, with a divider before the running apps" {
let c = DockConfig::from_pairs([("pinned", "foot;firefox")])
let c = DockConfig::from_pairs([("pinned", "foot;firefox"), ("titles", "off")])
let its = items(c, apps(), [win(1, "vlc")])
let h = 36
let w = preferred_width(its, c, h)
@@ -110,12 +110,12 @@ test "items are hit-tested by slot, with a divider before the running apps" {
assert_eq(item_at(its, c, w, h, 6, 10), 0)
assert_eq(item_at(its, c, w, h, 6 + p, 10), 1)
// The divider shifts the running app right.
assert_eq(item_center(its, c, h, 2) - item_center(its, c, h, 1), p + 11)
assert_eq(item_at(its, c, w, h, item_center(its, c, h, 2), 10), 2)
assert_eq(item_center(its, c, w, h, 2) - item_center(its, c, w, h, 1), p + 11)
assert_eq(item_at(its, c, w, h, item_center(its, c, w, h, 2), 10), 2)
assert_eq(item_at(its, c, w, h, w + 5, 10), -1)
assert_eq(item_at(its, c, w, h, 6, -1), -1)
// Too narrow for all of them: the ones that don't fit can't be hit.
assert_eq(item_at(its, c, w - 10, h, item_center(its, c, h, 2), 10), -1)
assert_eq(item_at(its, c, w - 10, h, item_center(its, c, w, h, 2), 10), -1)
// Bigger icons, wider dock; magnification grows the hovered one most.
let big = DockConfig::from_pairs([("pinned", "foot;firefox"), ("icon-size", "Large")])
assert_true(preferred_width(items(big, apps(), []), big, 44) > preferred_width(items(c, apps(), []), c, 44))
@@ -127,12 +127,12 @@ test "items are hit-tested by slot, with a divider before the running apps" {
///|
test "a click starts an app that isn't running and walks through a running app's windows" {
let c = DockConfig::from_pairs([("pinned", "foot;firefox")])
let c = DockConfig::from_pairs([("pinned", "foot;firefox"), ("titles", "off")])
let its = items(c, apps(), [win(3, "foot"), win(8, "foot")])
let h = 36
let w = preferred_width(its, c, h)
let x0 = item_center(its, c, h, 0)
let x1 = item_center(its, c, h, 1)
let x0 = item_center(its, c, w, h, 0)
let x1 = item_center(its, c, w, h, 1)
let (hv, redraw, act) = handle(its, c, -1, w, h, None, PointerMove({ x: x1, y: 10 }))
assert_eq((hv, redraw, act), (1, true, Nothing))
assert_eq(handle(its, c, 1, w, h, None, PointerMove({ x: x1, y: 10 })).1, false)
@@ -150,7 +150,7 @@ test "a click starts an app that isn't running and walks through a running app's
///|
test "render draws each icon (theme image or letter tile), a dot per window and the divider" {
let c = DockConfig::from_pairs([("pinned", "foot;firefox")])
let c = DockConfig::from_pairs([("pinned", "foot;firefox"), ("titles", "off")])
let its = items(c, apps(), [win(3, "foot", focused=true), win(4, "vlc"), win(5, "vlc")])
let h = 36
let w = preferred_width(its, c, h)
@@ -161,9 +161,38 @@ test "render draws each icon (theme image or letter tile), a dot per window and
assert_eq(texts.length(), 2) // foot's and vlc's letter tiles
// background + divider + foot (tile, glyph, 1 dot) + firefox (image) + vlc (tile, glyph, 2 dots)
assert_eq(ops.length(), 1 + 1 + 3 + 1 + 4)
// Nothing to show.
// Nothing to show: a "+" tile (fill, outline, two strokes) and its hint, after the background.
let none = DockConfig::from_pairs([("pinned", ";")])
assert_eq(render(@ui.size(80, h), tokens(), none, [], -1, _ => 0U).length(), 2)
let empty = render(@ui.size(preferred_width([], none, h), h), tokens(), none, [], -1, _ => 0U)
assert_eq(empty.length(), 6)
assert_true(empty.iter().any(op => op is Text(t) && t.text == "Add apps"))
}
///|
test "the empty dock is one target: hovering it lights the + tile, a click is the shell's" {
let none = DockConfig::from_pairs([("pinned", ";")])
let (hv, redraw, act) = handle([], none, -1, 150, 36, None, PointerMove({ x: 10, y: 10 }))
assert_eq((hv, redraw, act), (0, true, Nothing))
let (_, _, act) = handle([], none, 0, 150, 36, None, PointerDown({ x: 10, y: 10 }))
assert_eq(act, Nothing)
}
///|
test "a window's app: a pin, a catalog app, or its own id" {
let a = apps()
assert_eq(owner_of("org.mozilla.firefox", [], a), Some("firefox"))
assert_eq(owner_of("vlc", ["vlc"], a), Some("vlc"))
assert_eq(owner_of("org.example.Notes", [], a), Some("org.example.Notes"))
assert_eq(owner_of("", [], a), None)
}
///|
test "activate starts an app without windows and brings one forward otherwise" {
let c = DockConfig::from_pairs([("pinned", "foot;firefox")])
let its = items(c, apps(), [win(3, "foot", focused=true), win(4, "foot")])
assert_eq(activate(its[1], Some(3UL)), Launch("firefox"))
assert_eq(activate(its[0], None), Focus(4UL))
assert_eq(activate(its[0], Some(3UL)), Focus(4UL))
}
///|
@@ -196,3 +225,29 @@ test "an app's icon is its coloured tile plus glyph" {
_ => fail("expected a tile")
}
}
///|
test "apps with windows are titled pills that shrink, then drop their titles, as room runs out" {
let c = DockConfig::from_pairs([("pinned", "foot;firefox")])
let its = items(c, apps(), [win(3, "foot"), win(4, "vlc", minimized=true), win(5, "vlc")])
let h = 36
let base = icon_size(c, h)
// Room for all: foot and vlc get full pills, firefox (no windows) stays an icon.
assert_eq(widths(its, c, 1000, h), [label_max, base, label_max])
assert_eq(item_title(its[0]), "foot window")
assert_eq(item_title(its[2]), "vlc! (2)")
assert_eq(its[2].minimized, 1)
// Less room: the pills share what's left...
let ws = widths(its, c, 300, h)
assert_true(ws[0] < label_max && ws[0] >= label_min && ws[0] == ws[2])
assert_true(slot_x(its, c, 300, h, 2) + ws[2] + 6 <= 300)
// ...and below label_min they are icons again.
assert_eq(widths(its, c, 150, h), [base, base, base])
// A click anywhere on a pill is that app.
assert_eq(item_at(its, c, 1000, h, 6 + label_max - 10, 10), 0)
let ops = render(@ui.size(1000, h), tokens(), c, its, -1, _ => 0U)
assert_true(ops.iter().any(op => op is Text(t) && t.text == "foot window"))
// Off: icons only.
assert_true(c.set("titles", "off"))
assert_eq(widths(its, c, 1000, h), [base, base, base])
}