Dock: pinned and running apps with real icons, window dots, hover names and a per-app menu
CI / test (push) Failing after 17s

The dock showed the first eight catalog apps as letter tiles, and that list reshuffled after
every launch (the catalog puts recent apps first). Now:

- Pinned apps first, in the order you set, then the other running apps after a thin divider
  (like macOS). Windows find their app by desktop id, case, the last dotted part, or the app's
  name (xterm -> debian-xterm.desktop "XTerm"); windows without an app id stay out.
- Real icons from the icon theme (the `icons` capability, as in the task manager), with the
  letter tile as fallback. The shell publishes icons for pinned apps that aren't running too.
- A dot under an icon per open window (up to three), a longer accent bar when the app has focus.
- Click: start the app if it isn't running, otherwise bring its newest window forward
  (restoring it if minimized); click a focused app again to step through its windows.
- Hover: the icon grows (neighbours a little) on a light highlight, and the shell draws the app's
  name in a label above it.
- Right-click an icon (drawn by the shell, like the task manager's window menu): Open / New
  window, Pin to dock / Unpin from dock, Move left / Move right, Quit or Close N windows, and
  Dock settings.
- Dock settings (module-config): Icon size (Small/Medium/Large), Magnify icons under the
  pointer, Show running apps that aren't pinned. The pinned list is a hidden setting (empty
  label: the shell's settings menu skips it), saved in state.edn's :module-config. Until it is
  set the dock pins the catalog's first five, and the shell saves that once so launches don't
  move them.
- The panel sizes the dock from its current items (a module's preferred width is read once).

Plumbing: new WIT world dock-widget (app-catalog, app-launch, windows, icons, exports
module-config); no new interfaces, so both hosts load it as is. lib/dock holds the items,
layout, hit-testing, drawing and pin edits, shared by the module and compositor/shell/dock.mbt.
The shell's Launch handling moved into launch_catalog_app so the menu can use it.
Also: DesktopShell::pointer_move delivered every hover move twice (a duplicated block).

Tests: lib/dock (settings round trip, app matching, item order, hit-testing with the divider,
clicks and window cycling, drawing, pin edits), compositor/host input_test (the dock in a real
compositor: saved default pins, growing for running apps, hover label, the menu's rows and
actions, settings menu without the pinned row, focusing by click), dock_test (screenshots in
_build/dock_hover.png and dock_menu.png).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DPL5hkmB8pJF5ckPeecFxL
This commit is contained in:
Claude committed 2026-11-25 22:15:01 +00:00
1 parent 0ce0de0356
commit c45e0ef431
29 files changed
+1497 -176

No files matched your search

+11 -20
View File
@@ -335,6 +335,9 @@ pub(all) struct DesktopShell {
mut drag_x0 : Int
mut drag_y0 : Int
mut drag_active : Bool
/// Where the pointer last was (the dock's hover label follows it).
mut ptr_x : Int
mut ptr_y : Int
// WIT inspector state (see inspector.mbt)
mut inspect_on : Bool
mut hover_id : String
@@ -442,6 +445,8 @@ pub fn DesktopShell::new(display : String) -> DesktopShell {
drag_x0: 0,
drag_y0: 0,
drag_active: false,
ptr_x: -1,
ptr_y: -1,
inspect_on: false,
hover_id: "",
hover_x: 0,
@@ -781,6 +786,8 @@ pub fn DesktopShell::pointer_up(self : DesktopShell) -> Bool {
///| Pointer motion; returns true when over a popup or the menu (so windows don't see it).
pub fn DesktopShell::pointer_move(self : DesktopShell, x : Int, y : Int) -> Bool {
self.ptr_x = x
self.ptr_y = y
if self.desk_drag {
self.desk_set = true
self.desk_x = x - self.desk_off_x
@@ -822,26 +829,6 @@ pub fn DesktopShell::pointer_move(self : DesktopShell, x : Int, y : Int) -> Bool
Some(w) => ignore(self.deliver(w, false, PointerMove(x - w.rect.x, y - w.rect.y)))
None => ()
}
// Hover: the widget under the pointer sees moves, the one it left sees a leave.
let hovered = match self.widget_at(x, y) {
Some(w) if !self.popup_covers(x, y) => Some(w)
_ => None
}
let hslot = match hovered {
Some(w) => w.slot
None => ""
}
if hslot != self.hover_slot {
match self.widget_by_slot(self.hover_slot) {
Some(old) => ignore(self.deliver(old, false, PointerLeave))
None => ()
}
self.hover_slot = hslot
}
match hovered {
Some(w) => ignore(self.deliver(w, false, PointerMove(x - w.rect.x, y - w.rect.y)))
None => ()
}
let mut over = false
for w in self.widgets.copy() {
if w.popup_rect.w > 0 {
@@ -950,6 +937,7 @@ pub fn DesktopShell::render(
if self.widgets.iter().any(w => w.has_cap("system") || w.has_cap("windows")) {
@wasm.set_windows(self.win_list)
}
self.settle_dock_pins()
if self.widgets.iter().any(w => w.has_cap("icons")) {
self.publish_icons()
}
@@ -977,6 +965,9 @@ pub fn DesktopShell::render(
self.refresh_popup(wd)
self.draw_popup(wd, panel_ops)
}
if !self.menu_open && !self.drag_active {
self.render_dock_label(tokens, panel_ops)
}
if self.menu_open {
self.render_menu(w, tokens, panel_ops)
} else {