diff --git a/src/lib/utils.ts b/src/lib/utils.ts index 902d2b2..e49b2d5 100644 --- a/src/lib/utils.ts +++ b/src/lib/utils.ts @@ -11,6 +11,9 @@ import options from '../options'; import { Astal, Gdk, Gtk } from 'astal/gtk3'; import AstalApps from 'gi://AstalApps?version=0.1'; import { exec, execAsync } from 'astal/process'; +import AstalNotifd from 'gi://AstalNotifd?version=0.1'; + +const notifdService = AstalNotifd.get_default(); /** * Handles errors by throwing a new Error with a message. @@ -270,6 +273,12 @@ export function normalizePath(path: string): string { * @param notifPayload The notification arguments containing summary, body, appName, iconName, urgency, timeout, category, transient, and id. */ export function Notify(notifPayload: NotificationArgs): void { + // This line does nothing useful at runtime, but when bundling, it + // ensures that notifdService has been instantiated and, as such, + // that the notification daemon is active and the notification + // will be handled + notifdService; // eslint-disable-line @typescript-eslint/no-unused-expressions + let command = 'notify-send'; command += ` "${notifPayload.summary} "`; if (notifPayload.body) command += ` "${notifPayload.body}" `;