Search code examples
pythonlinuxxfce

Flash Characters on Screen in Linux


I have a XFCE 4.6 on kernel 2.6. Is there a quick and easy way to flash a message on the screen for a few seconds?

My Thinkpad T60 has 3 volume buttons (up, down, mute). When I pressed the buttons, I would like to flash the volume on the screen for a second on screen. Can it be done with Python?


Solution

  • notification-daemon-xfce allows libnotify clients to show brief messages in XFCE. libnotify has Python bindings available.

    As an untested example,

    import pynotify
    import sys
    pynotify.init(sys.argv[0])
    notification = pynotify.Notification("Title", "body", "dialog-info")
    notification.set_urgency(pynotify.URGENCY_NORMAL)
    notification.set_timeout(pynotify.EXPIRES_DEFAULT)
    notification.show()