/usr/share/session-migration/scripts/update-desktop-file-unity-webapps-yandexmail.py is in unity-webapps-yandexmail 2.4.16+13.10.20130924.2-0ubuntu1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | #!/usr/bin/python
from gi.repository import Gio
import os
import glib
import glob
import re
APP_ID = 'YandexMailyandexcom'
def get_local_applications_path():
return os.path.join(glib.get_user_data_dir(), 'applications')
def update_desktop_file_startupwmclass():
local_applications_path = get_local_applications_path()
if not os.path.exists(local_applications_path) or not os.path.isdir(local_applications_path):
return
desktop_filename = os.path.join(local_applications_path, '{0}.desktop'.format(APP_ID))
if not os.path.exists(desktop_filename) or not os.path.isfile(desktop_filename):
return
try:
desktop_file_content = open(desktop_filename).read()
start_idx = desktop_file_content.find('[Desktop Entry]')
if start_idx != -1 and desktop_file_content.find('StartupWMClass') == -1:
start_idx += len('[Desktop Entry]')
updated_desktop_file_content = desktop_file_content[:start_idx] + '\nStartupWMClass={0}'.format(APP_ID) + desktop_file_content[start_idx:]
open(desktop_filename, "w+").write(updated_desktop_file_content)
except Exception, e:
print 'Error while upgrading the desktop file: ', str(e)
if __name__ == "__main__":
update_desktop_file_startupwmclass()
|