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

+14 -7
View File
@@ -271,7 +271,8 @@ pub fn owner_of(
}
///| The dock's icons: the pinned apps in their order, then the other running apps in the order
/// they first opened a window (when `cfg.running`). Windows without an app id aren't shown.
/// they first opened a window (when `cfg.running`). With window titles on, the pinned apps that
/// aren't running come first, so plain icons never sit after a task pill. Windows without an app id aren't shown.
pub fn items(
cfg : DockConfig,
apps : Array[@types.AppEntry],
@@ -329,13 +330,19 @@ pub fn items(
}
}
}
out
if !cfg.titles {
return out
}
// With window titles the running apps are task pills: the plain icons (pinned apps that
// aren't running) come first, then every task, pinned ones in pin order, then the others.
out.filter(it => it.windows.length() == 0) + out.filter(it => it.windows.length() > 0)
}
///| Index of the first unpinned item (items.length() when all are pinned).
fn first_running(items : Array[DockItem]) -> Int {
/// With window titles on the divider sits between the plain icons and the tasks instead.
fn first_running(items : Array[DockItem], cfg : DockConfig) -> Int {
let mut i = 0
while i < items.length() && items[i].pinned {
while i < items.length() && items[i].pinned && !(cfg.titles && items[i].windows.length() > 0) {
i = i + 1
}
i
@@ -386,7 +393,7 @@ fn widths(items : Array[DockItem], cfg : DockConfig, w : Int, h : Int) -> Array[
let base = icon_size(cfg, h)
let titled = items.map(it => cfg.titles && it.windows.length() > 0)
let n = items.length()
let split = first_running(items)
let split = first_running(items, cfg)
let fixed = 2 * pad + (if n > 1 { (n - 1) * gap } else { 0 }) +
(if split > 0 && split < n { divider_w } else { 0 })
let mut nt = 0
@@ -419,7 +426,7 @@ pub fn titled_at(items : Array[DockItem], cfg : DockConfig, w : Int, h : Int, i
///| Left edge of item `i`'s slot.
fn slot_x(items : Array[DockItem], cfg : DockConfig, w : Int, h : Int, i : Int) -> Int {
let ws = widths(items, cfg, w, h)
let split = first_running(items)
let split = first_running(items, cfg)
let mut x = pad
for j = 0; j < i; j = j + 1 {
x = x + ws[j] + gap
@@ -616,7 +623,7 @@ pub fn render(
let base = icon_size(cfg, h)
let cy = (h - dots_h) / 2 + 2
let fs = t.font_size.reinterpret_as_int() - 3
let split = first_running(items)
let split = first_running(items, cfg)
if split > 0 && split < n {
let x = slot_x(items, cfg, w, h, split) - gap / 2 - divider_w / 2 - 1
ops.push(@ui.fill_rect(@ui.rect(x, 6, 1, h - 12), t.palette.border))