From e923d39cdeed4b42e747afc01b3420d6d89af6e6 Mon Sep 17 00:00:00 2001 From: 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> Date: Tue, 14 Jan 2025 00:22:59 +1100 Subject: app launcher --- utils/system.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'utils/system.ts') 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( -- cgit v1.2.3-freya