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

+99
View File
@@ -0,0 +1,99 @@
// Generated using `moon info`, DON'T EDIT IT
package "chandra/desktop/lib/dock"
import {
"chandra/desktop/interface/chandra/desktop/theme",
"chandra/desktop/interface/chandra/desktop/types",
"moonbitlang/core/debug",
}
// Values
pub fn app_glyph(String, String) -> String
pub fn app_icon(Int32, Int32, Int32, String, String, hover? : Bool) -> Array[@types.DrawOp]
pub fn click_target(DockItem, UInt64?) -> UInt64?
pub let config : DockConfig
pub fn decode_pins(String) -> Array[String]?
pub let default_pin_count : Int32
pub fn encode_pins(Array[String]) -> String
pub fn handle(Array[DockItem], DockConfig, Int32, Int32, Int32, UInt64?, @types.InputEvent) -> (Int32, Bool, DockAction)
pub fn icon_size(DockConfig, Int32) -> Int32
pub fn item_at(Array[DockItem], DockConfig, Int32, Int32, Int32, Int32) -> Int32
pub fn item_center(Array[DockItem], DockConfig, Int32, Int32) -> Int32
pub fn item_size(DockConfig, Int32, Int32, Int32) -> Int32
pub fn items(DockConfig, Array[@types.AppEntry], Array[DockWindow]) -> Array[DockItem]
pub fn match_app(String, Array[String]) -> String?
pub fn move_pin(Array[String], String, Int32) -> Array[String]
pub fn preferred_width(Array[DockItem], DockConfig, Int32) -> Int32
pub fn render(@types.Size, @theme.Tokens, DockConfig, Array[DockItem], Int32, (String) -> UInt32) -> Array[@types.DrawOp]
pub let size_choices : Array[String]
pub fn tile_color(String) -> @types.Color
pub fn toggle_pin(Array[String], String) -> Array[String]
// Errors
// Types and methods
#derive(Eq, @debug.Debug)
pub(all) struct ConfigEntry {
key : String
label : String
choices : Array[String]
value : String
}
#derive(Eq, @debug.Debug)
pub(all) enum DockAction {
Nothing
Launch(String)
Focus(UInt64)
}
pub(all) struct DockConfig {
mut pinned : Array[String]?
mut size : String
mut magnify : Bool
mut running : Bool
}
pub fn DockConfig::from_pairs(Array[(String, String)]) -> Self
pub fn DockConfig::items(Self) -> Array[ConfigEntry]
pub fn DockConfig::new() -> Self
pub fn DockConfig::pins(Self, Array[@types.AppEntry]) -> Array[String]
pub fn DockConfig::set(Self, String, String) -> Bool
#derive(@debug.Debug)
pub(all) struct DockItem {
id : String
name : String
glyph : String
pinned : Bool
windows : Array[UInt64]
focused : Bool
}
pub(all) struct DockWindow {
id : UInt64
app_id : String
focused : Bool
}
// Type aliases
// Traits