diff options
author | kotontrion <[email protected]> | 2024-09-24 10:47:14 +0200 |
---|---|---|
committer | kotontrion <[email protected]> | 2024-09-24 10:47:14 +0200 |
commit | 122112c320e62e52b3f0acc5d03c445c44bd8c4c (patch) | |
tree | 5fd80f779b938e767595f5ad37ecf87e7799a717 /core/src/widget/window.vala | |
parent | ba7d92df104f374a3796c0c95f3a9cda04976f6a (diff) |
core: add window inhibit property
Diffstat (limited to 'core/src/widget/window.vala')
-rw-r--r-- | core/src/widget/window.vala | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/core/src/widget/window.vala b/core/src/widget/window.vala index 17dc76d..73a4f5d 100644 --- a/core/src/widget/window.vala +++ b/core/src/widget/window.vala @@ -38,6 +38,9 @@ public class Window : Gtk.Window { return false; } + private InhibitManager? inhibit_manager; + private Inhibitor? inhibitor; + construct { if (check("initialize layer shell")) return; @@ -45,6 +48,24 @@ public class Window : Gtk.Window { height_request = 1; width_request = 1; init_for_window(this); + inhibit_manager = InhibitManager.get_default(); + } + + public bool inhibit { + set { + if(inhibit_manager == null) { + return; + } + if(value && inhibitor == null) { + inhibitor = inhibit_manager.inhibit(this); + } + else if(!value && inhibitor != null){ + inhibitor = null; + } + } + get { + return inhibitor != null; + } } public string namespace { |