mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-07-12 17:22:28 +03:00
Add support for Grim in Wayland sessions ImageGrab (#8912)
Co-authored-by: Andrew Murray <radarhere@users.noreply.github.com>
This commit is contained in:
parent
03e7871afd
commit
4402797b35
|
@ -43,6 +43,7 @@ class TestImageGrab:
|
||||||
if (
|
if (
|
||||||
sys.platform not in ("win32", "darwin")
|
sys.platform not in ("win32", "darwin")
|
||||||
and not shutil.which("gnome-screenshot")
|
and not shutil.which("gnome-screenshot")
|
||||||
|
and not shutil.which("grim")
|
||||||
and not shutil.which("spectacle")
|
and not shutil.which("spectacle")
|
||||||
):
|
):
|
||||||
with pytest.raises(OSError) as e:
|
with pytest.raises(OSError) as e:
|
||||||
|
|
|
@ -16,9 +16,9 @@ or the clipboard to a PIL image memory.
|
||||||
the entire screen is copied, and on macOS, it will be at 2x if on a Retina screen.
|
the entire screen is copied, and on macOS, it will be at 2x if on a Retina screen.
|
||||||
|
|
||||||
On Linux, if ``xdisplay`` is ``None`` and the default X11 display does not return
|
On Linux, if ``xdisplay`` is ``None`` and the default X11 display does not return
|
||||||
a snapshot of the screen, ``gnome-screenshot`` or ``spectacle`` will be used as a
|
a snapshot of the screen, ``gnome-screenshot``, ``grim`` or ``spectacle`` will be
|
||||||
fallback if they are installed. To disable this behaviour, pass ``xdisplay=""``
|
used as a fallback if they are installed. To disable this behaviour, pass
|
||||||
instead.
|
``xdisplay=""`` instead.
|
||||||
|
|
||||||
.. versionadded:: 1.1.3 (Windows), 3.0.0 (macOS), 7.1.0 (Linux)
|
.. versionadded:: 1.1.3 (Windows), 3.0.0 (macOS), 7.1.0 (Linux)
|
||||||
|
|
||||||
|
|
|
@ -89,6 +89,8 @@ def grab(
|
||||||
if display_name is None and sys.platform not in ("darwin", "win32"):
|
if display_name is None and sys.platform not in ("darwin", "win32"):
|
||||||
if shutil.which("gnome-screenshot"):
|
if shutil.which("gnome-screenshot"):
|
||||||
args = ["gnome-screenshot", "-f"]
|
args = ["gnome-screenshot", "-f"]
|
||||||
|
elif shutil.which("grim"):
|
||||||
|
args = ["grim"]
|
||||||
elif shutil.which("spectacle"):
|
elif shutil.which("spectacle"):
|
||||||
args = ["spectacle", "-n", "-b", "-f", "-o"]
|
args = ["spectacle", "-n", "-b", "-f", "-o"]
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user