Answers:
我在这里找到了一个很好的答案,值得重复。
这可以通过ImageMagick实现。通过运行命令安装
sudo apt-get install imagemagick
要获取所有桌面,只需键入
import -window root screen.png
或者您可以延迟5秒
sleep 5; import -window root screen.png
xbindkeys
,虽然
这是我用来获取根区域窗口或使用import 延迟 ScreenShots 的perl6脚本:
#!/usr/bin/env perl6
use v6;
sub message(Str $file) {
run <xmessage -nearmouse -timeout 3>, "Screenshot saved in $file";
}
sub print_window(Str $file) {
qx{xprop -root | grep "_NET_ACTIVE_WINDOW(WINDOW)"} ~~ /(0x\d*).*$/;
run <import -window>, $0, $file;
message($file);
}
sub MAIN( Str $option where $option ∈ <root area window delay> ) {
my $today = DateTime.now( formatter => {
sprintf "%04d_%02d_%02d_%02d:%02d:%02d",
.year, .month, .day, .hour, .minute, .second
} );
my $file = "$*HOME/Dades/Imatges/ScreenShots/$today.png";
given $option {
when 'root' { run <import -window root>, $file; message($file) }
when 'area' { run "import", $file ; message($file) }
when 'window' { print_window($file) }
when 'delay' { sleep 5; print_window($file) }
default { say 'Something went wrong' ; exit }
}
}
这些是i3中运行脚本的键绑定:
bindsym $mod+Print exec Print_Screen root
bindsym --release $mod+Shift+Print exec Print_Screen area
bindsym $mod+Mod1+Print exec Print_Screen delay
bindsym $mod+Control+Print exec Print_Screen window