emersion / grim

Grab images from a Wayland compositor
https://wayland.emersion.fr/grim
MIT License
911 stars 37 forks source link

grim + slurp > "screenshot region is empty" #59

Open Macellatore opened 5 years ago

Macellatore commented 5 years ago

Hello, i'm using the latest grim installed from pacman (grim-1.2.0-2). If calling grim (either with slurp getting the coords or when setting them manually) with the -g option, this is the output:

macellatore# grim -g "10,20 300x400" screenshot.png                                                                                                                                           
screenshot region is empty

It broke all of a sudden, last month it was working fine.

emersion commented 5 years ago

Can you run swaymsg -t get_outputs?

Macellatore commented 5 years ago
macellatore# swaymsg -t get_outputs
Output eDP-1 'Unknown 0x04B2 0x00000000' (focused)
  Current mode: 1920x1080 @ 60.020000 Hz
  Position: 0,1080
  Scale factor: 1.000000
  Subpixel hinting: unknown
  Transform: normal
  Workspace: 4
  Available modes:
    1920x1080 @ 40.014999 Hz
    1920x1080 @ 60.020000 Hz
emersion commented 5 years ago

This is because your only output is positioned at 0,1080. 10,20 300x400 is outside of those coordinates. We should probably print a better error message.

Regarding slurp giving wrong coordinates, maybe this is an instance of https://github.com/emersion/slurp/issues/37?

Macellatore commented 5 years ago

Sure, it has to be it! Changing my sway .config file from:

output eDP-1 position 0,1080
output HDMI-A-1 position 0,0

to:

output eDP-1 position 0,0
output HDMI-A-1 position 0,-1080

allowed me to get the right coords (at least for the primary display) without changing the relative position of my displays. Thanks a lot!