🔧 chore(scripts): migrate util scripts to gtk4 and ags v3
This commit is contained in:
+13
-1
@@ -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 ]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user