mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-07-30 09:59:50 +03:00
Add support for grim in wayland sessions
This commit is contained in:
parent
eb0395442c
commit
674b2395f4
|
@ -44,6 +44,7 @@ class TestImageGrab:
|
||||||
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("spectacle")
|
and not shutil.which("spectacle")
|
||||||
|
and not shutil.which("grim")
|
||||||
):
|
):
|
||||||
with pytest.raises(OSError) as e:
|
with pytest.raises(OSError) as e:
|
||||||
ImageGrab.grab()
|
ImageGrab.grab()
|
||||||
|
|
|
@ -16,7 +16,7 @@ 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 used as a
|
||||||
fallback if they are installed. To disable this behaviour, pass ``xdisplay=""``
|
fallback if they are installed. To disable this behaviour, pass ``xdisplay=""``
|
||||||
instead.
|
instead.
|
||||||
|
|
||||||
|
|
|
@ -91,6 +91,8 @@ def grab(
|
||||||
args = ["gnome-screenshot", "-f"]
|
args = ["gnome-screenshot", "-f"]
|
||||||
elif shutil.which("spectacle"):
|
elif shutil.which("spectacle"):
|
||||||
args = ["spectacle", "-n", "-b", "-f", "-o"]
|
args = ["spectacle", "-n", "-b", "-f", "-o"]
|
||||||
|
elif shutil.which("grim"):
|
||||||
|
args = ["grim"]
|
||||||
else:
|
else:
|
||||||
raise
|
raise
|
||||||
fh, filepath = tempfile.mkstemp(".png")
|
fh, filepath = tempfile.mkstemp(".png")
|
||||||
|
|
Loading…
Reference in New Issue
Block a user