方便的 屏幕截图 -> 贴图 脚本
在 IRC 上贴大段文字有 nopaste, 但贴屏幕截图就比较麻烦.. 于是我就利用前面的 imageshack 脚本写了一个脚本:
依赖: imgshack, scrot, xsel, softbeep(如果你想替换 scrot 的 beep 的话), 还有提示音需要的播放器和声音文件
代码:
#!/bin/sh
# a screen shot script.
PLAYER="aplay" # or esdplay ...
NOTICE_START="/usr/share/sounds/pidgin/receive.wav"
NOTICE_END="/usr/share/sounds/pidgin/send.wav"
IMGFILE="/tmp/shot-`date +%Y%m%d%H%M%S`.jpg"
$PLAYER "$NOTICE_START"
if softbeep scrot -s "$IMGFILE"; then
(
echo foo;
SHOT_URL=`imgshack "$IMGFILE"`;
echo $SHOT_URL > ${IMGFILE%%jpg}url.txt;
echo -n $SHOT_URL | xsel # for middle click
# echo -n $SHOT_URL | xsel -b # for ctrl-v
)|zenity --progress --text "Uploading ... " --pulsate --auto-close
fi
$PLAYER "$NOTICE_END"
用法: 运行之(或者绑到快捷键, 这样更方便), 听到第一声提示声, 在屏幕上拖框框, 听到第二声提示声(scrot的提示声), 稍等片刻会听到第三声提示声, 此时截图的 URL 已经复制到剪贴板, 可以用中键粘到任何地方.
如果运行了后想取消截图,在拖框框前按 Esc 即可.
This entry was posted on Wednesday, July 4th, 2007 at 9:00 pm and is filed under BASH, Linux, Programming. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.
Have your say
Fields in bold are required. Email addresses are never published or distributed.
Some HTML code is allowed:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>URIs must be fully qualified (eg: http://www.domainname.com) and all tags must be properly closed.
Line breaks and paragraphs are automatically converted.
Please keep comments relevant. Off-topic, offensive or inappropriate comments may be edited or removed.