浏览代码

Merge pull request #90 from jfly/exit-on-slop-cancel

More realistic examples that actually exit when slop is cancelled.
Dalton Nell 7 年前
父节点
当前提交
38d2339da9
没有帐户链接到提交者的电子邮件
共有 1 个文件被更改,包括 4 次插入2 次删除
  1. 4
    2
      README.md

+ 4
- 2
README.md 查看文件

18
 slop can be used to create a video recording script in only two lines of code.
18
 slop can be used to create a video recording script in only two lines of code.
19
 ```bash
19
 ```bash
20
 #!/bin/bash
20
 #!/bin/bash
21
-read -r X Y W H G ID < <(slop -f "%x %y %w %h %g %i")
21
+slop=$(slop -f "%x %y %w %h %g %i") || exit 1
22
+read -r X Y W H G ID < <(echo $slop)
22
 ffmpeg -f x11grab -s "$W"x"$H" -i :0.0+$X,$Y -f alsa -i pulse ~/myfile.webm
23
 ffmpeg -f x11grab -s "$W"x"$H" -i :0.0+$X,$Y -f alsa -i pulse ~/myfile.webm
23
 ```
24
 ```
24
 
25
 
25
 You can also take images using imagemagick like so:
26
 You can also take images using imagemagick like so:
26
 ```bash
27
 ```bash
27
 #!/bin/bash
28
 #!/bin/bash
28
-read -r G < <(slop -f "%g")
29
+slop=$(slop -f "%g") || exit 1
30
+read -r G < <(echo $slop)
29
 import -window root -crop $G ~/myimage.png
31
 import -window root -crop $G ~/myimage.png
30
 ```
32
 ```
31
 If you don't like ImageMagick's import: Check out [maim](https://github.com/naelstrof/maim) for a better screenshot utility.
33
 If you don't like ImageMagick's import: Check out [maim](https://github.com/naelstrof/maim) for a better screenshot utility.