CI / test (push) Failing after 30s
The panel had a task list and, beside it, a dock showing the same running
apps again. They are now one module, the dock, in the task list's place:
- Pinned apps, then running ones; an app with windows is a pill with its
window's title (or name and window count) while there is room, an icon
when the panel is crowded ("Show window titles" in Dock settings).
- Its right-click menu has the task list's window commands (Minimize /
Restore, Maximize) for a single window, or the app's windows by title.
- It stretches like the task list did; new panels get it instead of
tasks. A saved panel's "tasks" becomes the dock (one dock, where the
task list was); pins are the dock's own setting, so they carry over.
- An empty dock shows a "+ Add apps" tile that opens the Applications
menu, where right-clicking an app offers Open and Pin to dock (adding a
dock to the panel if there is none).
- Super+1 .. Super+9 open the dock's first nine apps like a click
(shortcut "dock-apps", rebindable in Settings > Shortcuts).
- "New window" / "Open" only for apps the catalog can start.
The tasks component, lib/panel's pill geometry and the taskbar-widget
world are gone.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DPL5hiPCFHRxaJQvwex6ry
93 lines
2.6 KiB
MoonBit
93 lines
2.6 KiB
MoonBit
///| Implementation of `chandra:desktop/plasmoid` for the dock, the panel's task manager: pinned
|
|
/// apps, then running ones, with their theme icons, a dot per open window and (room allowing)
|
|
/// their window titles. A click starts the app or brings its windows
|
|
/// forward. Layout, hit-testing and drawing live in lib/dock (the shell uses the same code for the
|
|
/// hover label and the per-app right-click menu); this adapts host capabilities.
|
|
|
|
///| Item under the pointer, or -1.
|
|
let hover : Ref[Int] = Ref::new(-1)
|
|
|
|
///| Size of the widget at its last render (events carry no size).
|
|
let width : Ref[Int] = Ref::new(200)
|
|
|
|
///|
|
|
let height : Ref[Int] = Ref::new(34)
|
|
|
|
///| The windows as the dock sees them: `all` has the app ids, `list-windows` (by the low 32 bits
|
|
/// of the id) which are minimized.
|
|
fn dock_windows() -> Array[@logic.DockWindow] {
|
|
let mini : Map[UInt, Bool] = Map([])
|
|
for w in @windows.list_windows() {
|
|
if w.minimized != 0U {
|
|
mini.set(w.id, true)
|
|
}
|
|
}
|
|
@windows.all().map(d => {
|
|
id: d.id,
|
|
app_id: d.app_id,
|
|
focused: d.focused,
|
|
title: d.title,
|
|
minimized: mini.contains((d.id & 0xFFFFFFFFUL).to_uint()),
|
|
})
|
|
}
|
|
|
|
///| The window with keyboard focus, if any.
|
|
fn focused_window() -> UInt64? {
|
|
for d in @windows.all() {
|
|
if d.focused {
|
|
return Some(d.id)
|
|
}
|
|
}
|
|
None
|
|
}
|
|
|
|
///|
|
|
fn current_items() -> Array[@logic.DockItem] {
|
|
@logic.items(@logic.config, @app_catalog.list_apps(), dock_windows())
|
|
}
|
|
|
|
///|
|
|
pub fn info() -> PlasmoidInfo {
|
|
{
|
|
id: "org.chandra.dock",
|
|
name: "Dock",
|
|
// The shell works out the real width from the items as they change.
|
|
preferred: { w: @logic.preferred_width(current_items(), @logic.config, 34).reinterpret_as_uint(), h: 34U },
|
|
min_width: 60,
|
|
// The panel's task list: it takes the free room, and what follows packs right.
|
|
stretch: true,
|
|
}
|
|
}
|
|
|
|
///|
|
|
pub fn render(size : @types.Size) -> Array[@types.DrawOp] {
|
|
width.val = size.w.reinterpret_as_int()
|
|
height.val = size.h.reinterpret_as_int()
|
|
@logic.render(size, @theme.get_tokens(), @logic.config, current_items(), hover.val, @icons.app_icon)
|
|
}
|
|
|
|
///| The dock has no popup: the shell draws its hover label and right-click menu.
|
|
pub fn popup() -> PopupSurface? {
|
|
None
|
|
}
|
|
|
|
///|
|
|
pub fn on_event(_target : Surface, event : @types.InputEvent) -> Bool {
|
|
let (h, redraw, action) = @logic.handle(
|
|
current_items(),
|
|
@logic.config,
|
|
hover.val,
|
|
width.val,
|
|
height.val,
|
|
focused_window(),
|
|
event,
|
|
)
|
|
hover.val = h
|
|
match action {
|
|
Launch(id) => ignore(@app_launch.launch(id))
|
|
Focus(win) => @windows.focus(win)
|
|
Nothing => ()
|
|
}
|
|
redraw
|
|
}
|