General information:
For GNU/Linux users:
When running mss
under Wayland, it crashs. As far as I understand from the source code, mss
currently uses xlib for Linux, which seems to (unsurprisingly) not work on Wayland. It would be very cool to have wayland support implemented, as it becomes more and more popular.
Example: Executing the following snippet under X works perfectly, while under Wayland it produces an error.
Snippet:
import mss
fn = mss.mss().shot(mon=-1, output="screenshot.png")
print(fn)
Error on Wayland:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/holger/.local/lib/python3.8/site-packages/mss/factory.py", line 41, in mss
return linux.MSS(**kwargs)
File "/home/holger/.local/lib/python3.8/site-packages/mss/linux.py", line 226, in __init__
self.root = self.xlib.XDefaultRootWindow(MSS.display)
File "/home/holger/.local/lib/python3.8/site-packages/mss/linux.py", line 175, in validate
raise ScreenShotError(err, details=details)
mss.exception.ScreenShotError: XDefaultRootWindow() failed
A lot of screenshot tools (e.g. shutter) have this issue, because screenshots seem to work completely different in Wayland (to improve security). Applications that do work are e.g.:
A proper way to do screenshots under Wayland is referenced in a flameshot issue and might help solving this in mss
, too. The main statement from that issue:
The cross-platform way to take screenshots on Wayland is via xdg-desktop-portal (which also works outside of Flatpak). See https://github.com/flatpak/xdg-desktop-portal/blob/master/data/org.freedesktop.portal.Screenshot.xml
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too