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:
5 files changed
+72
-26
No files matched your search
@@ -146,9 +146,9 @@ a recording shortcut again to stop.
|
|||||||
(reload every panel module from disk, keeping the panel and module settings; windows and apps
|
(reload every panel module from disk, keeping the panel and module settings; windows and apps
|
||||||
keep running), **Log out**, **Suspend**, **Restart** and **Power off**. Log out, Restart and
|
keep running), **Log out**, **Suspend**, **Restart** and **Power off**. Log out, Restart and
|
||||||
Power off ask for a second click.
|
Power off ask for a second click.
|
||||||
* **Dock**, the panel's task manager: pinned apps, then the other running apps after a divider,
|
* **Dock**, the panel's task manager: the pinned apps that aren't running as plain icons, then
|
||||||
with their theme icons and a dot per open window (lit when the app has focus). An app with
|
after a divider every running app (pinned ones in pin order first), with their theme icons and
|
||||||
windows is a pill with its window's title (or its name and window count) while there is room,
|
a dot per open window (lit when the app has focus). An app with windows is a pill with its window's title (or its name and window count) while there is room,
|
||||||
just its icon when the panel gets crowded. Click to start an app or bring its newest window
|
just its icon when the panel gets crowded. Click to start an app or bring its newest window
|
||||||
forward (restoring it if minimized); click a focused app again to step through its windows.
|
forward (restoring it if minimized); click a focused app again to step through its windows.
|
||||||
**Super+1** .. **Super+9** do the same for the first nine. Right-click an app for Open / New
|
**Super+1** .. **Super+9** do the same for the first nine. Right-click an app for Open / New
|
||||||
|
|||||||
@@ -113,21 +113,25 @@ test "the dock is the panel's task manager: empty + opens Applications, pin from
|
|||||||
}
|
}
|
||||||
f
|
f
|
||||||
}
|
}
|
||||||
super_key(comp, 3U, 40U) // Super+2
|
// Vim isn't running, so its icon comes first, then the tasks: Writer, Calc (pin order).
|
||||||
|
assert_eq(comp.shell.dock_item_ids(), ["vim", "libreoffice-writer", "libreoffice-calc"])
|
||||||
|
super_key(comp, 4U, 40U) // Super+3
|
||||||
assert_eq(focused(), "Budget.ods")
|
assert_eq(focused(), "Budget.ods")
|
||||||
super_key(comp, 2U, 50U) // Super+1: Writer's newest window, then its other one
|
super_key(comp, 3U, 50U) // Super+2: Writer's newest window, then its other one
|
||||||
assert_eq(focused(), "Notes.odt")
|
assert_eq(focused(), "Notes.odt")
|
||||||
super_key(comp, 2U, 60U)
|
super_key(comp, 3U, 60U)
|
||||||
assert_eq(focused(), "Report.odt")
|
assert_eq(focused(), "Report.odt")
|
||||||
// Writer's menu lists its two windows by title; picking one brings it forward.
|
// Writer's menu lists its two windows by title; picking one brings it forward.
|
||||||
let r = comp.shell.slot_rect(slot)
|
let r = comp.shell.slot_rect(slot)
|
||||||
click_at(comp, r.x + 6 + 12, r.y + r.h / 2, 70U, btn=273U)
|
let writer_x = r.x + 6 + 24 + 6 + 11 + 20 // after Vim's icon and the divider
|
||||||
|
click_at(comp, writer_x, r.y + r.h / 2, 70U, btn=273U)
|
||||||
|
assert_eq(comp.shell.menu_title, "LibreOffice Writer")
|
||||||
let labels = comp.shell.menu_rows.map(r => r.label)
|
let labels = comp.shell.menu_rows.map(r => r.label)
|
||||||
assert_true(labels.contains("Report.odt") && labels.contains("Notes.odt"))
|
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())))
|
ignore(@sys.write_file_bytes("_build/dock_bar_menu.png", @renderer.encode_png(comp.compose_frame())))
|
||||||
dock_pick(comp, "Notes.odt", 80U)
|
dock_pick(comp, "Notes.odt", 80U)
|
||||||
ignore(comp.compose_frame())
|
ignore(comp.compose_frame())
|
||||||
assert_eq(focused(), "Notes.odt")
|
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)
|
comp.handle_input(@nested.InputEvent::PointerMove((r.x + 6 + 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())))
|
ignore(@sys.write_file_bytes("_build/dock_bar.png", @renderer.encode_png(comp.compose_frame())))
|
||||||
}
|
}
|
||||||
@@ -184,11 +184,13 @@ fn DesktopShell::open_dock_menu(
|
|||||||
}
|
}
|
||||||
if it.pinned {
|
if it.pinned {
|
||||||
rows.push(dock_row("Unpin from dock", 8, it.id))
|
rows.push(dock_row("Unpin from dock", 8, it.id))
|
||||||
let pinned = items.filter(x => x.pinned).length()
|
// Its place among the pins (the dock may show running pins after the idle ones).
|
||||||
if i > 0 {
|
let pins = dock_config(w).pins(self.apps)
|
||||||
|
let at = pins.search(it.id).unwrap_or(i)
|
||||||
|
if at > 0 {
|
||||||
rows.push(dock_row("Move left", 9, it.id, value="-1"))
|
rows.push(dock_row("Move left", 9, it.id, value="-1"))
|
||||||
}
|
}
|
||||||
if i < pinned - 1 {
|
if at < pins.length() - 1 {
|
||||||
rows.push(dock_row("Move right", 9, it.id, value="1"))
|
rows.push(dock_row("Move right", 9, it.id, value="1"))
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -467,3 +469,11 @@ fn DesktopShell::dock_click(self : DesktopShell, w : Widget) -> Bool {
|
|||||||
self.toggle_launcher()
|
self.toggle_launcher()
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///| The app ids of the first dock's items, in the order it shows them.
|
||||||
|
pub fn DesktopShell::dock_item_ids(self : DesktopShell) -> Array[String] {
|
||||||
|
match self.dock_widget() {
|
||||||
|
Some(w) => self.dock_state(w).1.map(it => it.id)
|
||||||
|
None => []
|
||||||
|
}
|
||||||
|
}
|
||||||
+14
-7
@@ -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
|
///| 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(
|
pub fn items(
|
||||||
cfg : DockConfig,
|
cfg : DockConfig,
|
||||||
apps : Array[@types.AppEntry],
|
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).
|
///| 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
|
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 = i + 1
|
||||||
}
|
}
|
||||||
i
|
i
|
||||||
@@ -386,7 +393,7 @@ fn widths(items : Array[DockItem], cfg : DockConfig, w : Int, h : Int) -> Array[
|
|||||||
let base = icon_size(cfg, h)
|
let base = icon_size(cfg, h)
|
||||||
let titled = items.map(it => cfg.titles && it.windows.length() > 0)
|
let titled = items.map(it => cfg.titles && it.windows.length() > 0)
|
||||||
let n = items.length()
|
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 }) +
|
let fixed = 2 * pad + (if n > 1 { (n - 1) * gap } else { 0 }) +
|
||||||
(if split > 0 && split < n { divider_w } else { 0 })
|
(if split > 0 && split < n { divider_w } else { 0 })
|
||||||
let mut nt = 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.
|
///| Left edge of item `i`'s slot.
|
||||||
fn slot_x(items : Array[DockItem], cfg : DockConfig, w : Int, h : Int, i : Int) -> Int {
|
fn slot_x(items : Array[DockItem], cfg : DockConfig, w : Int, h : Int, i : Int) -> Int {
|
||||||
let ws = widths(items, cfg, w, h)
|
let ws = widths(items, cfg, w, h)
|
||||||
let split = first_running(items)
|
let split = first_running(items, cfg)
|
||||||
let mut x = pad
|
let mut x = pad
|
||||||
for j = 0; j < i; j = j + 1 {
|
for j = 0; j < i; j = j + 1 {
|
||||||
x = x + ws[j] + gap
|
x = x + ws[j] + gap
|
||||||
@@ -616,7 +623,7 @@ pub fn render(
|
|||||||
let base = icon_size(cfg, h)
|
let base = icon_size(cfg, h)
|
||||||
let cy = (h - dots_h) / 2 + 2
|
let cy = (h - dots_h) / 2 + 2
|
||||||
let fs = t.font_size.reinterpret_as_int() - 3
|
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 {
|
if split > 0 && split < n {
|
||||||
let x = slot_x(items, cfg, w, h, split) - gap / 2 - divider_w / 2 - 1
|
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))
|
ops.push(@ui.fill_rect(@ui.rect(x, 6, 1, h - 12), t.palette.border))
|
||||||
|
|||||||
@@ -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" {
|
test "activate starts an app without windows and brings one forward otherwise" {
|
||||||
let c = DockConfig::from_pairs([("pinned", "foot;firefox")])
|
let c = DockConfig::from_pairs([("pinned", "foot;firefox")])
|
||||||
let its = items(c, apps(), [win(3, "foot", focused=true), win(4, "foot")])
|
let its = items(c, apps(), [win(3, "foot", focused=true), win(4, "foot")])
|
||||||
assert_eq(activate(its[1], Some(3UL)), Launch("firefox"))
|
// Firefox isn't running, so it comes first (before foot's task pill).
|
||||||
assert_eq(activate(its[0], None), Focus(4UL))
|
assert_eq(its.map(i => i.id), ["firefox", "foot"])
|
||||||
assert_eq(activate(its[0], Some(3UL)), Focus(4UL))
|
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 its = items(c, apps(), [win(3, "foot"), win(4, "vlc", minimized=true), win(5, "vlc")])
|
||||||
let h = 36
|
let h = 36
|
||||||
let base = icon_size(c, h)
|
let base = icon_size(c, h)
|
||||||
// Room for all: foot and vlc get full pills, firefox (no windows) stays an icon.
|
// Room for all: firefox (no windows) is an icon, first; foot and vlc get full pills.
|
||||||
assert_eq(widths(its, c, 1000, h), [label_max, base, label_max])
|
assert_eq(its.map(i => i.id), ["firefox", "foot", "vlc"])
|
||||||
assert_eq(item_title(its[0]), "foot window")
|
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(item_title(its[2]), "vlc! (2)")
|
||||||
assert_eq(its[2].minimized, 1)
|
assert_eq(its[2].minimized, 1)
|
||||||
// Less room: the pills share what's left...
|
// Less room: the pills share what's left...
|
||||||
let ws = widths(its, c, 300, h)
|
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)
|
assert_true(slot_x(its, c, 300, h, 2) + ws[2] + 6 <= 300)
|
||||||
// ...and below label_min they are icons again.
|
// ...and below label_min they are icons again.
|
||||||
assert_eq(widths(its, c, 150, h), [base, base, base])
|
assert_eq(widths(its, c, 150, h), [base, base, base])
|
||||||
// A click anywhere on a pill is that app.
|
// 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)
|
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"))
|
assert_true(ops.iter().any(op => op is Text(t) && t.text == "foot window"))
|
||||||
// Off: icons only.
|
// Off: icons only.
|
||||||
assert_true(c.set("titles", "off"))
|
assert_true(c.set("titles", "off"))
|
||||||
assert_eq(widths(its, c, 1000, h), [base, base, base])
|
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)
|
||||||
|
}
|
||||||
Reference in new issue
Block a user