我稍微修改了官方的 Imgur 上传脚本以允许它绑定到一个键,但是当我实际按下该键时,它似乎只是运行两个 notify-send 命令并结束脚本。如果我通过终端或通过 ALT+F2 执行,它可以工作,但无论我使用什么,都不能通过按键。
脚本如下:
#!/bin/bash
sleep 0.5;
notify-send "Imgur Uploader";
function uploadImage {
curl -s -F "image=@$1" -F "key=486690f872c678126a2c09a9e196ce1b" http://imgur.com/api/upload.xml | grep -E -o "<original_image>(.)*</original_image>" | grep -E -o "http://i.stack.imgur.com/[^<]*";
}
scrot -s "shot.png";
image=`uploadImage "shot.png"`;
echo $image | xclip -selection c;
rm "shot.png";
notify-send "Done!" "$image";
就像我说的,脚本在手动调用时有效,但我不能让它运行绑定到按键。我已经尝试过screenshot
,,/usr/bin/screenshot
等等。我在这里错过了什么重要的东西吗?sh screenshot
sh /usr/bin/screenshot