SafeEyes
SafeEyes copied to clipboard
[WIP] Wayland improvements
The disadvantage of this PR is that the keyboard will not be blocked when Wayland is used.
The protocol for inhibiting the keyboard should be used as swaylock does, but it requires more work.
I should look more into pywayland for adding this feature.
No exceptions are raised so far, and the window get closed without problems. but I haven't understood the "Lock Screen" button so I am not sure if it works (probably not).
Hi, Sorry for the late response. Do you get errors when creating the Display object in Wayland?
Do you get errors when creating the Display object in Wayland?
sway is running on my machine and the Xorg layer (called xwayland) is not enabled. Therefore the Display object creations fails because it cannot find the X display name (since there isn't any):
Traceback (most recent call last):
File "/usr/bin/safeeyes", line 11, in <module>
load_entry_point('safeeyes==2.0.9', 'console_scripts', 'safeeyes')()
File "/usr/lib/python3.7/site-packages/safeeyes/__main__.py", line 141, in main
safeeyes = SafeEyes(system_locale, config)
File "/usr/lib/python3.7/site-packages/safeeyes/SafeEyes.py", line 84, in __init__
self.context, self.on_skipped, self.on_postponed, Utility.STYLE_SHEET_PATH)
File "/usr/lib/python3.7/site-packages/safeeyes/BreakScreen.py", line 47, in __init__
self.display = Display()
File "/usr/lib/python3.7/site-packages/Xlib/display.py", line 89, in __init__
self.display = _BaseDisplay(display)
File "/usr/lib/python3.7/site-packages/Xlib/display.py", line 71, in __init__
protocol_display.Display.__init__(self, *args, **keys)
File "/usr/lib/python3.7/site-packages/Xlib/protocol/display.py", line 60, in __init__
name, host, displayno, screenno = connect.get_display(display)
File "/usr/lib/python3.7/site-packages/Xlib/support/connect.py", line 72, in get_display
return mod.get_display(display)
File "/usr/lib/python3.7/site-packages/Xlib/support/unix_connect.py", line 61, in get_display
raise error.DisplayNameError(display)
Xlib.error.DisplayNameError: Bad display name ""
I see. Please let me know once the PR is completed.
Any progress on this?
This PR seems abandoned ? Any news ?
This PR seems abandoned ? Any news ?
Unfortunately I haven't had time to work on this. Please, feel free to pick-it up from where I have left it.
I've looked into pywayland, and as far as I can tell this is a dead-end (because you can't grab the wl_surface from Gtk to pass to pywayland), the real way to do this is to update to GTK/GDK4 and use their abstraction over the wayland protocol (which I assume should also work on X). https://docs.gtk.org/gdk4/method.Toplevel.inhibit_system_shortcuts.html (unless a similar API exists in GDK 3)
In my gtk4 port https://github.com/slgobinath/SafeEyes/pull/561, I address this by using inhibit_system_shortcuts on wayland.