File 0004-add_getGdkMonitor_to_hyprland_service.patch of Package aylurs-gtk-shell
From 0da9dcbf7ff0d8f2f17f6980e97874c60de3695d Mon Sep 17 00:00:00 2001
From: shezdy <77217897+shezdy@users.noreply.github.com>
Date: Thu, 20 Jun 2024 16:08:03 -0600
Subject: [PATCH] add getGdkMonitor to hyprland service (#400)
---
src/service/hyprland.ts | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/src/service/hyprland.ts b/src/service/hyprland.ts
index fe6e2209..8dde935c 100644
--- a/src/service/hyprland.ts
+++ b/src/service/hyprland.ts
@@ -1,3 +1,4 @@
+import Gdk from 'gi://Gdk?version=3.0';
import GLib from 'gi://GLib';
import Gio from 'gi://Gio';
import Service from '../service.js';
@@ -112,6 +113,14 @@ export class Hyprland extends Service {
readonly getWorkspace = (id: number) => this._workspaces.get(id);
readonly getClient = (address: string) => this._clients.get(address);
+ readonly getGdkMonitor = (id: number) => {
+ const monitor = this._monitors.get(id);
+ if (!monitor)
+ return null;
+
+ return Gdk.Display.get_default()?.get_monitor_at_point(monitor.x, monitor.y) || null;
+ };
+
constructor() {
if (!HIS)
console.error('Hyprland is not running');