@@ -176,6 +176,32 @@ def is_idle_inhibited_gnome():
176176 return bool (result & 0b1000 )
177177
178178
179+ def is_idle_inhibited_kde () -> bool :
180+ """KDE Plasma doesn't work with wlrctl, and there is no way to enumerate
181+ fullscreen windows, but KDE does expose a non-standard Inhibited property on
182+ org.freedesktop.Notifications, which does communicate the Do Not Disturb status
183+ on KDE.
184+ This is also only an approximation, but comes pretty close.
185+ """
186+ dbus_proxy = Gio .DBusProxy .new_for_bus_sync (
187+ bus_type = Gio .BusType .SESSION ,
188+ flags = Gio .DBusProxyFlags .NONE ,
189+ info = None ,
190+ name = "org.freedesktop.Notifications" ,
191+ object_path = "/org/freedesktop/Notifications" ,
192+ interface_name = "org.freedesktop.Notifications" ,
193+ cancellable = None ,
194+ )
195+ prop = dbus_proxy .get_cached_property ("Inhibited" )
196+
197+ if prop is None :
198+ return False
199+
200+ result = prop .unpack ()
201+
202+ return result
203+
204+
179205def _window_class_matches (window_class : str , classes : list ) -> bool :
180206 return any (map (lambda w : w in classes , window_class .split ()))
181207
@@ -233,12 +259,18 @@ def __should_skip_break(pre_break: bool) -> bool:
233259 if utility .IS_WAYLAND :
234260 if utility .DESKTOP_ENVIRONMENT == "gnome" :
235261 skip_break = is_idle_inhibited_gnome ()
262+ elif utility .DESKTOP_ENVIRONMENT == "kde" :
263+ skip_break = is_idle_inhibited_kde ()
236264 else :
237265 skip_break = is_active_window_skipped_wayland (pre_break )
238266 else :
239267 skip_break = is_active_window_skipped_xorg (pre_break )
240268 if dnd_while_on_battery and not skip_break :
241269 skip_break = is_on_battery ()
270+
271+ if skip_break :
272+ logging .info ("Skipping break due to donotdisturb" )
273+
242274 return skip_break
243275
244276
0 commit comments