Dock: plain icons always come before the task pills
CI / test (push) Failing after 2m33s

With window titles on, a pinned app that was running drew as a pill in its
pin slot, so idle pinned icons ended up between pills. Now the dock shows
the pinned apps that aren't running first, then every task: running pinned
apps in pin order, then the other running apps. The divider sits between
the two groups. Squeezing the pills to icons keeps the order; with titles
off the plain pinned order stays. Move left / right in the menu follow the
pin list, not the shown position.

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 01:53:43 +00:00
1 parent 5403777451
commit 01bd8281d5
5 files changed
+72 -26

No files matched your search

+33 -8
View File
@@ -190,9 +190,11 @@ test "a window's app: a pin, a catalog app, or its own id" {
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))
// Firefox isn't running, so it comes first (before foot's task pill).
assert_eq(its.map(i => i.id), ["firefox", "foot"])
assert_eq(activate(its[0], Some(3UL)), Launch("firefox"))
assert_eq(activate(its[1], None), Focus(4UL))
assert_eq(activate(its[1], Some(3UL)), Focus(4UL))
}
///|
@@ -232,22 +234,45 @@ test "apps with windows are titled pills that shrink, then drop their titles, as
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")
// Room for all: firefox (no windows) is an icon, first; foot and vlc get full pills.
assert_eq(its.map(i => i.id), ["firefox", "foot", "vlc"])
assert_eq(widths(its, c, 1000, h), [base, label_max, label_max])
assert_eq(item_title(its[1]), "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(ws[1] < label_max && ws[1] >= label_min && ws[1] == 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 x1 = slot_x(its, c, 1000, h, 1)
assert_eq(item_at(its, c, 1000, h, x1 + label_max - 10, 10), 1)
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])
}
///|
test "with titles, plain icons always come before the tasks" {
let c = DockConfig::from_pairs([("pinned", "firefox;nautilus-x;foot;gimp")])
let a = apps() + [{ id: "nautilus-x", name: "Files", comment: "", category: "", glyph: "F" }]
let wins = [win(1, "firefox"), win(2, "foot"), win(3, "vlc"), win(4, "org.kde.kate")]
let its = items(c, a, wins)
// Not running: Files, GIMP; then the tasks: pinned Firefox, foot, then vlc and Kate.
assert_eq(its.map(i => i.id), ["nautilus-x", "gimp", "firefox", "foot", "vlc", "org.kde.kate"])
// The divider goes between the icons and the tasks.
assert_eq(first_running(its, c), 2)
let h = 36
assert_eq(slot_x(its, c, 2000, h, 2) - slot_x(its, c, 2000, h, 1), icon_size(c, h) + 6 + 11)
// Squeezed to icons, the order stays (so a click lands where it did).
assert_eq(widths(its, c, 200, h).map(x => x == icon_size(c, h)), [true, true, true, true, true, true])
// Titles off: the pinned order, running apps after the divider.
assert_true(c.set("titles", "off"))
let its = items(c, a, wins)
assert_eq(its.map(i => i.id), ["firefox", "nautilus-x", "foot", "gimp", "vlc", "org.kde.kate"])
assert_eq(first_running(its, c), 4)
}