summaryrefslogtreecommitdiff
path: root/utils/system.ts
diff options
context:
space:
mode:
author2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-01-12 18:00:54 +1100
committer2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-01-12 18:00:54 +1100
commitb4aca729ddae0526b66822698db7066cb09e1682 (patch)
tree2a406cca4cfc616dd22ce7c1be61cc20d5db85bc /utils/system.ts
parentInitial commit (diff)
downloadcaelestia-shell-b4aca729ddae0526b66822698db7066cb09e1682.tar.gz
caelestia-shell-b4aca729ddae0526b66822698db7066cb09e1682.tar.bz2
caelestia-shell-b4aca729ddae0526b66822698db7066cb09e1682.zip
bar
Diffstat (limited to 'utils/system.ts')
-rw-r--r--utils/system.ts21
1 files changed, 21 insertions, 0 deletions
diff --git a/utils/system.ts b/utils/system.ts
new file mode 100644
index 0000000..9a328d5
--- /dev/null
+++ b/utils/system.ts
@@ -0,0 +1,21 @@
+import { exec, GLib } from "astal";
+import { osIcons } from "./icons";
+
+export const inPath = (bin: string) => {
+ try {
+ exec(`which ${bin}`);
+ } catch {
+ return false;
+ }
+ return true;
+};
+
+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;
+ })()
+);