dshoreman / nextshot

A simple tool for taking screenshots on Linux and sharing via Nextcloud

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Area selection not working in Wayland

dshoreman opened this issue · comments

While NextShot is able to copy share links via wl-copy, it is highly likely that import is either only capable of capturing XWayland windows or simply won't work at all.

We'd probably need to use a different tool depending on the WM/DE being used, because each compositor has their own way of doing things. Or so I gather...

  • For GNOME(-Shell), there's gnome-screenshot.
  • Sway used to have swaygrab built in, but that got removed. The wiki suggests using grim.
  • For Sway, slurp can replace slop/maim. gnome-screenshot has the -a flag to select an area

After some testing in Wayland/Sway, the import command does work, but only partially.

Window Screenshots

Running import /tmp/foo.png and clicking on an XWayland window (e.g. Firefox) yields a screenshot of the window as expected.

Area Selection

Dragging fails to draw the selection box at all - even when over an X window running through XWayland. When selection ends, import fails with the following error:

import: unable to read X window image '': Resource temporarily unavailable @ error/xwindow.c/XImportImage/5044.
import: '/tmp/foo.png' @ error/import.c/ImportImageCommand/1288.

It's looking increasingly like Wayland will need env-specific toolsets. Regardless of whether shooting an XWayland window or a native Wayland one, maim is always producing a transparent image.

Selection Drawing

slop

  • Is able to draw the selection rectangle anywhere on the display
  • Returns coordinates even when selecting an area from a native window
  • Can only click for window coordinates with XWayland windows, not native ones

slurp

  • Native to Wayland, can draw anywhere on the display
  • Ability to show selection size in "tooltip"
  • Clicking cancels selection, no way to get window size for any window