Home > ubuntu > Send desktop notification from your script

Send desktop notification from your script

Problem
From your script you want to send a notification to the user.

Solution #1
xmessage:

xmessage 'Warning! CPU overheated!'

It’ll open a window that stays there until the user closes it.

Solution #2
notify-send:

notify-send "New version of MC is out."

It looks cool (see the figure) but it disappears after a while. So if the user is not in front of the machine, (s)he may miss the message. I saw this tip here.

About these ads
Categories: ubuntu Tags: ,
  1. May 10, 2012 at 13:43

    I can’t believe you never came across notify-send. Anyway thanks for the subprocess tip. And I don’t think you can modify the time. http://www.linuxjournal.com/content/tech-tip-get-notifications-your-scripts-notify-send It’s given that you can. but it really doesn’t happen. :(

    • May 10, 2012 at 13:51

      Alas, I am not omniscient :) With notify-send I couldn’t change the time, it simply ignores the “-t” switch.

  1. No trackbacks yet.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 72 other followers

%d bloggers like this: