17 lines
575 B
TypeScript
17 lines
575 B
TypeScript
import { Gdk } from "astal/gtk3";
|
|
import Hyprland from "gi://AstalHyprland";
|
|
|
|
export const range = (length: number, start = 1) => {
|
|
return Array.from({ length }, (n, i) => i + start);
|
|
};
|
|
|
|
export const getHyprlandMonitor = (gdkmonitor: Gdk.Monitor) => {
|
|
const hyprland = Hyprland.get_default()
|
|
const display = Gdk.Display.get_default()!;
|
|
const screen = display.get_default_screen();
|
|
for (let i = 0; i < display.get_n_monitors(); ++i) {
|
|
if (gdkmonitor === display.get_monitor(i))
|
|
return hyprland.get_monitor_by_name(screen.get_monitor_plug_name(i)!);
|
|
}
|
|
}
|