Only check for gnome-screenshot on Linux

Co-authored-by: Ondrej Baranovič <3819630+nulano@users.noreply.github.com>
This commit is contained in:
Andrew Murray 2023-05-10 13:53:55 +10:00 committed by GitHub
parent bb18abc603
commit 3ec03c6720
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -71,7 +71,11 @@ def grab(bbox=None, include_layered_windows=False, all_screens=False, xdisplay=N
im = im.crop(bbox)
return im
except OSError:
if xdisplay is None and shutil.which("gnome-screenshot"):
if (
xdisplay is None
and sys.platform not in ("darwin", "win32")
and shutil.which("gnome-screenshot")
):
fh, filepath = tempfile.mkstemp(".png")
os.close(fh)
subprocess.call(["gnome-screenshot", "-f", filepath])