Difference between revisions of "Desktop notifications"

From ArchWiki
Jump to: navigation, search
(Tips & Tricks)
(Tips & Tricks)
Line 42: Line 42:
 
   
 
   
 
  #!/usr/bin/env python
 
  #!/usr/bin/env python
 
 
  import subprocess
 
  import subprocess
 
 
  info = "Hello world "
 
  info = "Hello world "
 +
subprocess.call(('notify-send',info))
  
  subprocess.call(('notify-send',info))
+
#!/usr/bin/python
 +
import subprocess
 +
import commands   
 +
#KERNEL VERSION
 +
uname = commands.getoutput('uname -r')
 +
head = "All the info about your system:"
 +
msg = "Your kernel version: "+ uname +"\n"     
 +
# print message
 +
  subprocess.call(['notify-send', head, msg])
  
 
==More Resources==  
 
==More Resources==  
 
[http://www.florijan.net/2009/05/22/howto-using-python-to-display-notifications-using-libnotify/ Libnotify python example]
 
[http://www.florijan.net/2009/05/22/howto-using-python-to-display-notifications-using-libnotify/ Libnotify python example]
 
[http://roscidus.com/desktop/node/336 another libnotify example]
 
[http://roscidus.com/desktop/node/336 another libnotify example]

Revision as of 14:44, 10 July 2009

Tango-preferences-desktop-locale.pngThis article or section needs to be translated.Tango-preferences-desktop-locale.png

Notes: please use the first argument of the template to provide more detailed indications. (Discuss in Talk:Desktop notifications#)

Introduction

Libnotify is an easy way to display desktop notifications and information in a small dialog. It's used in much opensource apps like evolution , pidgin , etc. It has support for Gtk+ and Qt applications and is desktop independent.


Installation and Configuration

pacman -S libnotify

Now to configure libnotify and use libnotify you can use the gnome or xfce4

Gnome

pacman -S notification-daemon

For Configuring

pacman -S gconf-editor

then run gconf-editor and select "/apps/notification-daemon/" . There you can configure the notify widget

XFCE

pacman -S xfce4-notifyd
pacman -S xfconf 

For configuration run

xfce4-notifyd-config

Tips & Tricks

You can write your own libnotify display messages easily in python or other langauges. Here is an simple python example.

Note you will need to install the python bindings for libnotify

pacman -S python-notify  (communitiy)

Hello world example

#!/usr/bin/env python
import subprocess
info = "Hello world "
subprocess.call(('notify-send',info))
#!/usr/bin/python
import subprocess
import commands    
#KERNEL VERSION
uname = commands.getoutput('uname -r')
head = "All the info about your system:"
msg = "Your kernel version: "+ uname +"\n"       
# print message
subprocess.call(['notify-send', head, msg])

More Resources

Libnotify python example another libnotify example