Problem-statement
I use scrot
to take screenshots, which works perfectly except when I have multiple monitors or displays. In that case scrot
joins the screenshots of different monitors into one single output.
From the manpage, scrot
supports an option -m
:
-m, --multidisp
For multiple heads, grab shot from each and join them together.
So I imagined the default behavior would be to NOT join them together. However this is not the case. Even without the -m
option I get joined screenshots.
I am optimistic that scrot
should be able to do this as it support the -u
option:
-u, --focused
Use the currently focused window.
which works perfectly fine.
I also checked out another CLI tool called maim
- but again I couldn't figure out how to take screenshot of different monitors separately.
So the solution I am excepting should work something like this:
screenshot_command <display_name> # and other options
to screenshot only the display <display_name>
.
My attempts at solution so far
maim
supports the curios looking option -x
:
-x, --xdisplay=hostname:number.screen_number
Sets the xdisplay to use.
So I tried maim -x 0.0 | xclip -selection clipboard -t image/png
, but that doesn't work. I don't know how this option is intended to be used as there isn't enough documentation.
Both scrot
and maim
also supports the option -s
:
-s, --select
Interactively select a window or rectangle with the mouse.
So I am imagining a very ugly/ hacky solution using xdotool
(or similar) to select the desired display and using with the option -s
to maim
or scrot
may do the job. But I would rather not tread this route unless there is no other straight forward solution.
A wild speculation
I wonder if this problem could be because of how I am adding new monitors? I usually add my second display with a command something like this:
xrandr --output eDP-1 --auto --output HDMI-1-4 --auto --right-of eDP-1
So I am wondering, may be to scrot
or maim
there is only one display. And I imagine so because the output of xdpyinfo | grep -A4 '^screen'
with ONE monitor looks like:
$ xdpyinfo | grep -A4 '^screen'
screen #0:
dimensions: 1920x1080 pixels (506x285 millimeters)
resolution: 96x96 dots per inch
depths (7): 24, 1, 4, 8, 15, 16, 32
root window id: 0x1ba
and with two monitors looks like this:
$ xdpyinfo | grep -A4 '^screen'
screen #0:
dimensions: 3280x1080 pixels (865x285 millimeters)
resolution: 96x96 dots per inch
depths (7): 24, 1, 4, 8, 15, 16, 32
root window id: 0x1ba
If this is indeed the cause of my problems, then how should I add my second monitor?