diff options
| author | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-01-25 18:46:48 +1100 |
|---|---|---|
| committer | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-01-25 18:46:48 +1100 |
| commit | b7fa29274af67df9f8d4fb9165bf54946b1d53ae (patch) | |
| tree | 56a9d70ea03862fda8fb1cc9c040f0cf112d551d /src/utils | |
| parent | media: make popdown window (diff) | |
| download | caelestia-shell-b7fa29274af67df9f8d4fb9165bf54946b1d53ae.tar.gz caelestia-shell-b7fa29274af67df9f8d4fb9165bf54946b1d53ae.tar.bz2 caelestia-shell-b7fa29274af67df9f8d4fb9165bf54946b1d53ae.zip | |
launcher: todo subcommand
Uses todoist
Diffstat (limited to 'src/utils')
| -rw-r--r-- | src/utils/system.ts | 22 |
1 files changed, 22 insertions, 0 deletions
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<string, () => 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( |