From 18875010812d0c89647843dcb77115133c483521 Mon Sep 17 00:00:00 2001 From: Charles Gagnon Date: Fri, 1 May 2020 14:10:09 -0400 Subject: [PATCH 01/15] Remove fuzzy mentions from spanish translation --- po/es.po | 43 ------------------------------------------- 1 file changed, 43 deletions(-) diff --git a/po/es.po b/po/es.po index 873797f..7d29321 100644 --- a/po/es.po +++ b/po/es.po @@ -42,7 +42,6 @@ msgid "Left, with floating center plugin icons" msgstr "A la izquierda, con iconos flotantes centrados" #: prefs.js:214 -#, fuzzy msgid "Center, fixed in middle of monitor" msgstr "Centrado, fijo en mitad del monitor" @@ -83,7 +82,6 @@ msgid "Bottom of system indicators" msgstr "Abajo de los indicadores del sistema" #: prefs.js:222 -#, fuzzy msgid "Right of system indicators" msgstr "A la derecha de los indicadores del sistema" @@ -92,7 +90,6 @@ msgid "Top of taskbar" msgstr "Arriba de la barra de tareas" #: prefs.js:223 -#, fuzzy msgid "Left of taskbar" msgstr "A la izquierda de la barra de tareas" @@ -101,12 +98,10 @@ msgid "Bottom of taskbar" msgstr "Abajo de la barra de tareas" #: prefs.js:224 -#, fuzzy msgid "Right of taskbar" msgstr "A la derecha de la barra de tareas" #: prefs.js:230 -#, fuzzy msgid "Show Desktop button height (px)" msgstr "Alto del botón Mostrar Escritorio (px)" @@ -165,12 +160,10 @@ msgid "Customize middle-click behavior" msgstr "Personalizar comportamiento del botón central" #: prefs.js:1473 -#, fuzzy msgid "Customize panel scroll behavior" msgstr "Personalizar comportamiento del desplazamiento del panel" #: prefs.js:1509 -#, fuzzy msgid "Customize icon scroll behavior" msgstr "Personalizar comportamiento del desplazamiento de los iconos" @@ -211,7 +204,6 @@ msgid "Windows" msgstr "Ventanas" #: appIcons.js:1745 -#, fuzzy msgid "Power options" msgstr "Energía" @@ -236,7 +228,6 @@ msgid "Terminal" msgstr "Terminal" #: appIcons.js:1778 -#, fuzzy msgid "System monitor" msgstr "Monitor del sistema" @@ -282,7 +273,6 @@ msgid "Version %s (%s) is available" msgstr "La versión %s (%s) está disponible" #: update.js:63 -#, fuzzy msgid "Details" msgstr "Mostrar detalles" @@ -335,7 +325,6 @@ msgid "Shift+Click action" msgstr "Acción de Mayúsculas+Click" #: Settings.ui.h:4 -#, fuzzy msgid "Raise windows" msgstr "Elevar ventanas" @@ -376,12 +365,10 @@ msgid "Shift+Middle-Click action" msgstr "Acción de Mayúsculas+Botón-Central" #: Settings.ui.h:15 -#, fuzzy msgid "Isolate monitors" msgstr "Aislar los espacios de trabajo" #: Settings.ui.h:16 -#, fuzzy msgid "Display favorite applications on all monitors" msgstr "Mostrar aplicaciones favoritas en todos los espacios de trabajo" @@ -418,12 +405,10 @@ msgid "Highlight opacity" msgstr "Opacidad de resaltado" #: Settings.ui.h:25 -#, fuzzy msgid "Indicator size (px)" msgstr "Tamaño del indicador (px)" #: Settings.ui.h:26 -#, fuzzy msgid "Indicator color - Icon Dominant" msgstr "Color del indicador - Predominar el icono" @@ -460,7 +445,6 @@ msgid "Font size (px) of the application titles (default is 14)" msgstr "Tamaño de la fuente (px) para los títulos de aplicación (14 por defecto)" #: Settings.ui.h:35 -#, fuzzy msgid "Font weight of application titles" msgstr "Tamaño de la fuente para los títulos de aplicación" @@ -534,7 +518,6 @@ msgid "Maximized windows" msgstr "Ventanas maximizadas" #: Settings.ui.h:52 -#, fuzzy msgid "Require pressure at the edge of the screen to reveal the panel" msgstr "Requerir presión en el borde de la pantalla para mostrar el panel" @@ -575,7 +558,6 @@ msgid "Delay before hiding the panel (ms)" msgstr "Tiempo antes de ocultar el panel (ms)" #: Settings.ui.h:62 -#, fuzzy msgid "Delay before enabling intellihide on start (ms)" msgstr "Tiempo antes de habilitar el panel inteligente (ms)" @@ -584,22 +566,18 @@ msgid "Time (ms) before showing (100 is default)" msgstr "Tiempo (ms) antes de mostrar (100 por defecto)" #: Settings.ui.h:64 -#, fuzzy msgid "Animation time (ms)" msgstr "Tiempo de la animación (ms)" #: Settings.ui.h:65 -#, fuzzy msgid "Time (ms) before hiding (100 is default)" msgstr "Tiempo (ms) antes de ocultar (100 por defecto)" #: Settings.ui.h:66 -#, fuzzy msgid "Immediate on application icon click" msgstr "Pulsación inmediata en icono de aplicación" #: Settings.ui.h:67 -#, fuzzy msgid "Middle click on the preview to close the window" msgstr "Usar el botón central en la vista rápida para cerrar la ventana" @@ -608,12 +586,10 @@ msgid "Window previews preferred size (px)" msgstr "Tamaño por defecto de las vistas rápidas (px)" #: Settings.ui.h:69 -#, fuzzy msgid "Window previews aspect ratio Y (height)" msgstr "Altura de la vista rápida de ventanas" #: Settings.ui.h:70 -#, fuzzy msgid "Window previews padding (px)" msgstr "Relleno (px) de la vista rápida de ventanas" @@ -706,7 +682,6 @@ msgid "Fixed" msgstr "" #: Settings.ui.h:93 -#, fuzzy msgid "Window previews aspect ratio X (width)" msgstr "Anchura de la vista rápida de ventanas" @@ -731,22 +706,18 @@ msgid "Top" msgstr "Arriba" #: Settings.ui.h:99 -#, fuzzy msgid "Display window preview headers" msgstr "Mostrar los títulos de las ventanas en las vistas rápidas" #: Settings.ui.h:100 -#, fuzzy msgid "Font size (px) of the preview titles" msgstr "Tamaño de letra (px) de los títulos de aplicación (14 por defecto)" #: Settings.ui.h:101 -#, fuzzy msgid "Font weight of the preview titles" msgstr "Color de letra de los títulos de aplicación" #: Settings.ui.h:102 -#, fuzzy msgid "Font color of the preview titles" msgstr "Color de letra de los títulos de aplicación" @@ -853,7 +824,6 @@ msgid "Shortcut to show the overlay for 2 seconds" msgstr "Atajo para mostrar el número de aplicación por 2 segundos" #: Settings.ui.h:125 -#, fuzzy msgid "Show window previews on hotkey" msgstr "Mostrar vista rápida de ventanas al pasar con el ratón" @@ -862,7 +832,6 @@ msgid "Show previews when the application have multiple instances" msgstr "Mostrar vistas previas cuando la aplicación tiene múltiples instancias" #: Settings.ui.h:127 -#, fuzzy msgid "Number row" msgstr "Fila numérica" @@ -875,7 +844,6 @@ msgid "Both" msgstr "Ambos" #: Settings.ui.h:130 -#, fuzzy msgid "Hotkeys are activated with" msgstr "Usar atajos de teclado para activar aplicaciones" @@ -896,7 +864,6 @@ msgid "Custom Show Applications image icon" msgstr "Icono Mostrar aplicaciones personalizado" #: Settings.ui.h:135 -#, fuzzy msgid "Show Applications icon side padding (px)" msgstr "Tamaño de relleno (px) de Mostrar aplicaciones" @@ -905,12 +872,10 @@ msgid "Reveal the desktop when hovering the Show Desktop button" msgstr "Mostrar escritorio al colocar el botón Mostrar Escritorio" #: Settings.ui.h:137 -#, fuzzy msgid "Delay before revealing the desktop (ms)" msgstr "Tiempo antes de ocultar el panel (ms)" #: Settings.ui.h:138 -#, fuzzy msgid "Fade duration (ms)" msgstr "Tiempo de ocultación (ms)" @@ -928,7 +893,6 @@ msgid "Change opacity to (%)" msgstr "Cambiar la opacidad a (%)" #: Settings.ui.h:143 -#, fuzzy msgid "Opacity change animation duration (ms)" msgstr "Duración de las animaciones (ms)" @@ -969,7 +933,6 @@ msgid "Hide and reveal the panel according to preferences" msgstr "Ocultar y mostrar el panel de acuerdo con las preferencias" #: Settings.ui.h:153 -#, fuzzy msgid "Position" msgstr "Posición" @@ -1081,7 +1044,6 @@ msgid "Show favorite applications" msgstr "Mostrar aplicaciones favoritas" #: Settings.ui.h:183 -#, fuzzy msgid "Show running applications" msgstr "Mostrar aplicaciones en ejecución" @@ -1116,7 +1078,6 @@ msgid "Show window previews on hover" msgstr "Mostrar vista rápida de ventanas al pasar con el ratón" #: Settings.ui.h:191 -#, fuzzy msgid "Show tooltip on hover" msgstr "Mostrar barra de herramientas al pasar con el ratón" @@ -1141,7 +1102,6 @@ msgid "Click action" msgstr "Acción de pulsación" #: Settings.ui.h:197 -#, fuzzy msgid "Toggle windows" msgstr "Alternar ventanas" @@ -1154,12 +1114,10 @@ msgid "Behavior when mouse scrolling over the panel." msgstr "Comportamiento cuando el ratón de desplaza en el panel" #: Settings.ui.h:200 -#, fuzzy msgid "Scroll icon action" msgstr "Acción al desplazar iconos" #: Settings.ui.h:201 -#, fuzzy msgid "Behavior when mouse scrolling over an application icon." msgstr "Comportamiento cuando el ratón se desplaza sobre el icono de una aplicación" @@ -1172,7 +1130,6 @@ msgid "Switch workspace" msgstr "Cambiar espacio de trabajo" #: Settings.ui.h:204 -#, fuzzy msgid "Cycle windows" msgstr "Alternar entre ventanas" From 602f5cf6938866b577a1ce2a93915d1b3c9a67ef Mon Sep 17 00:00:00 2001 From: Charles Gagnon Date: Fri, 1 May 2020 16:46:04 -0400 Subject: [PATCH 02/15] Use fixed label widths if possible when apps are ungrouped --- appIcons.js | 20 ++++++++++++++++++-- taskbar.js | 45 +++++++++++++++++++++++++++++++++------------ 2 files changed, 51 insertions(+), 14 deletions(-) diff --git a/appIcons.js b/appIcons.js index 3347de4..bb1a119 100644 --- a/appIcons.js +++ b/appIcons.js @@ -62,6 +62,7 @@ const T6 = 'displayProperIndicatorTimeout'; let LABEL_GAP = 5; let MAX_INDICATORS = 4; var DEFAULT_PADDING_SIZE = 4; +var titleRightPadding = -1; let DOT_STYLE = { DOTS: "DOTS", @@ -340,6 +341,10 @@ var taskbarAppIcon = Utils.defineClass({ } }, + updateTitleWidth: function(forceDynamicTitleWidth) { + this._updateWindowTitleStyle(forceDynamicTitleWidth); + }, + // Update indicator and target for minimization animation updateIcon: function() { @@ -464,17 +469,19 @@ var taskbarAppIcon = Utils.defineClass({ this._displayProperIndicator(true); }, - _updateWindowTitleStyle: function() { + _updateWindowTitleStyle: function(forceDynamicTitleWidth) { if (this._windowTitle) { let useFixedWidth = Me.settings.get_boolean('group-apps-use-fixed-width'); + let fontWeight = Me.settings.get_string('group-apps-label-font-weight'); let maxLabelWidth = Me.settings.get_int('group-apps-label-max-width') * St.ThemeContext.get_for_stage(global.stage).scale_factor; - let fontWeight = Me.settings.get_string('group-apps-label-font-weight'); this._windowTitle[(maxLabelWidth > 0 ? 'show' : 'hide')](); this._windowTitle.clutter_text.natural_width = useFixedWidth ? maxLabelWidth : 0; this._windowTitle.clutter_text.natural_width_set = useFixedWidth; + this._windowTitle.set_width(!useFixedWidth || forceDynamicTitleWidth ? -1 : maxLabelWidth + this._getWindowTitleRightPadding()); + this._windowTitle.set_style('font-size: ' + Me.settings.get_int('group-apps-label-font-size') + 'px;' + 'font-weight: ' + fontWeight + ';' + (useFixedWidth ? '' : 'max-width: ' + maxLabelWidth + 'px;') + @@ -482,6 +489,15 @@ var taskbarAppIcon = Utils.defineClass({ } }, + _getWindowTitleRightPadding: function() { + if (this._windowTitle && this._windowTitle.mapped && titleRightPadding < 0) { + //get the right padding defined for .overview-label in stylesheet.css + titleRightPadding = this._windowTitle.get_theme_node().get_padding(St.Side.RIGHT); + } + + return titleRightPadding; + }, + _updateWindowTitle: function() { if (this._windowTitle.text != this.window.title) { this._windowTitle.text = (this.window.title ? this.window.title : this.app.get_name()).replace(/\r?\n|\r/g, '').trim(); diff --git a/taskbar.js b/taskbar.js index b42c8e2..abc84d4 100644 --- a/taskbar.js +++ b/taskbar.js @@ -93,7 +93,7 @@ var taskbarActor = Utils.defineClass({ let [, showAppsNatSize] = showAppsButton[Panel.sizeFunc](availFixedSize); let [, natSize] = this[Panel.sizeFunc](availFixedSize); let childBox = new Clutter.ActorBox(); - let orientation = Panel.getOrientation().toLowerCase(); + let orientation = Panel.getOrientation(); childBox[Panel.varCoord.c1] = box[Panel.varCoord.c1]; childBox[Panel.fixedCoord.c1] = box[Panel.fixedCoord.c1]; @@ -106,9 +106,9 @@ var taskbarActor = Utils.defineClass({ childBox[Panel.varCoord.c2] = Math.min(availVarSize, natSize); scrollview.allocate(childBox, flags); - let [hvalue, , hupper, , , hpageSize] = scrollview[orientation[0] + 'scroll'].adjustment.get_values(); - hupper = Math.floor(hupper); - scrollview._dtpFadeSize = hupper > hpageSize ? this._delegate.iconSize : 0; + let [value, , upper, , , pageSize] = scrollview[orientation[0] + 'scroll'].adjustment.get_values(); + upper = Math.floor(upper); + scrollview._dtpFadeSize = upper > pageSize ? this._delegate.iconSize : 0; if (this._currentBackgroundColor !== this._delegate.dtpPanel.dynamicTransparency.currentBackgroundColor) { this._currentBackgroundColor = this._delegate.dtpPanel.dynamicTransparency.currentBackgroundColor; @@ -120,10 +120,10 @@ var taskbarActor = Utils.defineClass({ } childBox[Panel.varCoord.c1] = box[Panel.varCoord.c1] + showAppsNatSize; - childBox[Panel.varCoord.c2] = childBox[Panel.varCoord.c1] + (hvalue > 0 ? scrollview._dtpFadeSize : 0); + childBox[Panel.varCoord.c2] = childBox[Panel.varCoord.c1] + (value > 0 ? scrollview._dtpFadeSize : 0); leftFade.allocate(childBox, flags); - childBox[Panel.varCoord.c1] = box[Panel.varCoord.c2] - (hvalue + hpageSize < hupper ? scrollview._dtpFadeSize : 0); + childBox[Panel.varCoord.c1] = box[Panel.varCoord.c2] - (value + pageSize < upper ? scrollview._dtpFadeSize : 0); childBox[Panel.varCoord.c2] = box[Panel.varCoord.c2]; rightFade.allocate(childBox, flags); }, @@ -217,7 +217,8 @@ var taskbar = Utils.defineClass({ this._container.add_actor(this._showAppsIcon); this._container.add_actor(this._scrollView); - let fadeStyle = 'background-gradient-direction:' + Panel.getOrientation(); + let orientation = Panel.getOrientation(); + let fadeStyle = 'background-gradient-direction:' + orientation; let fade1 = new St.Widget({ style_class: 'scrollview-fade', reactive: false }); let fade2 = new St.Widget({ style_class: 'scrollview-fade', reactive: false, @@ -241,11 +242,31 @@ var taskbar = Utils.defineClass({ y_align: St.Align.START, x_align:rtl?St.Align.END:St.Align.START }); - // Update minimization animation target position on allocation of the - // container and on scrollview change. - this._box.connect('notify::allocation', Lang.bind(this, this._updateAppIcons)); - let scrollViewAdjustment = this._scrollView.hscroll.adjustment; - scrollViewAdjustment.connect('notify::value', Lang.bind(this, this._updateAppIcons)); + let adjustment = this._scrollView[orientation[0] + 'scroll'].adjustment; + let fullScrollView = 0; + + adjustment.connect('notify::upper', () => { + // Update minimization animation target position on scrollview change. + this._updateAppIcons(); + + // When applications are ungrouped and there is some empty space on the horizontal taskbar, + // force a fixed label width to prevent the icons from "wiggling" when an animation runs + // (adding or removing an icon). When the taskbar is full, revert to a dynamic label width + // to allow them to resize and make room for new icons. + if (!isVertical && !this.isGroupApps) { + let initial = fullScrollView; + + if (!fullScrollView && Math.floor(adjustment.upper) > adjustment.page_size) { + fullScrollView = adjustment.page_size; + } else if (adjustment.page_size < fullScrollView) { + fullScrollView = 0; + } + + if (initial != fullScrollView) { + this._getAppIcons().forEach(a => a.updateTitleWidth(fullScrollView)); + } + } + }); this._workId = Main.initializeDeferredWork(this._box, Lang.bind(this, this._redisplay)); From d878987d489b302bae0a437c5da6f37e41466230 Mon Sep 17 00:00:00 2001 From: Charles Gagnon Date: Fri, 1 May 2020 17:40:55 -0400 Subject: [PATCH 03/15] Add option to override escape key for Show Applications --- Settings.ui | 48 +++++++++++++++++++ panelManager.js | 3 +- prefs.js | 5 ++ ...shell.extensions.dash-to-panel.gschema.xml | 5 ++ taskbar.js | 14 ++++++ 5 files changed, 74 insertions(+), 1 deletion(-) diff --git a/Settings.ui b/Settings.ui index 5a702bd..6ef61c8 100644 --- a/Settings.ui +++ b/Settings.ui @@ -3936,6 +3936,54 @@ 1 + + + True + True + + + True + False + 12 + 12 + 12 + 12 + 32 + + + True + True + end + center + + + 1 + 0 + + + + + True + False + True + Override escape key and return to desktop + True + 0 + + + 0 + 0 + + + + + + + False + True + 2 + + 5000 diff --git a/panelManager.js b/panelManager.js index f9abcae..8f97e49 100755 --- a/panelManager.js +++ b/panelManager.js @@ -355,8 +355,9 @@ var dtpPanelManager = Utils.defineClass({ }, setFocusedMonitor: function(monitor, ignoreRelayout) { + this._needsIconAllocate = 1; + if (!this.checkIfFocusedMonitor(monitor)) { - this._needsIconAllocate = 1; Main.overview.viewSelector._workspacesDisplay._primaryIndex = monitor.index; Main.overview._overview.clear_constraints(); diff --git a/prefs.js b/prefs.js index 87dda60..12ec2f3 100644 --- a/prefs.js +++ b/prefs.js @@ -937,6 +937,7 @@ const Settings = new Lang.Class({ // restore default settings this._settings.set_value('show-apps-icon-side-padding', this._settings.get_default_value('show-apps-icon-side-padding')); this._builder.get_object('show_applications_side_padding_spinbutton').set_value(this._settings.get_int('show-apps-icon-side-padding')); + this._settings.set_value('show-apps-override-escape', this._settings.get_default_value('show-apps-override-escape')); handleIconChange.call(this, null); } else { // remove the settings box so it doesn't get destroyed; @@ -957,6 +958,10 @@ const Settings = new Lang.Class({ this._builder.get_object('application_button_animation_button'), 'sensitive', Gio.SettingsBindFlags.DEFAULT); + this._settings.bind('show-apps-override-escape', + this._builder.get_object('show_applications_esc_key_switch'), + 'active', + Gio.SettingsBindFlags.DEFAULT); this._settings.bind('show-activities-button', this._builder.get_object('show_activities_button_switch'), 'active', 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 461cf62..dd6b8ab 100644 --- a/schemas/org.gnome.shell.extensions.dash-to-panel.gschema.xml +++ b/schemas/org.gnome.shell.extensions.dash-to-panel.gschema.xml @@ -367,6 +367,11 @@ Show Applications icon side padding Customize the Show Applications icon side padding + + true + Override escape key + Override the escape key to return to the desktop when entering the overview using the Show Applications button + true Animate Show Applications from the desktop diff --git a/taskbar.js b/taskbar.js index abc84d4..50d1914 100644 --- a/taskbar.js +++ b/taskbar.js @@ -1112,6 +1112,19 @@ var taskbar = Utils.defineClass({ }); if (this.showAppsButton.checked) { + if (Me.settings.get_boolean('show-apps-override-escape')) { + //override escape key to return to the desktop when entering the overview using the showapps button + Main.overview.viewSelector._onStageKeyPress = function(actor, event) { + if (Main.modalCount == 1 && event.get_key_symbol() === Clutter.KEY_Escape) { + this._searchActive ? this.reset() : Main.overview.hide(); + + return Clutter.EVENT_STOP; + } + + return this.__proto__._onStageKeyPress.call(this, actor, event); + }; + } + // force spring animation triggering.By default the animation only // runs if we are already inside the overview. if (!Main.overview._shown) { @@ -1156,6 +1169,7 @@ var taskbar = Utils.defineClass({ let overviewHiddenId = Main.overview.connect('hidden', () => { Main.overview.disconnect(overviewHiddenId); this.dtpPanel.panelManager.setFocusedMonitor(this.dtpPanel.panelManager.primaryPanel.monitor, true); + delete Main.overview.viewSelector._onStageKeyPress; }); // Finally show the overview From ff923c75d93afb6e603e73d74cae00457821e5d4 Mon Sep 17 00:00:00 2001 From: Charles Gagnon Date: Fri, 1 May 2020 18:56:26 -0400 Subject: [PATCH 04/15] Use signalshandler for adjustment signal --- taskbar.js | 38 +++++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/taskbar.js b/taskbar.js index 50d1914..cac0cbe 100644 --- a/taskbar.js +++ b/taskbar.js @@ -245,28 +245,32 @@ var taskbar = Utils.defineClass({ let adjustment = this._scrollView[orientation[0] + 'scroll'].adjustment; let fullScrollView = 0; - adjustment.connect('notify::upper', () => { - // Update minimization animation target position on scrollview change. - this._updateAppIcons(); + this._signalsHandler.add([ + adjustment, + 'notify::upper', + () => { + // Update minimization animation target position on scrollview change. + this._updateAppIcons(); - // When applications are ungrouped and there is some empty space on the horizontal taskbar, - // force a fixed label width to prevent the icons from "wiggling" when an animation runs - // (adding or removing an icon). When the taskbar is full, revert to a dynamic label width - // to allow them to resize and make room for new icons. - if (!isVertical && !this.isGroupApps) { - let initial = fullScrollView; + // When applications are ungrouped and there is some empty space on the horizontal taskbar, + // force a fixed label width to prevent the icons from "wiggling" when an animation runs + // (adding or removing an icon). When the taskbar is full, revert to a dynamic label width + // to allow them to resize and make room for new icons. + if (!isVertical && !this.isGroupApps) { + let initial = fullScrollView; - if (!fullScrollView && Math.floor(adjustment.upper) > adjustment.page_size) { - fullScrollView = adjustment.page_size; - } else if (adjustment.page_size < fullScrollView) { - fullScrollView = 0; - } + if (!fullScrollView && Math.floor(adjustment.upper) > adjustment.page_size) { + fullScrollView = adjustment.page_size; + } else if (adjustment.page_size < fullScrollView) { + fullScrollView = 0; + } - if (initial != fullScrollView) { - this._getAppIcons().forEach(a => a.updateTitleWidth(fullScrollView)); + if (initial != fullScrollView) { + this._getAppIcons().forEach(a => a.updateTitleWidth(fullScrollView)); + } } } - }); + ]); this._workId = Main.initializeDeferredWork(this._box, Lang.bind(this, this._redisplay)); From f8560cd19074988cea3753e4ff00678f55738934 Mon Sep 17 00:00:00 2001 From: Charles Gagnon Date: Fri, 1 May 2020 19:24:26 -0400 Subject: [PATCH 05/15] Use taskbar property to indicate a full scrollview --- appIcons.js | 9 ++++---- taskbar.js | 66 ++++++++++++++++++++++++----------------------------- 2 files changed, 35 insertions(+), 40 deletions(-) diff --git a/appIcons.js b/appIcons.js index bb1a119..088cf68 100644 --- a/appIcons.js +++ b/appIcons.js @@ -341,8 +341,8 @@ var taskbarAppIcon = Utils.defineClass({ } }, - updateTitleWidth: function(forceDynamicTitleWidth) { - this._updateWindowTitleStyle(forceDynamicTitleWidth); + updateTitleStyle: function() { + this._updateWindowTitleStyle(); }, // Update indicator and target for minimization animation @@ -469,9 +469,10 @@ var taskbarAppIcon = Utils.defineClass({ this._displayProperIndicator(true); }, - _updateWindowTitleStyle: function(forceDynamicTitleWidth) { + _updateWindowTitleStyle: function() { if (this._windowTitle) { let useFixedWidth = Me.settings.get_boolean('group-apps-use-fixed-width'); + let variableWidth = !useFixedWidth || this.dtpPanel.taskbar.fullScrollView; let fontWeight = Me.settings.get_string('group-apps-label-font-weight'); let maxLabelWidth = Me.settings.get_int('group-apps-label-max-width') * St.ThemeContext.get_for_stage(global.stage).scale_factor; @@ -480,7 +481,7 @@ var taskbarAppIcon = Utils.defineClass({ this._windowTitle.clutter_text.natural_width = useFixedWidth ? maxLabelWidth : 0; this._windowTitle.clutter_text.natural_width_set = useFixedWidth; - this._windowTitle.set_width(!useFixedWidth || forceDynamicTitleWidth ? -1 : maxLabelWidth + this._getWindowTitleRightPadding()); + this._windowTitle.set_width(variableWidth ? -1 : maxLabelWidth + this._getWindowTitleRightPadding()); this._windowTitle.set_style('font-size: ' + Me.settings.get_int('group-apps-label-font-size') + 'px;' + 'font-weight: ' + fontWeight + ';' + diff --git a/taskbar.js b/taskbar.js index cac0cbe..7d37b9e 100644 --- a/taskbar.js +++ b/taskbar.js @@ -175,6 +175,7 @@ var taskbar = Utils.defineClass({ this._resetHoverTimeoutId = 0; this._ensureAppIconVisibilityTimeoutId = 0; this._labelShowing = false; + this.fullScrollView = 0; let isVertical = Panel.checkIfVertical(); @@ -243,35 +244,7 @@ var taskbar = Utils.defineClass({ }); let adjustment = this._scrollView[orientation[0] + 'scroll'].adjustment; - let fullScrollView = 0; - - this._signalsHandler.add([ - adjustment, - 'notify::upper', - () => { - // Update minimization animation target position on scrollview change. - this._updateAppIcons(); - - // When applications are ungrouped and there is some empty space on the horizontal taskbar, - // force a fixed label width to prevent the icons from "wiggling" when an animation runs - // (adding or removing an icon). When the taskbar is full, revert to a dynamic label width - // to allow them to resize and make room for new icons. - if (!isVertical && !this.isGroupApps) { - let initial = fullScrollView; - - if (!fullScrollView && Math.floor(adjustment.upper) > adjustment.page_size) { - fullScrollView = adjustment.page_size; - } else if (adjustment.page_size < fullScrollView) { - fullScrollView = 0; - } - - if (initial != fullScrollView) { - this._getAppIcons().forEach(a => a.updateTitleWidth(fullScrollView)); - } - } - } - ]); - + this._workId = Main.initializeDeferredWork(this._box, Lang.bind(this, this._redisplay)); this._settings = new Gio.Settings({ schema_id: 'org.gnome.shell' }); @@ -382,6 +355,32 @@ var taskbar = Utils.defineClass({ 'changed::taskbar-locked' ], () => this.resetAppIcons() + ], + [ + adjustment, + 'notify::upper', + () => { + // Update minimization animation target position on scrollview change. + this._updateAppIcons(); + + // When applications are ungrouped and there is some empty space on the horizontal taskbar, + // force a fixed label width to prevent the icons from "wiggling" when an animation runs + // (adding or removing an icon). When the taskbar is full, revert to a dynamic label width + // to allow them to resize and make room for new icons. + if (!isVertical && !this.isGroupApps) { + let initial = this.fullScrollView; + + if (!this.fullScrollView && Math.floor(adjustment.upper) > adjustment.page_size) { + this.fullScrollView = adjustment.page_size; + } else if (adjustment.page_size < this.fullScrollView) { + this.fullScrollView = 0; + } + + if (initial != this.fullScrollView) { + this._getAppIcons().forEach(a => a.updateTitleStyle()); + } + } + } ] ); @@ -405,12 +404,7 @@ var taskbar = Utils.defineClass({ _onScrollEvent: function(actor, event) { - // Event coordinates are relative to the stage but can be transformed - // as the actor will only receive events within his bounds. - let stage_x, stage_y, ok, event_x, event_y, actor_w, actor_h; - [stage_x, stage_y] = event.get_coords(); - [ok, event_x, event_y] = actor.transform_stage_point(stage_x, stage_y); - [actor_w, actor_h] = actor.get_size(); + let orientation = Panel.getOrientation(); // reset timeout to avid conflicts with the mousehover event if (this._ensureAppIconVisibilityTimeoutId>0) { @@ -424,7 +418,7 @@ var taskbar = Utils.defineClass({ let adjustment, delta; - adjustment = this._scrollView.get_hscroll_bar().get_adjustment(); + adjustment = this._scrollView[orientation[0] + 'scroll'].get_adjustment(); let increment = adjustment.step_increment; From 0013f5154f749b95484615f08d89728d66b9c1d5 Mon Sep 17 00:00:00 2001 From: Charles Gagnon Date: Sat, 2 May 2020 12:57:21 -0400 Subject: [PATCH 06/15] Add option to keep gnome-shell top panel --- Settings.ui | 77 ++++++++++----- intellihide.js | 2 +- panel.js | 99 +++++++++++-------- panelManager.js | 40 ++++---- prefs.js | 33 ++++++- ...shell.extensions.dash-to-panel.gschema.xml | 5 + taskbar.js | 4 +- 7 files changed, 164 insertions(+), 96 deletions(-) diff --git a/Settings.ui b/Settings.ui index 6ef61c8..523235a 100644 --- a/Settings.ui +++ b/Settings.ui @@ -7392,31 +7392,6 @@ 0 - - - True - False - True - Activate panel menu buttons (e.g. date menu) on click only - 0 - - - 0 - 1 - - - - - True - True - end - center - - - 1 - 1 - - True @@ -7427,7 +7402,7 @@ 0 - 2 + 3 @@ -7439,9 +7414,59 @@ 1 + 3 + + + + + True + False + True + Activate panel menu buttons (e.g. date menu) on click only + 0 + + + 0 2 + + + True + True + end + center + + + 1 + 2 + + + + + True + False + True + Keep original gnome-shell top panel + 0 + + + 0 + 1 + + + + + True + True + end + center + + + 1 + 1 + + diff --git a/intellihide.js b/intellihide.js index e99e108..c4c9c97 100644 --- a/intellihide.js +++ b/intellihide.js @@ -157,7 +157,7 @@ var Intellihide = Utils.defineClass({ _changeEnabledStatus: function() { let intellihide = Me.settings.get_boolean('intellihide'); let onlySecondary = Me.settings.get_boolean('intellihide-only-secondary'); - let enabled = intellihide && (this._dtpPanel.isSecondary || !onlySecondary); + let enabled = intellihide && !(this._dtpPanel.isPrimary && onlySecondary); if (this.enabled !== enabled) { this[enabled ? 'enable' : 'disable'](); diff --git a/panel.js b/panel.js index c126197..98416db 100644 --- a/panel.js +++ b/panel.js @@ -117,7 +117,7 @@ var dtpPanel = Utils.defineClass({ Name: 'DashToPanel-Panel', Extends: St.Widget, - _init: function(panelManager, monitor, panelBox, isSecondary) { + _init: function(panelManager, monitor, panelBox, isStandalone) { let position = getPosition(); this.callParent('_init', { layout_manager: new Clutter.BinLayout() }); @@ -130,11 +130,18 @@ var dtpPanel = Utils.defineClass({ this.monitor = monitor; this.panelBox = panelBox; - this.isSecondary = isSecondary; + + // when the original gnome-shell top panel is kept, all panels are "standalone", + // so in this case use isPrimary to get the panel on the primary dtp monitor, which + // might be different from the system's primary monitor. + this.isStandalone = isStandalone; + this.isPrimary = !isStandalone || (Me.settings.get_boolean('stockgs-keep-top-panel') && + monitor == panelManager.dtpPrimaryMonitor); + this._sessionStyle = null; this._unmappedButtons = []; - if (isSecondary) { + if (isStandalone) { this.panel = new St.Widget({ name: 'panel', reactive: true }); this.statusArea = this.panel.statusArea = {}; @@ -185,7 +192,7 @@ var dtpPanel = Utils.defineClass({ Utils.wrapActor(this.panel._leftCorner); Utils.wrapActor(this.panel._rightCorner); - if (isSecondary) { + if (isStandalone) { this.panel.add_child(this.panel._leftCorner.actor); this.panel.add_child(this.panel._rightCorner.actor); } @@ -254,7 +261,7 @@ var dtpPanel = Utils.defineClass({ this._setPanelPosition(); - if (!this.isSecondary) { + if (!this.isStandalone) { if (this.panel.vfunc_allocate) { this._panelConnectId = 0; Utils.hookVfunc(this.panel.__proto__, 'allocate', (box, flags) => this._mainPanelAllocate(0, box, flags)); @@ -438,14 +445,13 @@ var dtpPanel = Utils.defineClass({ this._dateMenuIndicatorPadContraints.forEach(c => indicatorPad.add_constraint(c)); } - if (!this.isSecondary) { + this._setVertical(this.panel.actor, false); + + if (!this.isStandalone) { this.statusArea.dateMenu._clockDisplay.text = this.statusArea.dateMenu._clock.clock; - this._setVertical(this.panel.actor, false); - ['vertical', 'horizontal', 'dashtopanelMainPanel'].forEach(c => this.panel.actor.remove_style_class_name(c)); - if(!Main.sessionMode.isLocked) { this._setActivitiesButtonVisible(true); this._setClockLocation("BUTTONSLEFT"); @@ -658,11 +664,16 @@ var dtpPanel = Utils.defineClass({ let lrPadding = panelBoxTheme.get_padding(St.Side.RIGHT) + panelBoxTheme.get_padding(St.Side.LEFT); let tbPadding = panelBoxTheme.get_padding(St.Side.TOP) + panelBoxTheme.get_padding(St.Side.BOTTOM); let position = getPosition(); + let gsTopPanelOffset = 0; let x = 0, y = 0; let w = 0, h = 0; size = Me.settings.get_int('panel-size') * scaleFactor; + if (Me.settings.get_boolean('stockgs-keep-top-panel') && Main.layoutManager.primaryMonitor == this.monitor) { + gsTopPanelOffset = Main.layoutManager.panelBox.height; + } + if (checkIfVertical()) { if (!Me.settings.get_boolean('group-apps')) { // add window title width and side padding of _dtpIconContainer when vertical @@ -674,7 +685,7 @@ var dtpPanel = Utils.defineClass({ varCoord = { c1: 'y1', c2: 'y2' }; w = size; - h = this.monitor.height - tbPadding; + h = this.monitor.height - tbPadding - gsTopPanelOffset; } else { sizeFunc = 'get_preferred_width'; fixedCoord = { c1: 'y1', c2: 'y2' }; @@ -686,10 +697,10 @@ var dtpPanel = Utils.defineClass({ if (position == St.Side.TOP || position == St.Side.LEFT) { x = this.monitor.x; - y = this.monitor.y; + y = this.monitor.y + gsTopPanelOffset; } else if (position == St.Side.RIGHT) { x = this.monitor.x + this.monitor.width - size - lrPadding; - y = this.monitor.y; + y = this.monitor.y + gsTopPanelOffset; } else { //BOTTOM x = this.monitor.x; y = this.monitor.y + this.monitor.height - size - tbPadding; @@ -970,41 +981,43 @@ var dtpPanel = Utils.defineClass({ _formatVerticalClock: function() { // https://github.com/GNOME/gnome-desktop/blob/master/libgnome-desktop/gnome-wall-clock.c#L310 - let datetime = this.statusArea.dateMenu._clock.clock; - let datetimeParts = datetime.split(' '); - let time = datetimeParts[1]; - let clockText = this.statusArea.dateMenu._clockDisplay.clutter_text; - let setClockText = text => { - let stacks = text instanceof Array; - let separator = '\n‧‧\n'; - - clockText.set_text((stacks ? text.join(separator) : text).trim()); - clockText.set_use_markup(stacks); - clockText.get_allocation_box(); - - return !clockText.get_layout().is_ellipsized(); - }; + if (this.statusArea.dateMenu) { + let datetime = this.statusArea.dateMenu._clock.clock; + let datetimeParts = datetime.split(' '); + let time = datetimeParts[1]; + let clockText = this.statusArea.dateMenu._clockDisplay.clutter_text; + let setClockText = text => { + let stacks = text instanceof Array; + let separator = '\n‧‧\n'; + + clockText.set_text((stacks ? text.join(separator) : text).trim()); + clockText.set_use_markup(stacks); + clockText.get_allocation_box(); + + return !clockText.get_layout().is_ellipsized(); + }; - if (!time) { - datetimeParts = datetime.split(' '); - time = datetimeParts.pop(); - datetimeParts = [datetimeParts.join(' '), time]; - } - - if (!setClockText(datetime) && - !setClockText(datetimeParts) && - !setClockText(time)) { - let timeParts = time.split('∶'); - - if (!this._clockFormat) { - this._clockFormat = Me.desktopSettings.get_string('clock-format'); + if (!time) { + datetimeParts = datetime.split(' '); + time = datetimeParts.pop(); + datetimeParts = [datetimeParts.join(' '), time]; } - if (this._clockFormat == '12h') { - timeParts.push.apply(timeParts, timeParts.pop().split(' ')); - } + if (!setClockText(datetime) && + !setClockText(datetimeParts) && + !setClockText(time)) { + let timeParts = time.split('∶'); - setClockText(timeParts); + if (!this._clockFormat) { + this._clockFormat = Me.desktopSettings.get_string('clock-format'); + } + + if (this._clockFormat == '12h') { + timeParts.push.apply(timeParts, timeParts.pop().split(' ')); + } + + setClockText(timeParts); + } } }, diff --git a/panelManager.js b/panelManager.js index 8f97e49..ee8dea8 100755 --- a/panelManager.js +++ b/panelManager.js @@ -70,20 +70,19 @@ var dtpPanelManager = Utils.defineClass({ if(dtpPrimaryIndex < 0 || dtpPrimaryIndex >= Main.layoutManager.monitors.length) dtpPrimaryIndex = Main.layoutManager.primaryIndex; - let dtpPrimaryMonitor = Main.layoutManager.monitors[dtpPrimaryIndex]; - + this.dtpPrimaryMonitor = Main.layoutManager.monitors[dtpPrimaryIndex]; this.proximityManager = new Proximity.ProximityManager(); Utils.wrapActor(Main.panel); Utils.wrapActor(Main.overview.dash || 0); - this.primaryPanel = this._createPanel(dtpPrimaryMonitor); + this.primaryPanel = this._createPanel(this.dtpPrimaryMonitor, Me.settings.get_boolean('stockgs-keep-top-panel')); this.allPanels = [ this.primaryPanel ]; this.overview.enable(this.primaryPanel); if (Me.settings.get_boolean('multi-monitors')) { - Main.layoutManager.monitors.filter(m => m != dtpPrimaryMonitor).forEach(m => { + Main.layoutManager.monitors.filter(m => m != this.dtpPrimaryMonitor).forEach(m => { this.allPanels.push(this._createPanel(m, true)); }); } @@ -96,8 +95,8 @@ var dtpPanelManager = Utils.defineClass({ let leftOrRight = (panelPosition == St.Side.LEFT || panelPosition == St.Side.RIGHT); p.panelBox.set_size( - leftOrRight ? -1 : p.monitor.width, - leftOrRight ? p.monitor.height : -1 + leftOrRight ? -1 : p.geom.w, + leftOrRight ? p.geom.h : -1 ); this._findPanelMenuButtons(p.panelBox).forEach(pmb => this._adjustPanelMenuButton(pmb, p.monitor, panelPosition)); @@ -116,7 +115,7 @@ var dtpPanelManager = Utils.defineClass({ }); } - this.setFocusedMonitor(dtpPrimaryMonitor); + this.setFocusedMonitor(this.dtpPrimaryMonitor); if (Panel.checkIfVertical()) { Main.wm._getPositionForDirection = newGetPositionForDirection; @@ -231,7 +230,8 @@ var dtpPanelManager = Utils.defineClass({ 'changed::multi-monitors', 'changed::isolate-monitors', 'changed::taskbar-position', - 'changed::panel-position' + 'changed::panel-position', + 'changed::stockgs-keep-top-panel' ], () => this._reset() ], @@ -282,7 +282,7 @@ var dtpPanelManager = Utils.defineClass({ Main.layoutManager._untrackActor(p.panelBox); Main.layoutManager.removeChrome(clipContainer); - if (p.isSecondary) { + if (p.isStandalone) { p.panelBox.destroy(); } else { p.panelBox.remove_child(p); @@ -302,17 +302,17 @@ var dtpPanelManager = Utils.defineClass({ delete Main.wm._getPositionForDirection; + if (Main.layoutManager.primaryMonitor) { + Main.layoutManager.panelBox.set_position(Main.layoutManager.primaryMonitor.x, Main.layoutManager.primaryMonitor.y); + Main.layoutManager.panelBox.set_size(Main.layoutManager.primaryMonitor.width, -1); + } + if (reset) return; this._setKeyBindings(false); this._signalsHandler.destroy(); - if (Main.layoutManager.primaryMonitor) { - Main.layoutManager.panelBox.set_position(Main.layoutManager.primaryMonitor.x, Main.layoutManager.primaryMonitor.y); - Main.layoutManager.panelBox.set_size(Main.layoutManager.primaryMonitor.width, -1); - } - Main.layoutManager._updateHotCorners = this._oldUpdateHotCorners; Main.layoutManager._updateHotCorners(); @@ -373,12 +373,12 @@ var dtpPanelManager = Utils.defineClass({ return Main.overview.viewSelector._workspacesDisplay._primaryIndex == monitor.index; }, - _createPanel: function(monitor, isSecondary) { + _createPanel: function(monitor, isStandalone) { let panelBox; let panel; let clipContainer = new Clutter.Actor(); - if (isSecondary) { + if (isStandalone) { panelBox = new St.BoxLayout({ name: 'panelBox' }); } else { panelBox = Main.layoutManager.panelBox; @@ -391,7 +391,7 @@ var dtpPanelManager = Utils.defineClass({ clipContainer.add_child(panelBox); Main.layoutManager.trackChrome(panelBox, { trackFullscreen: true, affectsStruts: true, affectsInputRegion: true }); - panel = new Panel.dtpPanel(this, monitor, panelBox, isSecondary); + panel = new Panel.dtpPanel(this, monitor, panelBox, isStandalone); panelBox.add(panel); panel.enable(); @@ -454,7 +454,7 @@ var dtpPanelManager = Utils.defineClass({ }, _removePanelBarriers: function(panel) { - if (panel.isSecondary && panel._rightPanelBarrier) { + if (panel.isStandalone && panel._rightPanelBarrier) { panel._rightPanelBarrier.destroy(); } @@ -705,7 +705,7 @@ function newUpdateHotCorners() { function newUpdatePanelBarrier(panel) { let barriers = { - _rightPanelBarrier: [(panel.isSecondary ? panel : this)], + _rightPanelBarrier: [(panel.isStandalone ? panel : this)], _leftPanelBarrier: [panel] }; @@ -776,7 +776,7 @@ function newUpdatePanelBarrier(panel) { } function _newLookingGlassResize() { - let topOffset = Panel.getPosition() == St.Side.TOP ? Panel.size : 0; + let topOffset = Panel.getPosition() == St.Side.TOP ? Panel.size : 32; this._oldResize(); Utils.wrapActor(this); diff --git a/prefs.js b/prefs.js index 12ec2f3..b5d37fd 100644 --- a/prefs.js +++ b/prefs.js @@ -230,10 +230,7 @@ const Settings = new Lang.Class({ showDesktopWidthLabel.set_text(isVertical ? _('Show Desktop button height (px)') : _('Show Desktop button width (px)')); }, - _bindSettings: function() { - // Position and style panel - - // Position option + _setPositionRadios: function() { let position = this._settings.get_string('panel-position'); switch (position) { @@ -251,6 +248,13 @@ const Settings = new Lang.Class({ break; } + }, + + _bindSettings: function() { + // Position and style panel + + // Position option + this._setPositionRadios(); this._settings.connect('changed::panel-position', () => this._updateVerticalRelatedOptions()); this._updateVerticalRelatedOptions(); @@ -1760,6 +1764,27 @@ const Settings = new Lang.Class({ 'active', Gio.SettingsBindFlags.DEFAULT); + this._settings.bind('stockgs-keep-top-panel', + this._builder.get_object('stockgs_top_panel_switch'), + 'active', + Gio.SettingsBindFlags.DEFAULT); + + var maybeDisableTopPosition = () => { + let keepTopPanel = this._settings.get_boolean('stockgs-keep-top-panel'); + let topRadio = this._builder.get_object('position_top_button'); + + topRadio.set_sensitive(!keepTopPanel); + topRadio.set_tooltip_text(keepTopPanel ? _('Unavailable when gnome-shell top panel is present') : ''); + + if (keepTopPanel && this._settings.get_string('panel-position') == 'TOP') { + this._settings.set_string('panel-position', "BOTTOM"); + this._setPositionRadios(); + } + }; + + this._settings.connect('changed::stockgs-keep-top-panel', () => maybeDisableTopPosition()); + maybeDisableTopPosition(); + this._settings.bind('stockgs-panelbtn-click-only', this._builder.get_object('stockgs_panelbtn_switch'), 'active', 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 dd6b8ab..3418d6b 100644 --- a/schemas/org.gnome.shell.extensions.dash-to-panel.gschema.xml +++ b/schemas/org.gnome.shell.extensions.dash-to-panel.gschema.xml @@ -192,6 +192,11 @@ Keep dash Whether to keep the stock gnome-shell dash while in overview + + false + Keep top panel + Whether to keep the stock gnome-shell top panel + false Panel menu buttons require click diff --git a/taskbar.js b/taskbar.js index 7d37b9e..1f829c3 100644 --- a/taskbar.js +++ b/taskbar.js @@ -854,7 +854,7 @@ var taskbar = Utils.defineClass({ this._updateAppIcons(); // This will update the size, and the corresponding number for each icon on the primary panel - if (!this.dtpPanel.isSecondary) { + if (this.dtpPanel.isPrimary) { this._updateNumberOverlay(); } @@ -867,7 +867,7 @@ var taskbar = Utils.defineClass({ _checkIfShowingFavorites: function() { return Me.settings.get_boolean('show-favorites') && - (!this.dtpPanel.isSecondary || Me.settings.get_boolean('show-favorites-all-monitors')); + (this.dtpPanel.isPrimary || Me.settings.get_boolean('show-favorites-all-monitors')); }, _getRunningApps: function() { From 08a46105fcbbb0f45cb16e00f8166ba64d4c6aaf Mon Sep 17 00:00:00 2001 From: Charles Gagnon Date: Sat, 2 May 2020 19:10:57 -0400 Subject: [PATCH 07/15] Adjust flat-remix when keeping stock gnome-shell top panel --- panel.js | 7 +++++-- panelManager.js | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/panel.js b/panel.js index 98416db..cecf6fa 100644 --- a/panel.js +++ b/panel.js @@ -662,7 +662,8 @@ var dtpPanel = Utils.defineClass({ let scaleFactor = St.ThemeContext.get_for_stage(global.stage).scale_factor || 1; let panelBoxTheme = this.panelBox.get_theme_node(); let lrPadding = panelBoxTheme.get_padding(St.Side.RIGHT) + panelBoxTheme.get_padding(St.Side.LEFT); - let tbPadding = panelBoxTheme.get_padding(St.Side.TOP) + panelBoxTheme.get_padding(St.Side.BOTTOM); + let topPadding = panelBoxTheme.get_padding(St.Side.TOP); + let tbPadding = topPadding + panelBoxTheme.get_padding(St.Side.BOTTOM); let position = getPosition(); let gsTopPanelOffset = 0; let x = 0, y = 0; @@ -671,7 +672,7 @@ var dtpPanel = Utils.defineClass({ size = Me.settings.get_int('panel-size') * scaleFactor; if (Me.settings.get_boolean('stockgs-keep-top-panel') && Main.layoutManager.primaryMonitor == this.monitor) { - gsTopPanelOffset = Main.layoutManager.panelBox.height; + gsTopPanelOffset = Main.layoutManager.panelBox.height - topPadding; } if (checkIfVertical()) { @@ -709,6 +710,8 @@ var dtpPanel = Utils.defineClass({ return { x: x, y: y, w: w, h: h, + lrPadding: lrPadding, + tbPadding: tbPadding, position: position }; }, diff --git a/panelManager.js b/panelManager.js index ee8dea8..06553c3 100755 --- a/panelManager.js +++ b/panelManager.js @@ -95,8 +95,8 @@ var dtpPanelManager = Utils.defineClass({ let leftOrRight = (panelPosition == St.Side.LEFT || panelPosition == St.Side.RIGHT); p.panelBox.set_size( - leftOrRight ? -1 : p.geom.w, - leftOrRight ? p.geom.h : -1 + leftOrRight ? -1 : p.geom.w + p.geom.lrPadding, + leftOrRight ? p.geom.h + p.geom.tbPadding : -1 ); this._findPanelMenuButtons(p.panelBox).forEach(pmb => this._adjustPanelMenuButton(pmb, p.monitor, panelPosition)); From a196afa7b04efedb19f87be4ab0e0306d190f04f Mon Sep 17 00:00:00 2001 From: Charles Gagnon Date: Sun, 3 May 2020 11:22:51 -0400 Subject: [PATCH 08/15] Use constant for title right padding --- appIcons.js | 15 ++++----------- stylesheet.css | 1 + 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/appIcons.js b/appIcons.js index 088cf68..a37d259 100644 --- a/appIcons.js +++ b/appIcons.js @@ -59,10 +59,12 @@ const T4 = 'overviewWindowDragEndTimeout'; const T5 = 'switchWorkspaceTimeout'; const T6 = 'displayProperIndicatorTimeout'; +//right padding defined for .overview-label in stylesheet.css +const TITLE_RIGHT_PADDING = 8; + let LABEL_GAP = 5; let MAX_INDICATORS = 4; var DEFAULT_PADDING_SIZE = 4; -var titleRightPadding = -1; let DOT_STYLE = { DOTS: "DOTS", @@ -481,7 +483,7 @@ var taskbarAppIcon = Utils.defineClass({ this._windowTitle.clutter_text.natural_width = useFixedWidth ? maxLabelWidth : 0; this._windowTitle.clutter_text.natural_width_set = useFixedWidth; - this._windowTitle.set_width(variableWidth ? -1 : maxLabelWidth + this._getWindowTitleRightPadding()); + this._windowTitle.set_width(variableWidth ? -1 : maxLabelWidth + TITLE_RIGHT_PADDING); this._windowTitle.set_style('font-size: ' + Me.settings.get_int('group-apps-label-font-size') + 'px;' + 'font-weight: ' + fontWeight + ';' + @@ -490,15 +492,6 @@ var taskbarAppIcon = Utils.defineClass({ } }, - _getWindowTitleRightPadding: function() { - if (this._windowTitle && this._windowTitle.mapped && titleRightPadding < 0) { - //get the right padding defined for .overview-label in stylesheet.css - titleRightPadding = this._windowTitle.get_theme_node().get_padding(St.Side.RIGHT); - } - - return titleRightPadding; - }, - _updateWindowTitle: function() { if (this._windowTitle.text != this.window.title) { this._windowTitle.text = (this.window.title ? this.window.title : this.app.get_name()).replace(/\r?\n|\r/g, '').trim(); diff --git a/stylesheet.css b/stylesheet.css index 4a7a6b6..37bcd8f 100644 --- a/stylesheet.css +++ b/stylesheet.css @@ -34,6 +34,7 @@ } #dashtopanelScrollview .app-well-app .overview-label { + /* must match TITLE_RIGHT_PADDING in apppicons.js */ padding-right: 8px; } From dc61935c0732052c7739a362e7561628a8260829 Mon Sep 17 00:00:00 2001 From: Charles Gagnon Date: Sun, 3 May 2020 12:27:07 -0400 Subject: [PATCH 09/15] Include corner height in panel clip --- panel.js | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/panel.js b/panel.js index cecf6fa..88ceec5 100644 --- a/panel.js +++ b/panel.js @@ -140,6 +140,7 @@ var dtpPanel = Utils.defineClass({ this._sessionStyle = null; this._unmappedButtons = []; + this.cornerSize = 0; if (isStandalone) { this.panel = new St.Widget({ name: 'panel', reactive: true }); @@ -799,21 +800,26 @@ var dtpPanel = Utils.defineClass({ if (this.geom.position == St.Side.TOP) { let childBoxLeftCorner = new Clutter.ActorBox(); - let [ , cornerSize] = this.panel._leftCorner.actor[sizeFunc](-1); - childBoxLeftCorner[varCoord.c1] = 0; - childBoxLeftCorner[varCoord.c2] = cornerSize; - childBoxLeftCorner[fixedCoord.c1] = panelAllocFixedSize; - childBoxLeftCorner[fixedCoord.c2] = panelAllocFixedSize + cornerSize; - let childBoxRightCorner = new Clutter.ActorBox(); - [ , cornerSize] = this.panel._rightCorner.actor[sizeFunc](-1); - childBoxRightCorner[varCoord.c1] = panelAllocVarSize - cornerSize; + let currentCornerSize = this.cornerSize; + + [ , this.cornerSize] = this.panel._leftCorner.actor[sizeFunc](-1); + childBoxLeftCorner[varCoord.c1] = 0; + childBoxLeftCorner[varCoord.c2] = this.cornerSize; + childBoxLeftCorner[fixedCoord.c1] = panelAllocFixedSize; + childBoxLeftCorner[fixedCoord.c2] = panelAllocFixedSize + this.cornerSize; + + childBoxRightCorner[varCoord.c1] = panelAllocVarSize - this.cornerSize; childBoxRightCorner[varCoord.c2] = panelAllocVarSize; childBoxRightCorner[fixedCoord.c1] = panelAllocFixedSize; - childBoxRightCorner[fixedCoord.c2] = panelAllocFixedSize + cornerSize; + childBoxRightCorner[fixedCoord.c2] = panelAllocFixedSize + this.cornerSize; this.panel._leftCorner.actor.allocate(childBoxLeftCorner, flags); this.panel._rightCorner.actor.allocate(childBoxRightCorner, flags); + + if (this.cornerSize != currentCornerSize) { + this._setPanelClip(); + } } }, @@ -832,12 +838,17 @@ var dtpPanel = Utils.defineClass({ this.panel.actor[(St.Side[p] == this.geom.position ? 'add' : 'remove') + '_style_class_name'](cssName); }); - this._timeoutsHandler.add([T7, 0, () => Utils.setClip(clipContainer, clipContainer.x, clipContainer.y, this.panelBox.width, this.panelBox.height)]); + this._setPanelClip(clipContainer); Main.layoutManager._updateHotCorners(); Main.layoutManager._updatePanelBarrier(this); }, + _setPanelClip: function(clipContainer) { + clipContainer = clipContainer || this.panelBox.get_parent(); + this._timeoutsHandler.add([T7, 0, () => Utils.setClip(clipContainer, clipContainer.x, clipContainer.y, this.panelBox.width, this.panelBox.height + this.cornerSize)]); + }, + _onButtonPress: function(actor, event) { let type = event.type(); let isPress = type == Clutter.EventType.BUTTON_PRESS; From 353565f2c15daf34d8c9d2e20e371cdfd99b4873 Mon Sep 17 00:00:00 2001 From: Charles Gagnon Date: Sun, 3 May 2020 13:48:58 -0400 Subject: [PATCH 10/15] Center overview search-entry when vertical --- panel.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/panel.js b/panel.js index 88ceec5..b024466 100644 --- a/panel.js +++ b/panel.js @@ -396,6 +396,8 @@ var dtpPanel = Utils.defineClass({ } ]); + this._setSearchEntryOffset(this.geom.w); + if (this.statusArea.dateMenu) { this._formatVerticalClock(); @@ -436,6 +438,7 @@ var dtpPanel = Utils.defineClass({ this.menuManager._changeMenu = this.menuManager._oldChangeMenu; this._myPanelGhost.get_parent().remove_actor(this._myPanelGhost); + this._setSearchEntryOffset(0); panelBoxes.forEach(b => delete this[b].allocate); this._unmappedButtons.forEach(a => this._disconnectVisibleId(a)); @@ -626,6 +629,19 @@ var dtpPanel = Utils.defineClass({ this._myPanelGhost.set_size(this.width, checkIfVertical() ? 1 : this.height); }, + _setSearchEntryOffset: function(offset) { + if (this.isPrimary) { + //In the overview, when the panel is vertical the search-entry is the only element + //that doesn't natively take into account the size of a side dock, as it is always + //centered relatively to the monitor. This looks misaligned, adjust it here so it + //is centered like the rest of the overview elements. + let paddingSide = getPosition() == St.Side.LEFT ? 'left' : 'right'; + let style = offset ? 'padding-' + paddingSide + ':' + offset + 'px;' : null; + + Main.overview._overview._searchEntry.get_parent().set_style(style); + } + }, + _adjustForOverview: function() { let isFocusedMonitor = this.panelManager.checkIfFocusedMonitor(this.monitor); let isOverview = !!Main.overview.visibleTarget; @@ -656,6 +672,7 @@ var dtpPanel = Utils.defineClass({ if (checkIfVertical()) { this._refreshVerticalAlloc(); + this._setSearchEntryOffset(this.geom.w); } }, From ca96bf5d4f327151cac79b6b9d487f6faafd46a4 Mon Sep 17 00:00:00 2001 From: Charles Gagnon Date: Sun, 3 May 2020 13:59:07 -0400 Subject: [PATCH 11/15] Fix search-entry centering on older gnome-shell versions --- panel.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/panel.js b/panel.js index b024466..4d77a20 100644 --- a/panel.js +++ b/panel.js @@ -637,8 +637,9 @@ var dtpPanel = Utils.defineClass({ //is centered like the rest of the overview elements. let paddingSide = getPosition() == St.Side.LEFT ? 'left' : 'right'; let style = offset ? 'padding-' + paddingSide + ':' + offset + 'px;' : null; - - Main.overview._overview._searchEntry.get_parent().set_style(style); + let searchEntry = Main.overview._searchEntry || Main.overview._overview._searchEntry; + + searchEntry.get_parent().set_style(style); } }, From 07478c8a39de64a27fcf4b0fc87f5cca614e9e2e Mon Sep 17 00:00:00 2001 From: Charles Gagnon Date: Sun, 3 May 2020 18:41:33 -0400 Subject: [PATCH 12/15] Apply adwaita border radius to top panel corner --- panel.js | 40 +++++++++++++++++++++++++++++++++++++--- stylesheet.css | 2 +- 2 files changed, 38 insertions(+), 4 deletions(-) diff --git a/panel.js b/panel.js index 4d77a20..2878b7f 100644 --- a/panel.js +++ b/panel.js @@ -171,6 +171,10 @@ var dtpPanel = Utils.defineClass({ this._setPanelMenu('show-status-menu-all-monitors', 'aggregateMenu', dtpSecondaryAggregateMenu, this._rightBox, true); this._setPanelMenu('show-clock-all-monitors', 'dateMenu', DateMenu.DateMenuButton, this._centerBox, true); + if (this.statusArea.aggregateMenu) { + setMenuArrow(this.statusArea.aggregateMenu._indicators.get_last_child(), position); + } + this.panel.add_child(this._leftBox); this.panel.add_child(this._centerBox); this.panel.add_child(this._rightBox); @@ -196,6 +200,7 @@ var dtpPanel = Utils.defineClass({ if (isStandalone) { this.panel.add_child(this.panel._leftCorner.actor); this.panel.add_child(this.panel._rightCorner.actor); + this.panel._rightCorner.setStyleParent(this._rightBox); } } @@ -324,6 +329,8 @@ var dtpPanel = Utils.defineClass({ this._setClockLocation(Me.settings.get_string('location-clock')); this._displayShowDesktopButton(Me.settings.get_boolean('show-showdesktop-button')); + this._setRightCornerStyle(); + this.panel.actor.add_style_class_name('dashtopanelMainPanel ' + getOrientation()); // Since Gnome 3.8 dragging an app without having opened the overview before cause the attemp to @@ -472,6 +479,9 @@ var dtpPanel = Utils.defineClass({ this._displayShowDesktopButton(false); + this._toggleCornerStyle(this.panel._leftCorner, true); + this._toggleCornerStyle(this.panel._rightCorner, true); + delete Utils.getIndicators(this.statusArea.aggregateMenu._volume)._dtpIgnoreScroll; setMenuArrow(this.statusArea.aggregateMenu._indicators.get_last_child(), St.Side.TOP); @@ -490,6 +500,10 @@ var dtpPanel = Utils.defineClass({ } else { this._removePanelMenu('dateMenu'); this._removePanelMenu('aggregateMenu'); + + if (this.panel._rightCorner && this.panel._rightCorner._buttonStyleChangedSignalId) { + this.panel._rightCorner._button.disconnect(this.panel._rightCorner._buttonStyleChangedSignalId); + } } Main.ctrlAltTabManager.removeGroup(this); @@ -924,7 +938,9 @@ var dtpPanel = Utils.defineClass({ }, _onBoxActorAdded: function(box) { - this._setClockLocation(Me.settings.get_string('location-clock')); + if (!this._setClockLocation(Me.settings.get_string('location-clock'))) { + this._setRightCornerStyle(); + } if (checkIfVertical()) { this._setVertical(box, true); @@ -1083,6 +1099,25 @@ var dtpPanel = Utils.defineClass({ destination['set_child_' + (loc.indexOf('RIGHT') > 0 ? 'above' : 'below') + '_sibling'](dateMenuContainer, refSibling); destination.queue_relayout(); + this._setRightCornerStyle(); + + return 1; + }, + + _setRightCornerStyle: function() { + if (this.panel._rightCorner) { + this._toggleCornerStyle( + this.panel._rightCorner, + (this.statusArea.aggregateMenu && + this._rightBox.get_last_child() == this.statusArea.aggregateMenu.container) + ); + } + }, + + _toggleCornerStyle: function(corner, visible) { + if (corner) { + corner[(visible ? 'remove' : 'add') + '_style_class_name']('hidden'); + } }, _displayShowDesktopButton: function (isVisible) { @@ -1131,6 +1166,7 @@ var dtpPanel = Utils.defineClass({ this._rightBox.remove_child(this._showDesktopButton); this._showDesktopButton.destroy(); this._showDesktopButton = null; + this._setRightCornerStyle(); } }, @@ -1327,7 +1363,5 @@ var dtpSecondaryAggregateMenu = Utils.defineClass({ menuLayout.addSizeChild(this._power.menu.actor); menuLayout.addSizeChild(this._system.menu.actor); - - setMenuArrow(this._indicators.get_last_child(), getPosition()); }, }); diff --git a/stylesheet.css b/stylesheet.css index 37bcd8f..66b2384 100644 --- a/stylesheet.css +++ b/stylesheet.css @@ -120,7 +120,7 @@ background-color: rgba(200, 200, 200, .4); } -.panel-corner:active, .panel-corner:overview, .panel-corner:focus { +.panel-corner.hidden:active, .panel-corner.hidden:overview, .panel-corner.hidden:focus { -panel-corner-border-color: rgba(0, 0, 0, .001); } #dashtopanelScrollview .badge { From 6eaab5ada0df3950cfc1d1061b7ded8f42ccf40d Mon Sep 17 00:00:00 2001 From: Charles Gagnon Date: Sun, 3 May 2020 21:27:40 -0400 Subject: [PATCH 13/15] Adjust latest for larger scale factors --- appIcons.js | 23 +++++++++++------------ extension.js | 2 +- panel.js | 7 ++++--- progress.js | 2 +- transparency.js | 2 +- utils.js | 8 ++++++++ windowPreview.js | 2 +- 7 files changed, 27 insertions(+), 19 deletions(-) diff --git a/appIcons.js b/appIcons.js index a37d259..56b8a7d 100644 --- a/appIcons.js +++ b/appIcons.js @@ -168,7 +168,7 @@ var taskbarAppIcon = Utils.defineClass({ this._updateWindowTitle(); this._updateWindowTitleStyle(); - this._scaleFactorChangedId = St.ThemeContext.get_for_stage(global.stage).connect('changed', () => this._updateWindowTitleStyle()); + this._scaleFactorChangedId = Utils.getStageTheme().connect('changed', () => this._updateWindowTitleStyle()); box.add_child(this._dtpIconContainer); box.add_child(this._windowTitle); @@ -316,7 +316,7 @@ var taskbarAppIcon = Utils.defineClass({ global.window_manager.disconnect(this._switchWorkspaceId); if(this._scaleFactorChangedId) - St.ThemeContext.get_for_stage(global.stage).disconnect(this._scaleFactorChangedId); + Utils.getStageTheme().disconnect(this._scaleFactorChangedId); if (this._hoverChangeId) { this.actor.disconnect(this._hoverChangeId); @@ -474,16 +474,16 @@ var taskbarAppIcon = Utils.defineClass({ _updateWindowTitleStyle: function() { if (this._windowTitle) { let useFixedWidth = Me.settings.get_boolean('group-apps-use-fixed-width'); - let variableWidth = !useFixedWidth || this.dtpPanel.taskbar.fullScrollView; + let variableWidth = !useFixedWidth || Panel.checkIfVertical() || this.dtpPanel.taskbar.fullScrollView; let fontWeight = Me.settings.get_string('group-apps-label-font-weight'); - let maxLabelWidth = Me.settings.get_int('group-apps-label-max-width') * - St.ThemeContext.get_for_stage(global.stage).scale_factor; - + let scaleFactor = Utils.getScaleFactor(); + let maxLabelWidth = Me.settings.get_int('group-apps-label-max-width') * scaleFactor; + this._windowTitle[(maxLabelWidth > 0 ? 'show' : 'hide')](); this._windowTitle.clutter_text.natural_width = useFixedWidth ? maxLabelWidth : 0; this._windowTitle.clutter_text.natural_width_set = useFixedWidth; - this._windowTitle.set_width(variableWidth ? -1 : maxLabelWidth + TITLE_RIGHT_PADDING); + this._windowTitle.set_width(variableWidth ? -1 : maxLabelWidth + TITLE_RIGHT_PADDING * scaleFactor); this._windowTitle.set_style('font-size: ' + Me.settings.get_int('group-apps-label-font-size') + 'px;' + 'font-weight: ' + fontWeight + ';' + @@ -514,7 +514,7 @@ var taskbarAppIcon = Utils.defineClass({ let highlightMargin = isWide ? Me.settings.get_int('dot-size') : 0; if(!this.window) { - let containerWidth = this._dtpIconContainer.get_width() / St.ThemeContext.get_for_stage(global.stage).scale_factor; + let containerWidth = this._dtpIconContainer.get_width() / Utils.getScaleFactor();; let backgroundSize = containerWidth + "px " + (containerWidth - (pos == DOT_POSITION.BOTTOM ? highlightMargin : 0)) + "px;"; @@ -958,7 +958,7 @@ var taskbarAppIcon = Utils.defineClass({ }, _getRunningIndicatorSize: function() { - return Me.settings.get_int('dot-size') * St.ThemeContext.get_for_stage(global.stage).scale_factor; + return Me.settings.get_int('dot-size') * Utils.getScaleFactor(); }, _getRunningIndicatorColor: function(isFocused) { @@ -1165,11 +1165,10 @@ var taskbarAppIcon = Utils.defineClass({ // We apply an overall scale factor that might come from a HiDPI monitor. // Clutter dimensions are in physical pixels, but CSS measures are in logical // pixels, so make sure to consider the scale. - let scaleFactor = St.ThemeContext.get_for_stage(global.stage).scale_factor; // Set the font size to something smaller than the whole icon so it is // still visible. The border radius is large to make the shape circular let [minWidth, natWidth] = this._dtpIconContainer.get_preferred_width(-1); - let font_size = Math.round(Math.max(12, 0.3 * natWidth) / scaleFactor); + let font_size = Math.round(Math.max(12, 0.3 * natWidth) / Utils.getScaleFactor()); let size = Math.round(font_size * 1.3); let label = bin.child; let style = 'font-size: ' + font_size + 'px;' + @@ -1641,7 +1640,7 @@ var ShowAppsIconWrapper = Utils.defineClass({ if (customIconPath) { this._iconActor.gicon = new Gio.FileIcon({ file: Gio.File.new_for_path(customIconPath) }); } - + return this._iconActor; }; diff --git a/extension.js b/extension.js index a1f6d39..eb41e83 100644 --- a/extension.js +++ b/extension.js @@ -74,7 +74,7 @@ function _enable() { // Disable Ubuntu Dock let extensionOrder = (extensionSystem.extensionOrder || extensionSystem._extensionOrder); - St.ThemeContext.get_for_stage(global.stage).get_theme().unload_stylesheet(ubuntuDock.stylesheet); + Utils.getStageTheme().get_theme().unload_stylesheet(ubuntuDock.stylesheet); ubuntuDock.stateObj.disable(); disabledUbuntuDock = true; ubuntuDock.state = 2; //ExtensionState.DISABLED diff --git a/panel.js b/panel.js index 2878b7f..b66ea3f 100644 --- a/panel.js +++ b/panel.js @@ -348,7 +348,7 @@ var dtpPanel = Utils.defineClass({ this._signalsHandler.add( // this is to catch changes to the theme or window scale factor [ - St.ThemeContext.get_for_stage(global.stage), + Utils.getStageTheme(), 'changed', () => this._resetGeometry() ], @@ -650,7 +650,8 @@ var dtpPanel = Utils.defineClass({ //centered relatively to the monitor. This looks misaligned, adjust it here so it //is centered like the rest of the overview elements. let paddingSide = getPosition() == St.Side.LEFT ? 'left' : 'right'; - let style = offset ? 'padding-' + paddingSide + ':' + offset + 'px;' : null; + let scaleFactor = Utils.getScaleFactor(); + let style = offset ? 'padding-' + paddingSide + ':' + (offset / scaleFactor) + 'px;' : null; let searchEntry = Main.overview._searchEntry || Main.overview._overview._searchEntry; searchEntry.get_parent().set_style(style); @@ -692,7 +693,7 @@ var dtpPanel = Utils.defineClass({ }, getGeometry: function() { - let scaleFactor = St.ThemeContext.get_for_stage(global.stage).scale_factor || 1; + let scaleFactor = Utils.getScaleFactor(); let panelBoxTheme = this.panelBox.get_theme_node(); let lrPadding = panelBoxTheme.get_padding(St.Side.RIGHT) + panelBoxTheme.get_padding(St.Side.LEFT); let topPadding = panelBoxTheme.get_padding(St.Side.TOP); diff --git a/progress.js b/progress.js index 8a74c9a..0b8c0e3 100644 --- a/progress.js +++ b/progress.js @@ -419,7 +419,7 @@ var ProgressIndicator = Utils.defineClass({ }, _drawProgressOverlay: function(area) { - let scaleFactor = St.ThemeContext.get_for_stage(global.stage).scale_factor; + let scaleFactor = Utils.getScaleFactor(); let [surfaceWidth, surfaceHeight] = area.get_surface_size(); let cr = area.get_context(); diff --git a/transparency.js b/transparency.js index c557518..835f88a 100644 --- a/transparency.js +++ b/transparency.js @@ -71,7 +71,7 @@ var DynamicTransparency = Utils.defineClass({ _bindSignals: function() { this._signalsHandler.add( [ - St.ThemeContext.get_for_stage(global.stage), + Utils.getStageTheme(), 'changed', () => this._updateAllAndSet() ], diff --git a/utils.js b/utils.js index b07c6be..8fbb280 100644 --- a/utils.js +++ b/utils.js @@ -294,6 +294,14 @@ var getWorkspaceCount = function() { return DisplayWrapper.getWorkspaceManager().n_workspaces; }; +var getStageTheme = function() { + return St.ThemeContext.get_for_stage(global.stage); +}; + +var getScaleFactor = function() { + return getStageTheme().scale_factor || 1; +}; + var findIndex = function(array, predicate) { if (Array.prototype.findIndex) { return array.findIndex(predicate); diff --git a/windowPreview.js b/windowPreview.js index 86aa044..2cad787 100644 --- a/windowPreview.js +++ b/windowPreview.js @@ -416,7 +416,7 @@ var PreviewMenu = Utils.defineClass({ isLeftButtons = Meta.prefs_get_button_layout().left_buttons.indexOf(Meta.ButtonFunction.CLOSE) >= 0; isTopHeader = Me.settings.get_string('window-preview-title-position') == 'TOP'; isManualStyling = Me.settings.get_boolean('window-preview-manual-styling'); - scaleFactor = St.ThemeContext.get_for_stage(global.stage).scale_factor; + scaleFactor = Utils.getScaleFactor(); headerHeight = Me.settings.get_boolean('window-preview-show-title') ? HEADER_HEIGHT * scaleFactor : 0; animationTime = Me.settings.get_int('window-preview-animation-time') * .001; aspectRatio.x = { From 6fbbb13904569e43ed8ee28e52c69f4dcb0da4df Mon Sep 17 00:00:00 2001 From: Charles Gagnon Date: Mon, 4 May 2020 10:44:39 -0400 Subject: [PATCH 14/15] Fix panelcorner actor on older gnome-shell versions --- panel.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/panel.js b/panel.js index b66ea3f..5ded78e 100644 --- a/panel.js +++ b/panel.js @@ -194,9 +194,6 @@ var dtpPanel = Utils.defineClass({ this.panel._leftCorner = this.panel._leftCorner || new Panel.PanelCorner(St.Side.LEFT); this.panel._rightCorner = this.panel._rightCorner || new Panel.PanelCorner(St.Side.RIGHT); - Utils.wrapActor(this.panel._leftCorner); - Utils.wrapActor(this.panel._rightCorner); - if (isStandalone) { this.panel.add_child(this.panel._leftCorner.actor); this.panel.add_child(this.panel._rightCorner.actor); @@ -204,6 +201,9 @@ var dtpPanel = Utils.defineClass({ } } + Utils.wrapActor(this.panel._leftCorner || 0); + Utils.wrapActor(this.panel._rightCorner || 0); + this.add_child(this.panel.actor); if (Main.panel._onButtonPress || Main.panel._tryDragWindow) { @@ -1117,7 +1117,7 @@ var dtpPanel = Utils.defineClass({ _toggleCornerStyle: function(corner, visible) { if (corner) { - corner[(visible ? 'remove' : 'add') + '_style_class_name']('hidden'); + corner.actor[(visible ? 'remove' : 'add') + '_style_class_name']('hidden'); } }, From 0dd48e00685feb3ddd51c75f03d026e091ce2200 Mon Sep 17 00:00:00 2001 From: Charles Gagnon Date: Mon, 4 May 2020 19:39:17 -0400 Subject: [PATCH 15/15] Flatten multi-monitor options --- Settings.ui | 380 ++++++------------ prefs.js | 77 ++-- ...shell.extensions.dash-to-panel.gschema.xml | 2 +- 3 files changed, 164 insertions(+), 295 deletions(-) diff --git a/Settings.ui b/Settings.ui index 523235a..8949c9f 100644 --- a/Settings.ui +++ b/Settings.ui @@ -298,208 +298,6 @@ - - True - False - vertical - - - True - False - 0 - in - - - True - False - none - - - 100 - True - True - - - True - False - 12 - 12 - 12 - 12 - 12 - 32 - - - True - False - True - Isolate monitors - True - 0 - - - 0 - 0 - - - - - True - True - end - center - - - 1 - 0 - - - - - - - - - True - True - - - True - False - 12 - 12 - 12 - 12 - 12 - 32 - - - True - False - True - Display favorite applications on all monitors - True - 0 - - - 0 - 0 - - - - - True - True - end - center - - - 1 - 0 - - - - - - - - - True - True - - - True - False - 12 - 12 - 12 - 12 - 12 - 32 - - - True - False - True - Display the clock on all monitors - True - 0 - - - 0 - 0 - - - - - True - True - end - center - - - 1 - 0 - - - - - - - - - True - True - - - True - False - 12 - 12 - 12 - 12 - 12 - 32 - - - True - False - True - Display the status menu on all monitors - True - 0 - - - 0 - 0 - - - - - True - True - end - center - - - 1 - 0 - - - - - - - - - - - False - True - 0 - - - True False @@ -2308,7 +2106,7 @@ True False True - Time (ms) before showing (300 is default) + Time (ms) before showing (400 is default) True 0 @@ -4762,6 +4560,7 @@ 12 12 12 + 6 32 @@ -4778,54 +4577,90 @@ - + True - False - 6 - - - True - True - True - center - center - 0.46000000834465027 - - - True - False - emblem-system-symbolic - - - - - - False - True - 0 - - - - - True - True - end - center - - - False - True - 1 - - + True + end + center 1 0 + + + True + False + True + True + 0 + + + 0 + 3 + + + + + True + False + True + True + 0 + + + 0 + 2 + + + + + True + True + end + center + + + 1 + 3 + + + + + True + True + end + center + + + 1 + 2 + + + + + True + False + True + 6 + True + For the following 2 options, "additional" refers to panels that are displayed in addition to the gnome-shell top panel. + True + 40 + 0 + + + + 0 + 1 + + + + + @@ -5957,6 +5792,19 @@ 0 + + + True + False + True + Show running applications + 0 + + + 0 + 2 + + True @@ -5964,17 +5812,30 @@ end center + + 1 + 2 + + + + + True + True + end + center + 1 1 - + True False True - Show running applications + Show favorite applications on secondary panels + True 0 @@ -6402,6 +6263,7 @@ 12 12 12 + 6 32 @@ -6429,6 +6291,32 @@ 0 + + + True + True + end + center + + + 1 + 1 + + + + + True + False + True + Isolate monitors + True + 0 + + + 0 + 1 + + diff --git a/prefs.js b/prefs.js index b5d37fd..9ae567c 100644 --- a/prefs.js +++ b/prefs.js @@ -532,16 +532,6 @@ const Settings = new Lang.Class({ 'active', Gio.SettingsBindFlags.DEFAULT); - this._settings.bind('multi-monitors', - this._builder.get_object('multimon_multi_options_button'), - 'sensitive', - Gio.SettingsBindFlags.DEFAULT); - - this._settings.bind('isolate-monitors', - this._builder.get_object('multimon_multi_isolate_monitor_switch'), - 'active', - Gio.SettingsBindFlags.DEFAULT); - this._settings.bind('show-clock-all-monitors', this._builder.get_object('multimon_multi_show_clock_switch'), 'active', @@ -552,47 +542,10 @@ const Settings = new Lang.Class({ 'active', Gio.SettingsBindFlags.DEFAULT); - this._settings.bind('show-favorites-all-monitors', - this._builder.get_object('multimon_multi_show_favorites_switch'), - 'active', - Gio.SettingsBindFlags.DEFAULT); - if (monitors.length === 1) { - this._builder.get_object('multimon_listbox').set_sensitive(false); this._builder.get_object('multimon_multi_switch').set_active(false); } - this._builder.get_object('multimon_multi_options_button').connect('clicked', Lang.bind(this, function() { - let dialog = new Gtk.Dialog({ title: _('Multi-monitors options'), - transient_for: this.widget.get_toplevel(), - use_header_bar: true, - modal: true }); - - // GTK+ leaves positive values for application-defined response ids. - // Use +1 for the reset action - dialog.add_button(_('Reset to defaults'), 1); - - let box = this._builder.get_object('box_multimon_multi_options'); - dialog.get_content_area().add(box); - - dialog.connect('response', Lang.bind(this, function(dialog, id) { - if (id == 1) { - // restore default settings - this._settings.set_value('isolate-monitors', this._settings.get_default_value('isolate-monitors')); - this._settings.set_value('show-favorites-all-monitors', this._settings.get_default_value('show-favorites-all-monitors')); - this._settings.set_value('show-clock-all-monitors', this._settings.get_default_value('show-clock-all-monitors')); - this._settings.set_value('show-status-menu-all-monitors', this._settings.get_default_value('show-status-menu-all-monitors')); - } else { - // remove the settings box so it doesn't get destroyed; - dialog.get_content_area().remove(box); - dialog.destroy(); - } - return; - })); - - dialog.show_all(); - })); - //dynamic opacity this._settings.bind('trans-use-custom-bg', this._builder.get_object('trans_bg_switch'), @@ -1067,6 +1020,16 @@ const Settings = new Lang.Class({ 'active', Gio.SettingsBindFlags.DEFAULT); + this._settings.bind('show-favorites-all-monitors', + this._builder.get_object('multimon_multi_show_favorites_switch'), + 'active', + Gio.SettingsBindFlags.DEFAULT); + + this._settings.bind('show-favorites', + this._builder.get_object('multimon_multi_show_favorites_switch'), + 'sensitive', + Gio.SettingsBindFlags.DEFAULT); + this._settings.bind('show-running-apps', this._builder.get_object('show_runnning_apps_switch'), 'active', @@ -1297,6 +1260,11 @@ const Settings = new Lang.Class({ 'active', Gio.SettingsBindFlags.DEFAULT); + this._settings.bind('isolate-monitors', + this._builder.get_object('multimon_multi_isolate_monitor_switch'), + 'active', + Gio.SettingsBindFlags.DEFAULT); + this._settings.bind('group-apps', this._builder.get_object('group_apps_switch'), 'active', @@ -1782,7 +1750,20 @@ const Settings = new Lang.Class({ } }; - this._settings.connect('changed::stockgs-keep-top-panel', () => maybeDisableTopPosition()); + var setGsStockPanelOptions = () => { + let keepTopPanel = this._settings.get_boolean('stockgs-keep-top-panel'); + + this._builder.get_object('stockgs_top_panel_description')[keepTopPanel ? 'show' : 'hide'](); + this._builder.get_object('multimon_multi_show_clock_label').set_text(keepTopPanel ? _('Display the clock on additional panels') : _('Display the clock on secondary panels')); + this._builder.get_object('multimon_multi_show_status_menu_label').set_text(keepTopPanel ? _('Display the status menu on additional panels') : _('Display the status menu on secondary panels')); + }; + + this._settings.connect('changed::stockgs-keep-top-panel', () => { + setGsStockPanelOptions(); + maybeDisableTopPosition(); + }); + + setGsStockPanelOptions(); maybeDisableTopPosition(); this._settings.bind('stockgs-panelbtn-click-only', 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 3418d6b..1b80e40 100644 --- a/schemas/org.gnome.shell.extensions.dash-to-panel.gschema.xml +++ b/schemas/org.gnome.shell.extensions.dash-to-panel.gschema.xml @@ -458,7 +458,7 @@ Show or hide favorite application icons in the dash - 300 + 400 Icon enter display time Amount of time after entering icon to wait before displaying window preview if icon is not clicked or mouse has not left.