📜 ⬆️ ⬇️

Skype for Linux customization. Notification of the appearance of "favorite" contacts in the network

The main means of communication in our company is Skype chat kebabs . “Online” status means presence at the workplace. Sometimes you wait for someone, the authorities do not write “go pliz urgently” - in general, the notification of the appearance of a certain person in the network would be useful.

In Skype for Linux, there is no such a “tick” for individual contacts (I think that users of other operating systems are familiar with this). But there is an indisputable advantage - almost limitless command line features:

Script execution on Skype event

One example of replacing standard notifications from Microsoft with something more dwarf (using the libnotify library) is on the habr.
')
Our task is to improve these notifications. We want to filter contacts before accessing libnotify. Settings should be convenient enough not to remember stupid skype identifiers and not worry about losing settings when renaming a contact in a client.

The first script reload_contacts.py - we get a list of contacts


To get the names that we see in the Skype-client, Valery Yundin ( Vayun ) and his script come to the rescue , and it’s getting everything you need from several files most likely located at: ~/.Skype/-skype-id/user*.dbb

We will sort the contact data obtained from this script by name and save it in a file filter_notify.conf . By default, all contacts will be commented out with a pound symbol. Then to add a contact to the "favorites" will be enough to uncomment it.

By the way, our script should update the contact list, but keep the existing contact settings: which of the contacts were commented out at the time of the script launch. Therefore, we first read the filter_notify.conf file, if it already exists, and save the settings.

Everything is absolutely trivial, so here is a link to the reload_contacts.py ready-made code and the settings.py configuration file.

The second script filter_notify.py - manage the display of the notification


And we will call this script from Skype (see screenshot above), passing the Skype-identifier of the contact ( % sskype ) and the name displayed in the client ( % sname ). The script checks if you need to notify this person. If yes, it performs notify-send .

If the contact is not found in our list, then it makes sense to update the contact list by running the aforementioned reload_contacts.py .

As a result, nothing too complicated: filter_notify.py .

Instructions for use


  1. Add all 4 scripts to one folder:
    skypelog.py , reload_contacts.py , filter_notify.py and settings.py (download one archive , mirror ).
  2. Give rights to perform:
    chmod +x reload_contacts.py filter_notify.py
  3. Find the path to your Skype profile folder. For those who are not friends with the command line: open the "Home folder" and press Ctrl + H to display the hidden folders ( .Skype - hidden folder). Inside the folder .Skype will be a folder with a profile. Register the path to this folder in settings.py , parameter SKYPE_FOLDER .
    Settings files for different accounts should be in different folders.
  4. If desired: set the path to our contacts settings file filter_notify.conf (by default I put it in the ~ folder) - the parameter CONTACTS_NOTIFY_LIST .
  5. Run reload_contacts.py and make sure that the filter_notify.conf file filter_notify.conf created (at the address specified in CONTACTS_NOTIFY_LIST ) and contains a list of your contacts.
  6. In the Skype settings:
    • go to the “Notifications” tab;
    • select the event we need: "Contact Came Online" ("Contact has appeared on the network");
    • enable “Advanced View” (“More Settings”);
    • a tick will appear “Execute the following script:” (“Run the following script:”) - enable it;
    • enter the name of our script with two parameters "%sskype" "%sname" ;
    • uncheck the “Play sound file” and “Display pop-up notification” checkboxes ... CO asserts that our filter does not apply to them;
    • Click “Apply” and close the settings window.

Done! Now you can uncomment the necessary contacts so that notifications about them (and only about them) are sent to notify-send .

Conclusion


Thanks to the "advanced" alert system, Skype is open to numerous improvements: from another upgrade from notify-send to the voice acting of incoming chat messages. If you have other interesting recipes, I suggest to share.

PS Thank you UFO for an invite.

UPD: when uploading to github, fixed a bug in filter_contacts.py. The launch of "./reload_contacts.py" on the second-last line did not work (for the folder containing the script is not current if the script is launched by the Skype client).

Source: https://habr.com/ru/post/146778/


All Articles