Archive

Posts Tagged ‘notify’

超有爱的用notify-send提示(基于Wow!Ubuntu 命令修改)

August 7th, 2010 2 comments

Wow!Ubuntu 里面有个用notify-send 提示的小命令(点这儿查看), 但是比较单调, 其实之前看过一个用如 notify [command] 形式的(找不到但是>_<),写了下,把notify写成脚本, 但是感觉这样Gnome-terminal的自动补全与ls等的颜色会丢…于是感觉还是Wow!Ubuntu上更好用些. (使用前请看之前链接, 只是改了 alert 命令) 在.bashrc 里面加入(请先装 sudo apt-get install libnotify-bin )

1
2
3
4
5
6
7
8
9
10
alias alert_helper='history|tail -n1|sed -e "s/^\s*[0-9]\+\s*//" -e "s/;\s*alert$//"'
alias alert='
status=$?;
if [ $status = 0 ]; then
     notify-send -i /usr/share/icons/Breathe/scalable/status/dialog-information.svg "[$status] $(alert_helper) Finished ^_^" ;
elif [ $status = 127 ]; then
     notify-send -i /usr/share/icons/Breathe/scalable/status/dialog-question.svg "[$status] $(alert_helper) Command cannot be found ?_?" ;
else
     notify-send -i /usr/share/icons/Breathe/scalable/status/dialog-error.svg "[$status] $(alert_helper) Error &gt;_&lt;" ;
fi'

截图:
分别是成功\找不到命令\错误的命令的图

其中图标来自一个主题叫Breathe, 位置命令所示的地方,当然也可以自己改下. 文件在此下载: status.tar

Categories: Linux Tags: ,