@@ -44,7 +44,7 @@ class BreakScreen:
4444 def __init__ (self , context , on_skipped , on_postponed , style_sheet_path ):
4545 self .context = context
4646 self .count_labels = []
47- self .display = Display ()
47+ self .display = None
4848 self .enable_postpone = False
4949 self .enable_shortcut = False
5050 self .is_pretified = False
@@ -56,6 +56,9 @@ def __init__(self, context, on_skipped, on_postponed, style_sheet_path):
5656 self .strict_break = False
5757 self .windows = []
5858
59+ if not self .context ['is_wayland' ]:
60+ self .display = Display ()
61+
5962 # Initialize the theme
6063 css_provider = Gtk .CssProvider ()
6164 css_provider .load_from_path (style_sheet_path )
@@ -131,7 +134,8 @@ def close(self):
131134 Hide the break screen from active window and destroy all other windows
132135 """
133136 logging .info ("Close the break screen(s)" )
134- self .__release_keyboard ()
137+ if not self .context ['is_wayland' ]:
138+ self .__release_keyboard ()
135139
136140 # Destroy other windows if exists
137141 GLib .idle_add (lambda : self .__destroy_all_screens ())
@@ -149,7 +153,11 @@ def __show_break_screen(self, message, image_path, widget, tray_actions):
149153 Show an empty break screen on all screens.
150154 """
151155 # Lock the keyboard
152- utility .start_thread (self .__lock_keyboard )
156+ if not self .context ['is_wayland' ]:
157+ utility .start_thread (self .__lock_keyboard )
158+ else :
159+ # TODO: Wayland keyboard locking
160+ logging .warning ("Keyboard locking not yet implemented for Wayland." )
153161
154162 display = Gdk .Display .get_default ()
155163 screen = display .get_default_screen ()
@@ -243,7 +251,7 @@ def __update_count_down(self, count):
243251
244252 def __lock_keyboard (self ):
245253 """
246- Lock the keyboard to prevent the user from using keyboard shortcuts
254+ Lock the keyboard to prevent the user from using keyboard shortcuts (X11 only)
247255 """
248256 logging .info ("Lock the keyboard" )
249257 self .lock_keyboard = True
0 commit comments