一开始就对ubuntu的右上角的提示感觉很不错,所以就写了个定时提示的程序。
#!/usr/bin/python3.2
from sys import argv
from os import system as exe
from time import sleep
def usag():
print("""
USAG:
myclock seconds[, message]
example myclock 6 hello,world
""")
def print_by_ubuntu_notify(text):
exe('/usr/bin/notify-send %s'%text)
def main():
if len(argv)<2:
usag()
else:
sleep(int(argv[1]))
if len(argv)>=3:
s=''
for i in range(2,len(argv)):
s+=argv[i]
print_by_ubuntu_notify(s)
else:
print_by_ubuntu_notify('time out')
main()
我保存为文件 notifyme
执行
>>> notifyme 1 hello,oschina
显示>>>
也可以直接下载运行
http://pan.baidu.com/s/1c0F3rcW