Building AppIconMenu from settings schema

This commit is contained in:
Tom Perez
2020-04-17 14:51:07 -07:00
parent 059a56259c
commit 39d07f1c0e
2 changed files with 62 additions and 54 deletions

View File

@@ -1754,62 +1754,34 @@ var MyShowAppsIconMenu = Utils.defineClass({
return null;
}
function _appendList(obj, cmd_list, title_list) {
if (cmd_list.length != title_list.length) {
return;
}
for (var entry = 0; entry < cmd_list.length; entry++) {
_appendItem(obj, {
title: title_list[entry],
cmd: cmd_list[entry].split(' ')
});
}
if (this.sourceActor != Main.layoutManager.dummyCursor) {
_appendItem(this, {
title: 'Power options',
cmd: ['gnome-control-center', 'power']
});
_appendItem(this, {
title: 'Event logs',
cmd: ['gnome-logs']
});
_appendItem(this, {
title: 'System',
cmd: ['gnome-control-center', 'info-overview']
});
_appendItem(this, {
title: 'Device Management',
cmd: ['gnome-control-center', 'display']
});
_appendItem(this, {
title: 'Disk Management',
cmd: ['gnome-disks']
});
this._appendSeparator();
obj._appendSeparator();
}
_appendItem(this, {
title: 'Terminal',
cmd: ['gnome-terminal']
});
_appendItem(this, {
title: 'System monitor',
cmd: ['gnome-system-monitor']
});
_appendItem(this, {
title: 'Files',
cmd: ['nautilus']
});
_appendItem(this, {
title: 'Extensions',
cmd: ['gnome-shell-extension-prefs']
});
_appendItem(this, {
title: 'Settings',
cmd: ['gnome-control-center', 'wifi']
});
this._appendSeparator();
if (this.sourceActor != Main.layoutManager.dummyCursor) {
_appendList(
this,
Me.settings.get_strv('show-apps-button-context-menu-commands'),
Me.settings.get_strv('show-apps-button-context-menu-titles')
)
}
_appendList(
this,
Me.settings.get_strv('panel-context-menu-commands'),
Me.settings.get_strv('panel-context-menu-titles')
)
let lockTaskbarMenuItem = this._appendMenuItem(Me.settings.get_boolean('taskbar-locked') ? _('Unlock taskbar') : _('Lock taskbar'));
lockTaskbarMenuItem.connect('activate', () => {

View File

@@ -372,6 +372,42 @@
<summary>Animate Show Applications from the desktop</summary>
<description>Animate Show Applications from the desktop</description>
</key>
<key type="as" name="show-apps-button-context-menu-commands">
<default>['gnome-control-center power',
'gnome-logs',
'gnome-control-center info-overview',
'gnome-control-center display',
'gnome-disks']</default>
<summary>Commands to run on Show Apps Menu</summary>
<description>Commands to run in the Show Apps button context menu</description>
</key>
<key type="as" name="show-apps-button-context-menu-titles">
<default>['Power options',
'Event logs',
'System',
'Device Management',
'Disk Management']</default>
<summary>Titles to show on Show Apps Menu</summary>
<description>Titles to show in the Show Apps button context menu</description>
</key>
<key type="as" name="panel-context-menu-commands">
<default>['gnome-terminal',
'gnome-system-monitor',
'nautilus',
'gnome-shell-extension-prefs',
'gnome-control-center wifi']</default>
<summary>Commands to run on panel context menu</summary>
<description>Commands to run in the panel context menu</description>
</key>
<key type="as" name="panel-context-menu-titles">
<default>['Terminal',
'System monitor',
'Files',
'Extensions',
'Settings']</default>
<summary>Titles to show on panel context menu</summary>
<description>Titles to show in the panel context menu</description>
</key>
<key type="b" name="show-activities-button">
<default>false</default>
<summary>Show activities button</summary>
@@ -1186,7 +1222,7 @@
<summary>Show progress bar on app icon</summary>
<description>Whether to show progress bar overlay on app icon, for supported applications.</description>
</key>
<key type="b" name="progress-show-count">
<key type="b" name="progress-show-count">
<default>true</default>
<summary>Show badge count on app icon</summary>
<description>Whether to show badge count overlay on app icon, for supported applications.</description>