Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I would like to write an application that receives a notification whenever the messaging menu is activated (the blue envelope lights up) and whenever it is deactivated (the blue envelope returns to its default color).

Is there any way to get a notification for this? I'm not really concerned about programming language in this case - although C, Python, or PHP would be preferred.

share|improve this question
up vote 7 down vote accepted

Interesting question. There is no official API for discovering if the messaging menu has changed it's state. You can do it by looking at the DBus interface of the indicator-messages-service. A shell script way is like this:

  $ gdbus call --session --dest com.canonical.indicator.messages --object-path /com/canonical/indicator/messages/service --method com.canonical.indicator.messages.service.AttentionRequested

There is also a signal "AttentionChanged". You can track that to determine the state as it updates.

Also, if you're interested in the individual items in the messaging menu all their information is exported using libindicate. It is possible to have another libindicate listener on DBus that gets all of the information and aggregates it in a different way.

share|improve this answer
Hi Ted, is there a way to monitor the presence state of the messaging indicator? For example, a signal when someone changes status from offline to available. – Owais Lone Jul 28 '12 at 15:07

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.