@@ -44,7 +44,7 @@ class BreakScreen:
44
44
def __init__ (self , context , on_skipped , on_postponed , style_sheet_path ):
45
45
self .context = context
46
46
self .count_labels = []
47
- self .display = Display ()
47
+ self .display = None
48
48
self .enable_postpone = False
49
49
self .enable_shortcut = False
50
50
self .is_pretified = False
@@ -56,6 +56,9 @@ def __init__(self, context, on_skipped, on_postponed, style_sheet_path):
56
56
self .strict_break = False
57
57
self .windows = []
58
58
59
+ if not self .context ['is_wayland' ]:
60
+ self .display = Display ()
61
+
59
62
# Initialize the theme
60
63
css_provider = Gtk .CssProvider ()
61
64
css_provider .load_from_path (style_sheet_path )
@@ -131,7 +134,8 @@ def close(self):
131
134
Hide the break screen from active window and destroy all other windows
132
135
"""
133
136
logging .info ("Close the break screen(s)" )
134
- self .__release_keyboard ()
137
+ if not self .context ['is_wayland' ]:
138
+ self .__release_keyboard ()
135
139
136
140
# Destroy other windows if exists
137
141
GLib .idle_add (lambda : self .__destroy_all_screens ())
@@ -149,7 +153,11 @@ def __show_break_screen(self, message, image_path, widget, tray_actions):
149
153
Show an empty break screen on all screens.
150
154
"""
151
155
# 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." )
153
161
154
162
display = Gdk .Display .get_default ()
155
163
screen = display .get_default_screen ()
@@ -243,7 +251,7 @@ def __update_count_down(self, count):
243
251
244
252
def __lock_keyboard (self ):
245
253
"""
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)
247
255
"""
248
256
logging .info ("Lock the keyboard" )
249
257
self .lock_keyboard = True
0 commit comments