summaryrefslogtreecommitdiff
path: root/src/utils/system.ts
diff options
context:
space:
mode:
author2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-01-25 18:46:48 +1100
committer2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-01-25 18:46:48 +1100
commitb7fa29274af67df9f8d4fb9165bf54946b1d53ae (patch)
tree56a9d70ea03862fda8fb1cc9c040f0cf112d551d /src/utils/system.ts
parentmedia: make popdown window (diff)
downloadcaelestia-shell-b7fa29274af67df9f8d4fb9165bf54946b1d53ae.tar.gz
caelestia-shell-b7fa29274af67df9f8d4fb9165bf54946b1d53ae.tar.bz2
caelestia-shell-b7fa29274af67df9f8d4fb9165bf54946b1d53ae.zip
launcher: todo subcommand
Uses todoist
Diffstat (limited to 'src/utils/system.ts')
-rw-r--r--src/utils/system.ts22
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(