I am creating a script in Python to integrate Pidgin with Unity (12.04), I've managed to do the counting notifications system using the Launcher API. But I dont know what event or signal is activated when the conversation window gains focus (To clear the message counter). I've tried some of the signals available on the documentation of Pidgin but none of them worked. Is there any GTK(or anything) event that is triggered when the window chat gets focus?
Disclaimer: I haven't tested this method
I see you already cover the part regarding to the Launcher API, if not it's quite similar to what you already have done.
About Pidgin integration, looking into the API I've found that Pidgin notify via DBus of almost everything that happens with the client.
Description: Emitted when a conversation is updated.
conv: The conversation that was updated.
type: The type of update that was made
Looking into the types of updates that can come with ths signal you find
PURPLE_CONV_UPDATE_UNSEEN that is triggered when the unseen state is updated.
So, now all you have to do is to adapt your code to handle this signal.
I've tested the method, and it works. In this pastebin is my example code if you want to take a look.