summaryrefslogtreecommitdiff
path: root/lib/astal/gtk3
diff options
context:
space:
mode:
authorAylur <[email protected]>2025-01-23 17:58:23 +0100
committerAylur <[email protected]>2025-01-23 17:58:23 +0100
commit9a83bcd2bd33ee95a69069d07c56bedec05c7d02 (patch)
treede0b0aba8f6d689d0a04dc3cb6230f22470b8284 /lib/astal/gtk3
parent907230e479ba6c9489463797f81c7348ed754302 (diff)
feat: monitor get_current_monitor
Diffstat (limited to 'lib/astal/gtk3')
-rw-r--r--lib/astal/gtk3/src/widget/window.vala9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/astal/gtk3/src/widget/window.vala b/lib/astal/gtk3/src/widget/window.vala
index 11d542d..a066806 100644
--- a/lib/astal/gtk3/src/widget/window.vala
+++ b/lib/astal/gtk3/src/widget/window.vala
@@ -50,6 +50,13 @@ public class Astal.Window : Gtk.Window {
private InhibitManager? inhibit_manager;
private Inhibitor? inhibitor;
+ /**
+ * Get the current [[email protected]] this window resides in.
+ */
+ public Gdk.Monitor get_current_monitor() {
+ return Gdk.Display.get_default().get_monitor_at_window(base.get_window());
+ }
+
private bool check(string action) {
if (!is_supported()) {
critical(@"can not $action on window: layer shell not supported");
@@ -63,7 +70,7 @@ public class Astal.Window : Gtk.Window {
}
construct {
- // If the window has no size allocatoted when it gets mapped.
+ // If the window has no size allocatoted when it gets mapped
// It won't show up later either when it size changes by adding children.
height_request = 1;
width_request = 1;