nosignal-shell/utils/system.ts
2 * r + 2 * t b4aca729dd bar
2025-01-12 18:00:54 +11:00

21 lines
594 B
TypeScript

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;
})()
);