Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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

1 Answer 1

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

 
discard

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.