Below is the script, name it as "note" and put it in your PATH. Suppose your command is "locate nf.ml", then just type "locate nf.ml;note" and it works as we want! (You do need to install Gentoo "dev-python/notify-python" or Ubuntu python-notify first and change "file:///usr/bin/note.png" below to your favorite image)
#!/usr/bin/env python
import os,sys
try:
import pynotify
if pynotify.init("My Application Name"):
title = os.uname()[1]
try:
message = sys.argv[1]
except:
message = 'note'
home = os.environ['HOME']
n = pynotify.Notification(title, message, "file:///usr/bin/note.png")
#n.set_timeout(pynotify.EXPIRES_NEVER)
n.show()
else:
print "there was a problem initializing the pynotify module"
except:
print "you don't seem to have pynotify installed"
No comments:
Post a Comment