joi, 11 noiembrie 2010

Notifications in Fedora 14

We use the following command
$ notify-send  "This is some text"
$zenity --info --text "This is some text"
This will display a text balloon "This is some text".
The problem appears when we want to display the output of a command.
For this I used a python script. Here's the source code:
#!/usr/bin/env python
import os
import sys
import pynotify
pynotify.init("Output comand")
print arg
s = os.popen(arg).read()
n = pynotify.Notification("Output",s)
If you wish to use a compound command, then you will need to use quotes.
For example, we use the command "ls-a 'as follows:
$python "ls -a"
This is just a small example, you can create more complex applications.