SafeEyes icon indicating copy to clipboard operation
SafeEyes copied to clipboard

[WIP] Wayland improvements

Open danyspin97 opened this issue 4 years ago • 8 comments

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).

danyspin97 avatar Sep 20 '19 09:09 danyspin97

Hi, Sorry for the late response. Do you get errors when creating the Display object in Wayland?

slgobinath avatar Oct 17 '19 11:10 slgobinath

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 ""

danyspin97 avatar Oct 17 '19 13:10 danyspin97

I see. Please let me know once the PR is completed.

slgobinath avatar Oct 19 '19 01:10 slgobinath

Any progress on this?

soredake avatar Jan 26 '21 10:01 soredake

This PR seems abandoned ? Any news ?

AkechiShiro avatar Aug 10 '23 14:08 AkechiShiro

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.

danyspin97 avatar Aug 10 '23 14:08 danyspin97

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)

m00nwtchr avatar Sep 05 '23 10:09 m00nwtchr

In my gtk4 port https://github.com/slgobinath/SafeEyes/pull/561, I address this by using inhibit_system_shortcuts on wayland.

deltragon avatar Jan 24 '24 17:01 deltragon