You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Fired on a background thread — marshal to your UI thread before touching UI.
475
+
switch (taskId)
476
+
{
477
+
case"new-doc": CreateDocument(); break;
478
+
case"open-last": OpenLastFile(); break;
479
+
case"settings": ShowSettings(); break;
480
+
}
481
+
}
482
+
}
483
+
```
484
+
485
+
If the app was launched cold by a jump-list click (no primary instance was running), the
486
+
activation is captured and replayed to the handler once one is set.
487
+
488
+
### JumpListTask
489
+
490
+
```csharp
491
+
newJumpListTask(
492
+
id: "open-last", // stable id passed back to OnTaskActivated (no whitespace)
493
+
title: "Open Last File", // label shown in the menu
494
+
description: "Reopen the most recent file", // tooltip (Windows); optional
495
+
iconPath: @"C:\Apps\MyApp\recent.ico", // optional; defaults to the host exe icon
496
+
iconIndex: 0); // icon index within iconPath (Windows)
497
+
```
498
+
499
+
### Managing tasks
500
+
501
+
```csharp
502
+
jumpList.SetTasks(tasks); // replace the current task set (empty sequence == ClearTasks)
503
+
jumpList.ClearTasks(); // remove all tasks registered by this app
504
+
jumpList.SetHandler(null); // detach the handler
505
+
```
506
+
507
+
### Options
508
+
509
+
| Option | Purpose |
510
+
|--------|---------|
511
+
|`AppName`| Human-readable name; used if a minimal Linux `.desktop` file must be created. |
512
+
|`AppUserModelId`| Windows — must match the AUMI used for notifications so the list attaches to the right taskbar button. |
513
+
|`DesktopFileId`| Linux — the app's `.desktop` file id (with or without the `.desktop` suffix). Defaults to the process name. |
514
+
|`ExecutablePath`| Windows/Linux — absolute path to relaunch on click. When null, the current process executable is used; pass an explicit path for framework-dependent `dotnet` apps where the auto-detected path may be the shared host. Ignored on macOS. |
515
+
516
+
### IJumpListService interface
517
+
518
+
```csharp
519
+
publicinterfaceIJumpListService : IDisposable
520
+
{
521
+
// False if jump lists are unavailable on this platform; all methods become no-ops.
522
+
boolIsSupported { get; }
523
+
524
+
// Registers the handler for OnTaskActivated events (also starts the listener).
525
+
voidSetHandler(IJumpListHandler? handler);
526
+
527
+
// Replaces the application's jump-list tasks (empty sequence clears them).
528
+
voidSetTasks(IEnumerable<JumpListTask> tasks);
529
+
530
+
// Removes all tasks registered by this application.
531
+
voidClearTasks();
532
+
533
+
// Call once at the start of Main. Returns true if the launch was a forwarded
534
+
// activation and the caller should exit immediately.
535
+
boolTryHandleActivation(string[] args);
536
+
}
537
+
```
538
+
539
+
---
540
+
279
541
## Platform notes
280
542
281
543
### Windows
@@ -290,6 +552,14 @@ cleanup on macOS).
290
552
published alongside the executable.
291
553
- Toast callbacks are delivered on a WinRT thread-pool thread, not the STA thread. The
292
554
library handles this internally.
555
+
- Jump lists use the shell `ICustomDestinationList` "user tasks" API (Windows 7+) — pure
556
+
managed COM interop, no native DLL required. The jump list attaches to the taskbar button
557
+
matching `AppUserModelId`, so it must be the same id used for notifications. The COM work
558
+
runs on a dedicated STA thread the library creates lazily on first use.
559
+
- Taskbar progress uses `ITaskbarList3` and needs a top-level window handle. It defaults to
560
+
the console window (`GetConsoleWindow()`); call `SetWindow` with your WPF/WinForms main
561
+
window HWND to move the bar onto that taskbar button. The COM work runs on its own lazily
562
+
created STA thread.
293
563
294
564
### Linux
295
565
@@ -314,6 +584,18 @@ is present.
314
584
Image support via `gdk-pixbuf` requires `libgdk-pixbuf-2.0` to be installed, which is
315
585
typically included as a dependency of `libnotify4`.
316
586
587
+
Taskbar progress uses the Unity LauncherEntry D-Bus API, honoured by KDE Plasma, Unity,
588
+
Dash-to-Dock, Plank and Latte. It requires the app to ship (or have created) a `.desktop`
589
+
file whose id is supplied via `DesktopFileId`; the launcher matches the entry by that id.
590
+
Desktop environments without LauncherEntry support simply show no bar.
591
+
592
+
Jump lists are written as `Actions` into the application's `.desktop` file. If no installed
593
+
`.desktop` file is found for `DesktopFileId`, a minimal one is created under
594
+
`$XDG_DATA_HOME/applications` (default `~/.local/share/applications`). Writing the file is
595
+
best-effort — a read-only or absent home directory will not crash the application. Each
596
+
action's `Exec` relaunches the executable with the activation argument, which the bundled
597
+
single-instance layer forwards to the running primary instance.
598
+
317
599
### macOS
318
600
319
601
- Requires macOS 10.14 (Mojave) or later.
@@ -335,6 +617,18 @@ typically included as a dependency of `libnotify4`.
335
617
`OnDismissed` callback is not fired after the user activates a notification or clicks
336
618
a button (unlike Windows, where WinToastLib always fires the dismissed event after any
337
619
interaction).
620
+
- Taskbar progress draws an `NSProgressIndicator` along the bottom of the **Dock tile**.
621
+
This is only visible for a regular bundled GUI application that owns a Dock tile and has a
622
+
running main loop; a bare console process has none, so the calls are harmless no-ops. The
623
+
Dock cannot tint the bar, so `Paused` and `Error` render the same as `Normal`.
624
+
- Jump-list tasks appear in the **Dock menu** (right-click / click-and-hold of the Dock
625
+
icon) and fire `OnTaskActivated` live in-process — there is no relaunch, so
626
+
`TryHandleActivation` always returns `false` on macOS. This is only effective for a
627
+
regular bundled GUI application with a running main loop; a bare console process has no
628
+
Dock menu and the calls are harmless no-ops. The wrapper supplies the menu via the
629
+
application delegate's `applicationDockMenu:`, installing its own delegate if the app has
630
+
none, or adding the method to the existing delegate without clobbering a Dock menu the app
0 commit comments