Missing wayland support
meliache opened this issue · 3 comments
I tried monolens under wayland with the sway window manager via pipx and it crashed with
On OSX, you need to give Monolens permission to make screenshots, which is safe.
Traceback (most recent call last):
File "/home/michael/.local/pipx/.cache/ec49a1adcc18bdc/bin/monolens", line 8, in <module>
sys.exit(main())
File "/home/michael/.local/pipx/.cache/ec49a1adcc18bdc/lib/python3.9/site-packages/monolens/__init__.py", line 46, in main
lens = Lens()
File "/home/michael/.local/pipx/.cache/ec49a1adcc18bdc/lib/python3.9/site-packages/monolens/lens.py", line 35, in __init__
self._updateScreenshot(self.screen())
File "/home/michael/.local/pipx/.cache/ec49a1adcc18bdc/lib/python3.9/site-packages/monolens/lens.py", line 187, in _updateScreenshot
self._updateConverted()
File "/home/michael/.local/pipx/.cache/ec49a1adcc18bdc/lib/python3.9/site-packages/monolens/lens.py", line 191, in _updateConverted
util.grayscale(self._converted, self._screenshot)
File "/home/michael/.local/pipx/.cache/ec49a1adcc18bdc/lib/python3.9/site-packages/monolens/util.py", line 66, in grayscale
s = qimage_array_view(source)
File "/home/michael/.local/pipx/.cache/ec49a1adcc18bdc/lib/python3.9/site-packages/monolens/util.py", line 45, in qimage_array_view
assert format == QtGui.QImage.Format_RGB32
AssertionError
I'm not entirely surprise, since screenshotting utilities etc. are different under wayland. But from the stacktrace it's not obvious why exactly it crashed and in theory, Qt should be able to handle wayland, or shouldn't it?
Anyway, would be cool if someone else could try it and if they can reproduce it, add it to the limitations in the readme, after all wayland is slowly becoming more mainstream. But maybe just something with my system configuration is broken 🤷♂️
Sorry for the late reply, I think that's interesting feedback. It is difficult for me to debug this without having a Linux system with Wayland. Perhaps there is an easy fix: I just need to support more QImage formats other than RGB32.
After #13 was merged I now cloned this rep and did a clean install and monolens still fails with the same backtrace as above, i.e. fails from the assert
assert format == QtGui.QImage.Format_RGB32
I opened a debugger and format in that assert has the value PySide6.QtGui.QImage.Format.Format_Invalid for me.
I understand that it's frustrating not being able to test this. At this point I'm not sure if that error occurs for all wayland users or maybe it's just some misconfiguration on my side with my sway wm setup. Since this seems to be implemented in QT, maybe it might work in a KDE wayland desktop environment.
Anyway thanks for your effort!
If the format is invalid, then I cannot do anything to make it work on Wayland, I am afraid. This has to be fixed in Qt then.