From 39d07f1c0e8123c39f306378d85290f6874b2589 Mon Sep 17 00:00:00 2001 From: Tom Perez <60866122+tper0700@users.noreply.github.com> Date: Fri, 17 Apr 2020 14:51:07 -0700 Subject: [PATCH] Building AppIconMenu from settings schema --- appIcons.js | 78 ++++++------------- ...shell.extensions.dash-to-panel.gschema.xml | 38 ++++++++- 2 files changed, 62 insertions(+), 54 deletions(-) diff --git a/appIcons.js b/appIcons.js index 856bbb3..0f1be45 100644 --- a/appIcons.js +++ b/appIcons.js @@ -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', () => { diff --git a/schemas/org.gnome.shell.extensions.dash-to-panel.gschema.xml b/schemas/org.gnome.shell.extensions.dash-to-panel.gschema.xml index acbd651..cc5a50d 100644 --- a/schemas/org.gnome.shell.extensions.dash-to-panel.gschema.xml +++ b/schemas/org.gnome.shell.extensions.dash-to-panel.gschema.xml @@ -372,6 +372,42 @@ Animate Show Applications from the desktop Animate Show Applications from the desktop + + ['gnome-control-center power', + 'gnome-logs', + 'gnome-control-center info-overview', + 'gnome-control-center display', + 'gnome-disks'] + Commands to run on Show Apps Menu + Commands to run in the Show Apps button context menu + + + ['Power options', + 'Event logs', + 'System', + 'Device Management', + 'Disk Management'] + Titles to show on Show Apps Menu + Titles to show in the Show Apps button context menu + + + ['gnome-terminal', + 'gnome-system-monitor', + 'nautilus', + 'gnome-shell-extension-prefs', + 'gnome-control-center wifi'] + Commands to run on panel context menu + Commands to run in the panel context menu + + + ['Terminal', + 'System monitor', + 'Files', + 'Extensions', + 'Settings'] + Titles to show on panel context menu + Titles to show in the panel context menu + false Show activities button @@ -1186,7 +1222,7 @@ Show progress bar on app icon Whether to show progress bar overlay on app icon, for supported applications. - + true Show badge count on app icon Whether to show badge count overlay on app icon, for supported applications.