5

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.

1 Answer 1

7

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.

1
  • 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, 2012 at 15:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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