Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Wayland improvements #338

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

danyspin97
Copy link

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

If X11 Display constructor raises an error, then the screen is
Wayland only, update the context.
@slgobinath
Copy link
Owner

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

@danyspin97
Copy link
Author

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

@slgobinath
Copy link
Owner

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

@soredake
Copy link

Any progress on this?

@AkechiShiro
Copy link

This PR seems abandoned ? Any news ?

@danyspin97
Copy link
Author

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.

@m00nwtchr
Copy link

m00nwtchr commented Sep 5, 2023

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)

@deltragon
Copy link

In my gtk4 port #561, I address this by using inhibit_system_shortcuts on wayland.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants