Dock (macOS)

macOS-only. The dock namespace controls the app icon in the Dock: whether it's visible, what image it shows, and when the user clicks/activates it (relevant when all windows are hidden).

No-op on Windows and Linux. Safe to call — the promises resolve with success: false on other platforms rather than throwing, so you can keep the same code path.

Show / hide

Useful for menu-bar-only apps that spend most of their life in the tray with no visible windows:

await window.deskifier.dock.hide();     // remove from the dock
await window.deskifier.dock.show();     // put it back
const { visible } = await window.deskifier.dock.isVisible();

Custom icon

Swap the dock icon at runtime — useful for showing state (e.g. "unread" badge, "recording" indicator):

await window.deskifier.dock.setIcon({ iconPath: '/absolute/path/to/icon.png' });

Reactivation

macOS fires an "activate" event when the user clicks the dock icon while the app is already running. Deskifier surfaces it here so you can decide what to do — commonly: show the main window if all are hidden.

window.deskifier.dock.onAppActivated(({ hasVisibleWindows }) => {
  if (!hasVisibleWindows) {
    // reopen the main window
  }
});

Visibility changes

Fires whenever the dock icon is shown or hidden — useful for keeping UI state (a "hide from dock" toggle in your settings, an in-app tray affordance) in sync with whatever caused the change (your own show/hide calls, or the app's built-in behavior when it enters a menu-bar-only mode).

window.deskifier.dock.onVisibilityChanged(({ visible }) => {
  console.log('Dock icon is now', visible ? 'visible' : 'hidden');
});