Dock and task manager are one module: titled window pills, pins, Super+1..9
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
This commit is contained in:
Claude committed 2026-11-26 00:08:05 +00:00
1 parent 42aa770452
commit 6253371cb3
28 files changed
+801 -1131

No files matched your search

+40 -51
View File
@@ -11,9 +11,10 @@
/// and opens that tab. A module may also export `module-config`: its own settings, listed under
/// "Module settings..." in its right-click menu and remembered in state.edn (module_config.mbt).
///| Modules loaded into a fresh panel, in order. `tasks` stretches, so what follows it packs right.
///| Modules loaded into a fresh panel, in order. The dock (pinned and running apps, the task
/// manager) stretches, so what follows it packs right.
let default_panel : Array[String] = [
"launcher", "inspector", "layout", "tasks", "moon-disc", "network", "clock-digital", "screenshot",
"launcher", "inspector", "layout", "dock", "moon-disc", "network", "clock-digital", "screenshot",
"session-settings",
]
@@ -47,9 +48,13 @@ test "a fresh panel gets the battery module only on a machine with a battery" {
/// - logout, the Log out button, is the Application Launcher's session row (Reload, Log out,
/// Suspend, Restart, Power off). A saved panel drops it, or gets the launcher in its place when
/// it had none (migrate_panel).
/// - tasks, the Task Manager's window pills, is the dock: pinned and running apps, titled pills
/// when there is room, each window's menu. A saved panel with both keeps one dock, where the
/// task list was (migrate_panel); the dock's pins carry over (they are the dock's own setting).
let retired_modules : Map[String, String] = {
"clock-digital12": "clock-digital",
"logout": "launcher",
"tasks": "dock",
}
///| The id a module goes by now ("clock-digital12" -> "clock-digital").
@@ -105,7 +110,7 @@ fn stem(path : String) -> String {
}
}
///| The WIT world ("clock-widget", "taskbar-widget", ...) a module was built for, read from the
///| The WIT world ("clock-widget", "dock-widget", ...) a module was built for, read from the
/// `<name>.meta.json` that build-modules.sh writes next to it; "" when unknown (a module loaded
/// from elsewhere). Two modules are interchangeable only when their worlds match.
fn module_world(path : String) -> String {
@@ -222,12 +227,21 @@ fn wall_secs() -> Int {
/// module list "wallpaper" or "module-manager": the settings module takes the first one's place
/// (a panel that already has it just drops them). The Log out button moved into the launcher the
/// same way: "logout" becomes the launcher when the panel has none, else it is dropped. Other
/// retired modules (clock-digital12) become the module that replaced them.
/// retired modules (clock-digital12) become the module that replaced them; the task list and the
/// dock become one dock, in the task list's place.
fn migrate_panel(entries : Array[String]) -> Array[String] {
let has_settings = entries.contains("session-settings")
let has_launcher = entries.contains("launcher")
// One dock, where the task list was when there was one (it sat in the stretching place).
let dock_at = match entries.search("tasks") {
Some(i) => i
None => entries.search("dock").unwrap_or(-1)
}
let out : Array[String] = []
for e in entries {
for i, e in entries {
if (e == "tasks" || e == "dock") && i != dock_at {
continue
}
if e == "wallpaper" || e == "module-manager" {
if !has_settings && !out.contains("session-settings") {
out.push("session-settings")
@@ -251,9 +265,17 @@ test "a saved panel's wallpaper button becomes the settings module" {
assert_eq(migrate_panel(["clock"]), ["clock"])
}
///|
test "a saved panel's task list and dock become one dock, in the task list's place" {
assert_eq(migrate_panel(["launcher", "tasks", "clock-digital", "dock"]), ["launcher", "dock", "clock-digital"])
assert_eq(migrate_panel(["dock", "launcher", "tasks"]), ["launcher", "dock"])
assert_eq(migrate_panel(["launcher", "dock", "clock-digital"]), ["launcher", "dock", "clock-digital"])
assert_eq(current_module_id("tasks"), "dock")
}
///|
test "a saved panel's 12-hour clock becomes the digital clock" {
assert_eq(migrate_panel(["tasks", "clock-digital12", "logout"]), ["tasks", "clock-digital", "launcher"])
assert_eq(migrate_panel(["tasks", "clock-digital12", "logout"]), ["dock", "clock-digital", "launcher"])
assert_eq(current_module_id("clock-digital12"), "clock-digital")
assert_eq(current_module_id("clock-binary"), "clock-binary")
}
@@ -262,10 +284,10 @@ test "a saved panel's 12-hour clock becomes the digital clock" {
test "a saved panel's Log out button folds into the launcher" {
// The launcher's session row has Log out now: the old button is dropped...
assert_eq(migrate_panel(["launcher", "tasks", "session-settings", "logout"]), [
"launcher", "tasks", "session-settings",
"launcher", "dock", "session-settings",
])
// ...or becomes the launcher on a panel without one, so Log out stays reachable.
assert_eq(migrate_panel(["tasks", "logout"]), ["tasks", "launcher"])
assert_eq(migrate_panel(["tasks", "logout"]), ["dock", "launcher"])
assert_eq(migrate_panel(["logout", "launcher"]), ["launcher"])
assert_false(default_panel.contains("logout"))
}
@@ -945,8 +967,8 @@ let menu_w : Int = 250
///| Most "Replace with" rows listed.
let max_replace_rows : Int = 8
///| Right-click: on a window's pill in the task manager that window's menu (Minimize or Restore,
/// Maximize, Quit); on a module its menu (Module settings, System settings, replace, remove); on
///| Right-click: on an app in the open Applications menu its Open / Pin to dock menu; on an app in
/// the dock its menu (dock.mbt); on a module its menu (Module settings, System settings, replace, remove); on
/// empty panel space System settings (whose Panel tab adds modules). True when consumed.
pub fn DesktopShell::right_click(self : DesktopShell, x : Int, y : Int) -> Bool {
self.ensure_booted()
@@ -955,12 +977,16 @@ pub fn DesktopShell::right_click(self : DesktopShell, x : Int, y : Int) -> Bool
}
let was_open = self.menu_open
self.menu_open = false
// An app in the open Applications menu: Open, Pin to dock. The menu stays open behind it.
match self.launcher_app_at(x, y) {
Some(app) => {
self.open_app_menu(app, x)
return true
}
None => ()
}
self.dismiss_popups("")
match self.widget_at(x, y) {
Some(w) if self.task_at(w, x, y) is Some(win) => {
self.open_window_menu(win, x)
true
}
Some(w) if self.dock_item_at(w, x, y) is Some((items, i)) => {
self.open_dock_menu(w, items, i, x)
true
@@ -1002,43 +1028,6 @@ pub fn DesktopShell::right_click(self : DesktopShell, x : Int, y : Int) -> Bool
}
}
///| The task manager module's id: its pills are hit-tested here (lib/panel/tasks.mbt) so a
/// right-click on one opens that window's menu.
let tasks_module_id : String = "org.chandra.tasks"
///| The window whose task-bar pill is under (x, y) when `w` is the task manager. The pills are
/// the windows in opening order (by id, as the module sorts them).
fn DesktopShell::task_at(self : DesktopShell, w : Widget, x : Int, y : Int) -> WinInfo? {
if w.pl.id != tasks_module_id || !inside(w.rect, x, y) {
return None
}
// The module sorts by the 32-bit id it is handed through `windows.list-windows`.
let key = (win : WinInfo) => win.id.to_int().reinterpret_as_uint()
let wins = self.windows.copy()
wins.sort_by((a, b) => key(a).compare(key(b)))
let i = @panel.task_pill_at(x - w.rect.x, wins.length(), w.rect.w)
if i >= 0 {
Some(wins[i])
} else {
None
}
}
///| The window menu of a task-bar pill, titled with the window's title.
fn DesktopShell::open_window_menu(self : DesktopShell, win : WinInfo, x : Int) -> Unit {
let rows = [
if win.minimized {
window_row("Restore", win.id, Restore)
} else {
window_row("Minimize", win.id, Minimize)
},
window_row(if win.maximized { "Restore size" } else { "Maximize" }, win.id, ToggleMaximize),
window_row("Quit", win.id, Close),
]
let title = if win.title.length() > 0 { win.title } else { "Window" }
self.open_menu(title, rows, "", x)
}
///| The module's own settings as menu rows: an on/off setting is one row, ticked when on; a
/// setting with choices is a heading and one row per choice, the current one ticked.
fn config_rows(items : Array[@wasm.ConfigItem]) -> Array[MenuRow] {