-
Notifications
You must be signed in to change notification settings - Fork 17
/
generate_desktop_files
executable file
·84 lines (65 loc) · 2.55 KB
/
generate_desktop_files
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#!/usr/bin/python3
DOMAIN = "mintlocale"
PATH = "/usr/share/linuxmint/locale"
import os
import gettext
import mintcommon.additionalfiles as additionalfiles
os.environ['LANGUAGE'] = "en_US.UTF-8"
gettext.install(DOMAIN, PATH)
prefix = "[Desktop Entry]\n"
suffix = """Exec=mintlocale
Icon=preferences-desktop-locale
Terminal=false
Type=Application
Encoding=UTF-8
Categories=GNOME;GTK;Settings;DesktopSettings;XFCE;X-XFCE-SettingsDialog;X-XFCE-SystemSettings;
StartupNotify=false
"""
additionalfiles.generate(DOMAIN, PATH, "usr/share/applications/mintlocale.desktop", prefix, _("Languages"), _("Language settings"), suffix)
prefix = "[Desktop Entry]\n"
suffix = """Exec=mintlocale-im
Icon=mintlocale-im
Terminal=false
Type=Application
Encoding=UTF-8
Categories=GNOME;GTK;Settings;DesktopSettings;XFCE;X-XFCE-SettingsDialog;X-XFCE-SystemSettings;
StartupNotify=false
"""
additionalfiles.generate(DOMAIN, PATH, "usr/share/applications/mintlocale-im.desktop", prefix, _("Input method"), _("Language settings"), suffix)
prefix = """<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE policyconfig PUBLIC
"-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN"
"http://www.freedesktop.org/standards/PolicyKit/1/policyconfig.dtd">
<policyconfig>
<vendor>Linux Mint</vendor>
<vendor_url>https://linuxmint.com/</vendor_url>
<action id="com.linuxmint.mintlocale.add-remove">
<icon_name>preferences-desktop-locale</icon_name>
"""
suffix="""
<defaults>
<allow_any>no</allow_any>
<allow_inactive>no</allow_inactive>
<allow_active>auth_admin_keep</allow_active>
</defaults>
<annotate key="org.freedesktop.policykit.exec.path">/usr/bin/add-remove-locales</annotate>
<annotate key="org.freedesktop.policykit.exec.allow_gui">true</annotate>
</action>
"""
additionalfiles.generate_polkit_policy(DOMAIN, PATH, "usr/share/polkit-1/actions/com.linuxmint.mintlocale.policy", prefix, _("Languages"), suffix)
prefix="""
<action id="com.linuxmint.mintlocale.set-locale">
<icon_name>preferences-desktop-locale</icon_name>
"""
suffix="""
<defaults>
<allow_any>no</allow_any>
<allow_inactive>no</allow_inactive>
<allow_active>auth_admin_keep</allow_active>
</defaults>
<annotate key="org.freedesktop.policykit.exec.path">/usr/bin/set-default-locale</annotate>
<annotate key="org.freedesktop.policykit.exec.allow_gui">false</annotate>
</action>
</policyconfig>
"""
additionalfiles.generate_polkit_policy(DOMAIN, PATH, "usr/share/polkit-1/actions/com.linuxmint.mintlocale.policy", prefix, _("Languages"), suffix, append=True)