diff options
| author | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-01-16 16:35:37 +1100 |
|---|---|---|
| committer | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-01-16 16:35:37 +1100 |
| commit | 02fd2e97f2c8a53bf2344e6fa8b14769cb15ee38 (patch) | |
| tree | 5e2a56becf6ba6961995e541ce9688224f704773 /src/utils/system.ts | |
| parent | popupwindow: switch to class (diff) | |
| download | caelestia-shell-02fd2e97f2c8a53bf2344e6fa8b14769cb15ee38.tar.gz caelestia-shell-02fd2e97f2c8a53bf2344e6fa8b14769cb15ee38.tar.bz2 caelestia-shell-02fd2e97f2c8a53bf2344e6fa8b14769cb15ee38.zip | |
refactor: move ts to src
Also move popupwindow to own file
Diffstat (limited to 'src/utils/system.ts')
| -rw-r--r-- | src/utils/system.ts | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/utils/system.ts b/src/utils/system.ts new file mode 100644 index 0000000..5d77908 --- /dev/null +++ b/src/utils/system.ts @@ -0,0 +1,21 @@ +import { execAsync, GLib } from "astal"; +import type AstalApps from "gi://AstalApps"; +import { osIcons } from "./icons"; + +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( + (() => { + if (osIcons.hasOwnProperty(osId)) return osIcons[osId]; + if (osIdLike) for (const id of osIdLike.split(" ")) if (osIcons.hasOwnProperty(id)) return osIcons[id]; + return 0xf31a; + })() +); |