问题陈述
我scrot
过去常常截屏,除非我有多个显示器或显示器,否则效果很好。在这种情况下scrot
,将不同监视器的屏幕截图合并到一个输出中。
从手册页,scrot
支持一个选项-m
:
-m, --multidisp
For multiple heads, grab shot from each and join them together.
所以我想象默认行为是不将它们连接在一起。然而,这种情况并非如此。即使没有这个-m
选项,我也会得到加入的屏幕截图。
我很乐观scrot
应该能够做到这一点,因为它支持该-u
选项:
-u, --focused
Use the currently focused window.
效果很好。
我还检查了另一个名为的 CLI 工具maim
- 但我还是不知道如何分别截取不同监视器的屏幕截图。
所以我排除的解决方案应该是这样的:
screenshot_command <display_name> # and other options
只截屏显示<display_name>
。
到目前为止我的解决方案尝试
maim
支持古玩寻找选项-x
:
-x, --xdisplay=hostname:number.screen_number
Sets the xdisplay to use.
所以我尝试maim -x 0.0 | xclip -selection clipboard -t image/png
了,但这不起作用。我不知道如何使用此选项,因为没有足够的文档。
两者都scrot
支持maim
选项-s
:
-s, --select
Interactively select a window or rectangle with the mouse.
所以我正在想象一个非常丑陋/hacky的解决方案,使用(或xdotool
类似的)来选择所需的显示并使用选项-s
来完成这项工作。但除非没有其他直接的解决方案,否则我宁愿不走这条路。maim
scrot
疯狂的猜测
我想知道这个问题是否是因为我如何添加新显示器?我通常用这样的命令添加我的第二个显示器:
xrandr --output eDP-1 --auto --output HDMI-1-4 --auto --right-of eDP-1
所以我想知道,可能是scrot
或者maim
只有一个显示器。我这么想是因为xdpyinfo | grep -A4 '^screen'
with ONE monitor 的输出看起来像:
$ 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
并且有两个显示器看起来像这样:
$ 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
如果这确实是我的问题的原因,那么我应该如何添加我的第二台显示器?