emersion / grim

Grab images from a Wayland compositor

Home Page:https://wayland.emersion.fr/grim

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cursor is captured without `-c` when `$WLR_NO_HARDWARE_CURSORS` is set to `1` in sway

blurgyy opened this issue · comments

Hi, thank you for the great tool!

When I start sway with environment varialbe $WLR_NO_HARDWARE_CURSORS=1 to use software cursors, grim will capture my cursor even if I did not pass it with -c flag. This results in all my captured screenshots to contain a portion of my cursor, depending on the last position of my cursor:
Top-left: image
Top-right: image
Bottom-left: image
Bottom-right: image

I also fail to grab pixel color with the method documented in README:

grim -g "$(slurp -p)" -t ppm - | convert - -format '%[pixel:p{0,0}]' txt:-

Since my cursor is always captured by grim, the captured color is always the color of my cursor's tip, which is #7C7C7C in my case. I believe the issue mentioned in #96 is somewhat similar and might be related.

If I remove the export WLR_NO_HARDWARE_CURSORS=1 befor starting sway, the problem goes away, cursor will then only be captured when I explicitly pass -c to grim, and pixel color grabbing also works properly. If I keep using software cursors (i.e. setting $WLR_NO_HARDWARE_CURSORS to 1), an undesireable workaround is to quickly move my cursor out of my selection region after selection with slurp, so that the cursor will not be captured by grim.

grim just passes the cursor flag to wlroots, this is a wlroots bug. IIRC we already have an opened issue for that.