🔧 chore(scripts): migrate util scripts to gtk4 and ags v3

This commit is contained in:
retrozinndev
2025-06-30 17:55:28 -03:00
parent 29f5c04c31
commit 33e6ee2490
16 changed files with 242 additions and 216 deletions
+13 -1
View File
@@ -1,8 +1,14 @@
import { exec, execAsync, Gio, GLib } from "astal";
import { createPoll } from "ags/time";
import { exec, execAsync } from "ags/process";
import GLib from "gi://GLib?version=2.0";
import Gio from "gi://Gio?version=2.0";
export const decoder = new TextDecoder("utf-8"),
encoder = new TextEncoder();
export const time = createPoll(GLib.DateTime.new_now_local(), 500, () =>
GLib.DateTime.new_now_local());
export function getHyprlandInstanceSig(): (string|null) {
return GLib.getenv("HYPRLAND_INSTANCE_SIGNATURE");
}
@@ -11,6 +17,12 @@ export function getHyprlandVersion(): string {
return exec(`${GLib.getenv("HYPRLAND_CMD") || "Hyprland"} --version | head -n1`).split(" ")[1];
}
export function omitObjectKeys<ObjT = object>(obj: ObjT, keys: keyof ObjT|Array<keyof ObjT>): ObjT {
for(const objKey of Object.keys(obj)) {
for(const omitKey of keys) {}
}
}
export function makeDirectory(dir: string): void {
execAsync([ "mkdir", "-p", dir ]);
}