Fixing Telegram’s notification icon in Mate

I like Telegram a lot for cross platform instant messaging. It’s basically a WhatsApp clone but superior (for my purposes) because it has native (Windows, Mac & Linux) clients as well as mobile apps.

A while back I noticed that a Telegram update had caused the notification/indicator icon to go missing on my Ubuntu MATE desktop:

Telegram notification icon missing
Telegram notification icon missing

I eventually tracked the problem down to an environment variable: XDG_CURRENT_DESKTOP which Telegram uses to determine which desktop environment you’re running. In Mate it’s set to “MATE”, setting it to “GNOME” (which is what MATE actually is) works around the problem and the icon comes back:

Telegram notification icon present
Telegram notification icon present

I now use the following script to launch Telegram when I logon:
#!/bin/bash
export XDG_CURRENT_DESKTOP=GNOME
${HOME}/bin/telegram/Telegram "$@"