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

Added session type check for Linux in ImageGrab.grabclipboard() #7332

Merged
merged 8 commits into from Aug 22, 2023
Merged

Added session type check for Linux in ImageGrab.grabclipboard() #7332

merged 8 commits into from Aug 22, 2023

Conversation

TheNooB2706
Copy link
Contributor

@TheNooB2706 TheNooB2706 commented Aug 11, 2023

Fixes #7331

Changes proposed in this pull request:

  • Check if current session is X11 or Wayland and decide which command to use. This is done by using loginctl command (based on this). If the session check failed (loginctl not available because eg. not on systemd), fall back to previous routine (assume Wayland first, if wl-paste unavailable then assume X11)
  • Raise NotImplementedError if xclip unavailable on X11 session or wl-paste unavailable on Wayland session

src/PIL/ImageGrab.py Outdated Show resolved Hide resolved
src/PIL/ImageGrab.py Outdated Show resolved Hide resolved
src/PIL/ImageGrab.py Outdated Show resolved Hide resolved
TheNooB2706 and others added 2 commits August 11, 2023 21:01
Simplify conditional expressions

Co-authored-by: Andrew Murray <3112309+radarhere@users.noreply.github.com>
src/PIL/ImageGrab.py Outdated Show resolved Hide resolved
src/PIL/ImageGrab.py Outdated Show resolved Hide resolved
src/PIL/ImageGrab.py Outdated Show resolved Hide resolved
Co-authored-by: Andrew Murray <3112309+radarhere@users.noreply.github.com>
src/PIL/ImageGrab.py Outdated Show resolved Hide resolved
src/PIL/ImageGrab.py Outdated Show resolved Hide resolved
@radarhere radarhere changed the title Add session type check in grabclipboard for Linux Added session type check in grabclipboard for Linux Aug 16, 2023
radarhere and others added 2 commits August 21, 2023 23:58
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
@radarhere radarhere merged commit e021d06 into python-pillow:main Aug 22, 2023
52 of 53 checks passed
@radarhere radarhere changed the title Added session type check in grabclipboard for Linux Added session type check for Linux in ImageGrab.grabclipboard() Aug 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ImageGrab.grabclipboard on Linux with both X11 and Wayland installed
3 participants