✨ ags(scripts/utils): add Hyprland-related util functions
This commit is contained in:
+15
-6
@@ -1,12 +1,21 @@
|
|||||||
import { execAsync, GLib } from "astal";
|
import { exec, execAsync, GLib } from "astal";
|
||||||
|
|
||||||
|
|
||||||
|
export function getHyprlandInstanceSig(): (string|null) {
|
||||||
|
return GLib.getenv("HYPRLAND_INSTANCE_SIGNATURE");
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getHyprlandVersion(): string {
|
||||||
|
return exec(`${GLib.getenv("HYPRLAND_CMD") || "Hyprland"} --version | head -n1`).split(" ")[1];
|
||||||
|
}
|
||||||
|
|
||||||
export function getUserDirs() {
|
export function getUserDirs() {
|
||||||
return {
|
return {
|
||||||
home: GLib.getenv("HOME"),
|
home: GLib.get_home_dir(),
|
||||||
state: GLib.getenv("XDG_STATE_HOME"),
|
state: GLib.get_user_state_dir(),
|
||||||
cache: GLib.getenv("XDG_CACHE_HOME"),
|
cache: GLib.get_user_cache_dir(),
|
||||||
config: GLib.getenv("XDG_CONFIG_HOME"),
|
config: GLib.get_user_config_dir(),
|
||||||
data: GLib.getenv("XDG_DATA_HOME")
|
data: GLib.get_user_data_dir()
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user