Commit b4ed072f01d2
tarball1 file changed+19-8
@@ -2,6 +2,8 @@
22
//! when the user went away and video players can keep the screen on.33
44
use crate::state::State;5
+use crate::wm::Kind;6
+use monolith_config::IdleInhibit;57
use smithay::reexports::calloop::LoopHandle;68
use smithay::reexports::wayland_server::protocol::wl_surface::WlSurface;79
use smithay::reexports::wayland_server::{DisplayHandle, Resource};@@ -54,17 +56,26 @@ pub fn root_surface(surface: &WlSurface) -> WlSurface {
5456
5557
impl State {5658
/// An inhibitor only counts while its surface is on screen, as the57
- /// protocol asks, so a video on a hidden tag lets the screen blank.59
+ /// protocol asks, so a video on a hidden tag lets the screen blank. Rules60
+ /// can make windows inhibit without asking.5861
pub fn update_inhibit(&mut self) {5962
self.services.idle.inhibitors.retain(|s| s.is_alive());60
- let shown = self.services.idle.inhibitors.iter().any(|s| {61
- let root = root_surface(s);62
- self.wm63
- .space64
- .elements()65
- .any(|w| crate::wm::root(w).as_ref() == Some(&root))66
- || self.layer_maps_contain(&root)63
+ let ruled = self.wm.iter().any(|(_, s)| {64
+ matches!(65
+ (s.rule.idle_inhibit, s.placed),66
+ (Some(IdleInhibit::Visible), Some(_))67
+ | (Some(IdleInhibit::Fullscreen), Some((Kind::Fullscreen, ..)))68
+ )6769
});70
+ let shown = ruled71
+ || self.services.idle.inhibitors.iter().any(|s| {72
+ let root = root_surface(s);73
+ self.wm74
+ .space75
+ .elements()76
+ .any(|w| crate::wm::root(w).as_ref() == Some(&root))77
+ || self.layer_maps_contain(&root)78
+ });6879
if shown != self.services.idle.inhibited {6980
self.services.idle.inhibited = shown;7081
if !shown {