From b7fa29274af67df9f8d4fb9165bf54946b1d53ae Mon Sep 17 00:00:00 2001 From: 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> Date: Sat, 25 Jan 2025 18:46:48 +1100 Subject: launcher: todo subcommand Uses todoist --- src/utils/system.ts | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'src/utils/system.ts') diff --git a/src/utils/system.ts b/src/utils/system.ts index 5d77908..1c5f011 100644 --- a/src/utils/system.ts +++ b/src/utils/system.ts @@ -10,6 +10,28 @@ export const launch = (app: AstalApps.Application) => { app.frequency++; }; +export const notify = (props: { + summary: string; + body?: string; + icon?: string; + urgency?: "low" | "normal" | "critical"; + transient?: boolean; + actions?: Record void>; +}) => + execAsync([ + "notify-send", + "-a", + "caelestia-shell", + ...(props.icon ? ["-i", props.icon] : []), + ...(props.urgency ? ["-u", props.urgency] : []), + ...(props.transient ? ["-e"] : []), + ...Object.keys(props.actions ?? {}).flatMap((k, i) => ["-A", `${i}=${k}`]), + props.summary, + ...(props.body ? [props.body] : []), + ]) + .then(action => props.actions && Object.values(props.actions)[parseInt(action, 10)]?.()) + .catch(console.error); + export const osId = GLib.get_os_info("ID") ?? "unknown"; export const osIdLike = GLib.get_os_info("ID_LIKE"); export const osIcon = String.fromCodePoint( -- cgit v1.2.3-freya