summaryrefslogtreecommitdiff
path: root/utils/system.ts
diff options
context:
space:
mode:
Diffstat (limited to 'utils/system.ts')
-rw-r--r--utils/system.ts11
1 files changed, 10 insertions, 1 deletions
diff --git a/utils/system.ts b/utils/system.ts
index 9a328d5..99e9d7c 100644
--- a/utils/system.ts
+++ b/utils/system.ts
@@ -1,4 +1,5 @@
-import { exec, GLib } from "astal";
+import { exec, execAsync, GLib } from "astal";
+import type AstalApps from "gi://AstalApps";
import { osIcons } from "./icons";
export const inPath = (bin: string) => {
@@ -10,6 +11,14 @@ export const inPath = (bin: string) => {
return true;
};
+export const launch = (app: AstalApps.Application) => {
+ execAsync(["uwsm", "app", "--", app.entry]).catch(() => {
+ app.frequency--; // Decrement frequency cause launch also increments it
+ app.launch();
+ });
+ app.frequency++;
+};
+
export const osId = GLib.get_os_info("ID") ?? "unknown";
export const osIdLike = GLib.get_os_info("ID_LIKE");
export const osIcon = String.fromCodePoint(