From 0a066890cb4bf3136e2b23334fcc968952893981 Mon Sep 17 00:00:00 2001 From: MarkS Date: Fri, 31 Jul 2020 15:58:33 -0600 Subject: [PATCH 1/3] Display panel along percent of screen edge Set the length of the panel according to a specified percent value, so it can span only part of the screen edge. Position the panel at the start, middle, or end of the screen edge, as specified. Tests okay with multiple monitors. May also satisfy home-sweet-gnome/dash-to-panel#726 --- Settings.ui | 68 +++++++++++++++++++ panel.js | 29 +++++++- panelManager.js | 2 + panelPositions.js | 4 ++ prefs.js | 19 +++++- ...shell.extensions.dash-to-panel.gschema.xml | 15 ++++ 6 files changed, 133 insertions(+), 4 deletions(-) diff --git a/Settings.ui b/Settings.ui index 052397f..a92d065 100644 --- a/Settings.ui +++ b/Settings.ui @@ -2,6 +2,11 @@ + + 100 + 1 + 10 + 0.33 1 @@ -4801,6 +4806,69 @@ 2 + + + True + False + 12 + 12 + False + Length along screen edge, in percent + 0 + + + 0 + 3 + + + + + True + True + 12 + 12 + 5 + 100 + adjustment1 + True + 100 + + + 1 + 3 + + + + + True + False + 12 + 12 + False + Position along screen edge + 0 + + + 0 + 4 + + + + + True + False + center + + Start + Middle + End + + + + 1 + 4 + + diff --git a/panel.js b/panel.js index b089aab..9bcce26 100644 --- a/panel.js +++ b/panel.js @@ -798,6 +798,9 @@ var dtpPanel = Utils.defineClass({ let topPadding = panelBoxTheme.get_padding(St.Side.TOP); let tbPadding = topPadding + panelBoxTheme.get_padding(St.Side.BOTTOM); let position = this.getPosition(); + let length = Me.settings.get_int('panel-length') / 100; + let anchor = Me.settings.get_string('panel-anchor'); + let anchorPlaceOnMonitor = 0; let gsTopPanelOffset = 0; let x = 0, y = 0; let w = 0, h = 0; @@ -819,13 +822,13 @@ var dtpPanel = Utils.defineClass({ this.varCoord = { c1: 'y1', c2: 'y2' }; w = this.dtpSize; - h = this.monitor.height - tbPadding - gsTopPanelOffset; + h = this.monitor.height * length - tbPadding - gsTopPanelOffset; } else { this.sizeFunc = 'get_preferred_width'; this.fixedCoord = { c1: 'y1', c2: 'y2' }; this.varCoord = { c1: 'x1', c2: 'x2' }; - w = this.monitor.width - lrPadding; + w = this.monitor.width * length - lrPadding; h = this.dtpSize; } @@ -836,10 +839,30 @@ var dtpPanel = Utils.defineClass({ x = this.monitor.x + this.monitor.width - this.dtpSize - lrPadding; y = this.monitor.y + gsTopPanelOffset; } else { //BOTTOM - x = this.monitor.x; + x = this.monitor.x; y = this.monitor.y + this.monitor.height - this.dtpSize - tbPadding; } + if (this.checkIfVertical()) { + if (anchor === Pos.MIDDLE) { + anchorPlaceOnMonitor = (this.monitor.height - h) / 2; + } else if (anchor === Pos.END) { + anchorPlaceOnMonitor = this.monitor.height - h; + } else { // Pos.START + anchorPlaceOnMonitor = 0; + } + y = y + anchorPlaceOnMonitor; + } else { + if (anchor === Pos.MIDDLE) { + anchorPlaceOnMonitor = (this.monitor.width - w) / 2; + } else if (anchor === Pos.END) { + anchorPlaceOnMonitor = this.monitor.width - w; + } else { // Pos.START + anchorPlaceOnMonitor = 0; + } + x = x + anchorPlaceOnMonitor; + } + return { x: x, y: y, w: w, h: h, diff --git a/panelManager.js b/panelManager.js index 16f7869..e193a86 100755 --- a/panelManager.js +++ b/panelManager.js @@ -235,6 +235,8 @@ var dtpPanelManager = Utils.defineClass({ 'changed::multi-monitors', 'changed::isolate-monitors', 'changed::panel-positions', + 'changed::panel-length', + 'changed::panel-anchor', 'changed::stockgs-keep-top-panel' ], () => this._reset() diff --git a/panelPositions.js b/panelPositions.js index 3c2d1af..3197d27 100644 --- a/panelPositions.js +++ b/panelPositions.js @@ -35,6 +35,10 @@ var BOTTOM = 'BOTTOM'; var LEFT = 'LEFT'; var RIGHT = 'RIGHT'; +var START = 'START'; +var MIDDLE = 'MIDDLE'; +var END = 'END'; + var defaults = [ { element: SHOW_APPS_BTN, visible: true, position: STACKED_TL }, { element: ACTIVITIES_BTN, visible: false, position: STACKED_TL }, diff --git a/prefs.js b/prefs.js index 4eeb162..8f9b3d5 100644 --- a/prefs.js +++ b/prefs.js @@ -770,7 +770,24 @@ const Settings = new Lang.Class({ if (this.monitors.length === 1) { this._builder.get_object('multimon_multi_switch').set_sensitive(false); } - + + // Length and position along screen edge + + // Minimum length could be 0, but a higher value may help prevent confusion about where the panel went. + let panel_length_min=10 + let panel_length_max=100 + let panel_length_spinbutton = this._builder.get_object('panel_length_spinbutton'); + panel_length_spinbutton.set_range(panel_length_min, panel_length_max); + panel_length_spinbutton.set_value(this._settings.get_int('panel-length')); + this._builder.get_object('panel_length_spinbutton').connect('value-changed', Lang.bind (this, function(widget) { + this._settings.set_int('panel-length', widget.get_value()); + })); + + this._builder.get_object('panel_anchor_combo').set_active_id(this._settings.get_string('panel-anchor')); + this._builder.get_object('panel_anchor_combo').connect('changed', Lang.bind (this, function(widget) { + this._settings.set_string('panel-anchor', widget.get_active_id()); + })); + //dynamic opacity this._settings.bind('trans-use-custom-bg', this._builder.get_object('trans_bg_switch'), 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 c832084..b6f7257 100644 --- a/schemas/org.gnome.shell.extensions.dash-to-panel.gschema.xml +++ b/schemas/org.gnome.shell.extensions.dash-to-panel.gschema.xml @@ -40,6 +40,11 @@ + + + + + @@ -87,6 +92,16 @@ Panel element positions Panel element positions (JSON). + + 100 + Percentage of screen edge for panel to span + Set the length of the panel, in percent. Horizontal or vertical, according to panel orientation. + + + 'MIDDLE' + Position along screen edge + Where to show the panel if it is not the full length of the screen edge. + 48 Panel size From bbd3a20fe506c383fa8c780d3638f85138e4ed62 Mon Sep 17 00:00:00 2001 From: MarkS Date: Mon, 3 Aug 2020 20:10:00 -0600 Subject: [PATCH 2/3] Move length and anchor to Styles tab * Moved length and anchor setting to Styles tab, as it is an all-monitor setting currently. * Changed length from spinbox to slider, and shortened label. * Turned off anchor combobox sensitivity if length is 100%. * Set anchor labels to the more intuitive "Left, Center, Right" and "Top, Middle, Bottom" if all monitor panels are horizontal or vertical. If monitors have panels in a mix of orientations, use "Start, Middle, End". The schema retains the generic START, MIDDLE, END. * Changed "Panel Size" label to "Panel thickness" to more precisely describe what is being set now that the panel can be changed in two dimensions. "Panel thickness" and "Panel length" can describe the sizing of the panel for either horizontal or vertical orientations. * Changed now-shortened Position label to "Anchor", to reduce confusion with other Position setting, regarding which edge of the screen. --- Settings.ui | 183 ++++++++++-------- prefs.js | 80 ++++++-- ...shell.extensions.dash-to-panel.gschema.xml | 2 +- 3 files changed, 171 insertions(+), 94 deletions(-) diff --git a/Settings.ui b/Settings.ui index a92d065..b3bb98d 100644 --- a/Settings.ui +++ b/Settings.ui @@ -2,7 +2,7 @@ - + 100 1 10 @@ -4806,69 +4806,6 @@ 2 - - - True - False - 12 - 12 - False - Length along screen edge, in percent - 0 - - - 0 - 3 - - - - - True - True - 12 - 12 - 5 - 100 - adjustment1 - True - 100 - - - 1 - 3 - - - - - True - False - 12 - 12 - False - Position along screen edge - 0 - - - 0 - 4 - - - - - True - False - center - - Start - Middle - End - - - - 1 - 4 - - @@ -4927,13 +4864,13 @@ vertical 24 - + True False 0 in - + True False none @@ -4950,20 +4887,8 @@ 12 6 6 + 12 32 - - - True - False - Panel Size -(default is 48) - 0 - - - 0 - 0 - - True @@ -4982,10 +4907,104 @@ 0 + + + True + False + Panel thickness +(default is 48) + 0 + + + 0 + 0 + + + + + True + False + Panel length (%) +(default is 100) + 0 + + + 0 + 1 + + + + + True + True + baseline + True + panel_length_adjustment + 0 + 0 + right + + + + 1 + 1 + + + + + True + False + center + + Start + Middle + End + + + + 1 + 2 + + + + + True + False + Anchor + 0 + + + 0 + 2 + + + + + + + + + + False + True + 0 + + + + + True + False + 0 + in + + + True + False + none 100 @@ -5094,7 +5113,7 @@ False True - 0 + 1 @@ -5373,7 +5392,7 @@ False True - 1 + 2 @@ -5817,7 +5836,7 @@ False True - 2 + 3 diff --git a/prefs.js b/prefs.js index 8f9b3d5..3d7a783 100644 --- a/prefs.js +++ b/prefs.js @@ -42,6 +42,8 @@ const DEFAULT_PANEL_SIZES = [ 128, 96, 64, 48, 32, 24, 16 ]; const DEFAULT_FONT_SIZES = [ 96, 64, 48, 32, 24, 16, 0 ]; const DEFAULT_MARGIN_SIZES = [ 32, 24, 16, 12, 8, 4, 0 ]; const DEFAULT_PADDING_SIZES = [ 32, 24, 16, 12, 8, 4, 0, -1 ]; +// Minimum length could be 0, but a higher value may help prevent confusion about where the panel went. +const LENGTH_MARKS = [ 100, 90, 80, 70, 60, 50, 40, 30, 20, 10 ]; const MAX_WINDOW_INDICATOR = 4; const SCHEMA_PATH = '/org/gnome/shell/extensions/dash-to-panel/'; @@ -218,6 +220,10 @@ const Settings = new Lang.Class({ topRadio.set_tooltip_text(!topAvailable ? _('Unavailable when gnome-shell top panel is present') : ''); }, + /** + * Returns an object, with monitor index string keys to values that are Pos.TOP, Pos.BOTTOM, Pos.LEFT, + * or Pos.RIGHT. + */ _getPanelPositions: function() { return Pos.getSettingsPositions(this._settings, 'panel-positions'); }, @@ -237,6 +243,7 @@ const Settings = new Lang.Class({ monitors.forEach(m => panelPositionsSettings[m] = preventTop && this.monitors[0] == m ? Pos.BOTTOM : position); this._settings.set_string('panel-positions', JSON.stringify(panelPositionsSettings)); + this._setAnchorLabels(); }, _setPositionRadios: function(position) { @@ -260,6 +267,37 @@ const Settings = new Lang.Class({ this._ignorePositionRadios = false; }, + /** + * Set panel anchor combo labels according to whether panel is vertical, horizontal, or a mix. + */ + _setAnchorLabels: function() { + const positions = this._getPanelPositions(); + const monitorIndices = Object.getOwnPropertyNames(positions); + const allVertical = monitorIndices.every(i => positions[i] === Pos.LEFT || positions[i] === Pos.RIGHT); + const allHorizontal = monitorIndices.every(i => positions[i] === Pos.TOP || positions[i] === Pos.BOTTOM); + + const anchor_combo = this._builder.get_object('panel_anchor_combo'); + const anchor = this._settings.get_string('panel-anchor'); + anchor_combo.remove_all(); + + if (allHorizontal) { + anchor_combo.append(Pos.START, _('Left')); + anchor_combo.append(Pos.MIDDLE, _('Center')); + anchor_combo.append(Pos.END, _('Right')); + } else if (allVertical) { + anchor_combo.append(Pos.START, _('Top')); + anchor_combo.append(Pos.MIDDLE, _('Middle')); + anchor_combo.append(Pos.END, _('Bottom')); + } else { + // Mix of horizontal and vertical panels on different monitors. + anchor_combo.append(Pos.START, _('Start')); + anchor_combo.append(Pos.MIDDLE, _('Middle')); + anchor_combo.append(Pos.END, _('End')); + } + + anchor_combo.set_active_id(anchor); + }, + _displayPanelPositionsForMonitor: function(monitorIndex) { let taskbarListBox = this._builder.get_object('taskbar_display_listbox'); @@ -771,23 +809,36 @@ const Settings = new Lang.Class({ this._builder.get_object('multimon_multi_switch').set_sensitive(false); } - // Length and position along screen edge + // Length and anchoring along screen edge - // Minimum length could be 0, but a higher value may help prevent confusion about where the panel went. - let panel_length_min=10 - let panel_length_max=100 - let panel_length_spinbutton = this._builder.get_object('panel_length_spinbutton'); - panel_length_spinbutton.set_range(panel_length_min, panel_length_max); - panel_length_spinbutton.set_value(this._settings.get_int('panel-length')); - this._builder.get_object('panel_length_spinbutton').connect('value-changed', Lang.bind (this, function(widget) { - this._settings.set_int('panel-length', widget.get_value()); + // Anchor is only relevant if panel length is less than 100%. + const setAnchorWidgetSensitivity = (panelLength) => { + const isPartialLength = panelLength < 100; + this._builder.get_object('panel_anchor_label').set_sensitive(isPartialLength); + this._builder.get_object('panel_anchor_combo').set_sensitive(isPartialLength); + } + + const panel_length_scale = this._builder.get_object('panel_length_scale'); + const length = this._settings.get_int('panel-length'); + panel_length_scale.set_value(length); + setAnchorWidgetSensitivity(length); + panel_length_scale.connect('value-changed', Lang.bind (this, function(widget) { + const value = widget.get_value(); + this._settings.set_int('panel-length', value); + setAnchorWidgetSensitivity(value); })); this._builder.get_object('panel_anchor_combo').set_active_id(this._settings.get_string('panel-anchor')); this._builder.get_object('panel_anchor_combo').connect('changed', Lang.bind (this, function(widget) { - this._settings.set_string('panel-anchor', widget.get_active_id()); + const value = widget.get_active_id(); + // Value can be null while anchor labels are being swapped out + if (value !== null) { + this._settings.set_string('panel-anchor', value); + } })); + this._setAnchorLabels(); + //dynamic opacity this._settings.bind('trans-use-custom-bg', this._builder.get_object('trans_bg_switch'), @@ -1825,7 +1876,8 @@ const Settings = new Lang.Class({ {objectName: 'appicon_padding_scale', valueName: 'appicon-padding', range: DEFAULT_MARGIN_SIZES }, {objectName: 'tray_padding_scale', valueName: 'tray-padding', range: DEFAULT_PADDING_SIZES }, {objectName: 'leftbox_padding_scale', valueName: 'leftbox-padding', range: DEFAULT_PADDING_SIZES }, - {objectName: 'statusicon_padding_scale', valueName: 'status-icon-padding', range: DEFAULT_PADDING_SIZES } + {objectName: 'statusicon_padding_scale', valueName: 'status-icon-padding', range: DEFAULT_PADDING_SIZES }, + {objectName: 'panel_length_scale', valueName: 'panel-length', range: LENGTH_MARKS } ]; for(var idx in sizeScales) { @@ -1833,6 +1885,7 @@ const Settings = new Lang.Class({ let range = sizeScales[idx].range; size_scale.set_range(range[range.length-1], range[0]); size_scale.set_value(this._settings.get_int(sizeScales[idx].valueName)); + // Add marks from range arrays, omitting the first and last values. range.slice(1, -1).forEach(function(val) { size_scale.add_mark(val, Gtk.PositionType.TOP, val.toString()); }); @@ -2033,6 +2086,11 @@ const Settings = new Lang.Class({ this._settings.set_string('window-preview-title-position', 'TOP'); }, + + panel_length_scale_format_value_cb: function(scale, value) { + return value+ '%'; + }, + panel_size_scale_format_value_cb: function(scale, value) { return value+ ' px'; }, 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 b6f7257..7441df8 100644 --- a/schemas/org.gnome.shell.extensions.dash-to-panel.gschema.xml +++ b/schemas/org.gnome.shell.extensions.dash-to-panel.gschema.xml @@ -95,7 +95,7 @@ 100 Percentage of screen edge for panel to span - Set the length of the panel, in percent. Horizontal or vertical, according to panel orientation. + Length of the panel, in percent. 'MIDDLE' From a57058661a29cbacec034def56ae1c8433eed2a1 Mon Sep 17 00:00:00 2001 From: MarkS Date: Tue, 27 Oct 2020 16:04:19 -0600 Subject: [PATCH 3/3] Configure panel thickness, length, and anchor per-monitor Settings.ui: - Move thickness, length, and anchor from Style tab to Position tab. Group together with position in the same frame. schema: - Remove unpublished panel-length and panel-anchor settings, replacing them with panel-lengths and panel-anchors JSON objects (like panel-positions). - Remove unpublished anchor enum, since panel-anchors is being managed by the extension in JSON, not typed by the schema. - Deprecate panel-size in favour of new panel-sizes JSON, storing per-monitor panel sizes. - Mention that panel-position is deprecated. Introduce panelSettings.js: - Functions to fetch or set panel settings that are stored as JSON. Grown from now-removed getSettingsPositions() in panelPositions.js. prefs.js: - Group together the different UI widget label and value refreshing into method _updateWidgetSettingsForMonitor(). - Change multi-panel behaviour of _setAnchorLabels(). Previously, all panels shared the same anchor setting, and so setAnchorLabels considered all monitors. Now, panels are configured either independently, or sometimes all together; set labels according to orientation(s) of panel(s) being configured. - Omitting preventTop handling in refactored _setPanelPosition() method. Previously, it was written to set the first monitor's panel to Pos.BOTTOM if the user clicked the Top position radio button, if stockgs-keep-top-panel was also set. But the user can't activate the Top button anyway if stockgs is set (likely implemented later). panelManager.js: - Removing panelPositions, as it is not needed any more. --- Makefile | 2 +- Settings.ui | 542 +++++++++--------- appIcons.js | 11 +- panel.js | 15 +- panelManager.js | 11 +- panelPositions.js | 12 - panelSettings.js | 112 ++++ prefs.js | 180 +++--- ...shell.extensions.dash-to-panel.gschema.xml | 30 +- taskbar.js | 4 +- utils.js | 2 +- windowPreview.js | 2 +- 12 files changed, 527 insertions(+), 396 deletions(-) create mode 100644 panelSettings.js diff --git a/Makefile b/Makefile index 334f60f..b29aff1 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ UUID = dash-to-panel@jderose9.github.com BASE_MODULES = extension.js stylesheet.css metadata.json COPYING README.md -EXTRA_MODULES = appIcons.js convenience.js panel.js panelManager.js proximity.js intellihide.js progress.js panelPositions.js panelStyle.js overview.js taskbar.js transparency.js windowPreview.js prefs.js update.js utils.js Settings.ui +EXTRA_MODULES = appIcons.js convenience.js panel.js panelManager.js proximity.js intellihide.js progress.js panelPositions.js panelSettings.js panelStyle.js overview.js taskbar.js transparency.js windowPreview.js prefs.js update.js utils.js Settings.ui EXTRA_IMAGES = highlight_stacked_bg.svg highlight_stacked_bg_2.svg highlight_stacked_bg_3.svg TOLOCALIZE = prefs.js appIcons.js update.js diff --git a/Settings.ui b/Settings.ui index a2a1941..9f945c4 100644 --- a/Settings.ui +++ b/Settings.ui @@ -2765,44 +2765,45 @@ 12 32 - + + True + False + 8 + + True - False - 8 - - - True - True - end - center - - - False - True - 1 - - - - - True - True - end - 4 - 6 - preview_custom_icon_size_adjustment - True - 6 - - - 1 - 0 - 2 - - - - - 1 - + True + end + center + + + False + True + 1 + + + + + True + True + end + 4 + 6 + preview_custom_icon_size_adjustment + True + 6 + + + False + True + 2 + + + + + 1 + 0 + @@ -4147,9 +4148,8 @@ - 1 - 0 - 1 + 1 + 1 @@ -4826,124 +4826,240 @@ True False 12 + 4 + 4 True 0 1 + 2 - + True False - 18 - 6 - 32 + 6 + 0 + none - + True False - True - Panel screen position - 0 + none + + + 100 + True + True + + + True + False + 6 + 6 + 12 + 32 + + + True + True + baseline + True + panel_size_adjustment + 0 + 0 + right + + + + + 1 + 1 + + + + + True + False + Panel thickness +(default is 48) + 0 + + + 0 + 1 + + + + + True + False + Panel length (%) +(default is 100) + 0 + + + 0 + 2 + + + + + True + True + baseline + True + panel_length_adjustment + 0 + 0 + right + + + 1 + 2 + + + + + True + False + center + + Start + Middle + End + + + + 1 + 3 + + + + + True + False + Anchor + 0 + + + 0 + 3 + + + + + True + False + True + Panel screen position + 0 + + + 0 + 0 + + + + + True + False + 32 + + + Bottom + True + True + False + center + center + 0 + True + True + + + + False + True + 0 + + + + + Top + True + True + False + center + center + 0 + bottom + True + position_bottom_button + + + + False + True + 1 + + + + + Left + True + True + False + center + center + 0 + bottom + True + position_bottom_button + + + + False + True + 2 + + + + + Right + True + True + False + center + center + 0 + bottom + True + position_bottom_button + + + + False + True + 3 + + + + + 1 + 0 + + + + + + - - False - True - 0 - - - - True - False - 32 - - - Bottom - True - True - False - center - center - 0 - True - True - - - - False - True - 0 - - - - - Top - True - True - False - center - center - 0 - bottom - True - position_bottom_button - - - - False - True - 1 - - - - - Left - True - True - False - center - center - 0 - bottom - True - position_bottom_button - - - - False - True - 2 - - - - - Right - True - True - False - center - center - 0 - bottom - True - position_bottom_button - - - - False - True - 3 - - - - - False - True - 1 - + + @@ -4952,9 +5068,6 @@ 2 - - - False @@ -5009,137 +5122,6 @@ 24 vertical 24 - - - True - False - 0 - in - - - True - False - none - - - 100 - True - True - - - True - False - 12 - 12 - 6 - 6 - 12 - 32 - - - True - True - baseline - True - panel_size_adjustment - 0 - 0 - right - - - - - 1 - 0 - - - - - True - False - Panel thickness -(default is 48) - 0 - - - 0 - 0 - - - - - True - False - Panel length (%) -(default is 100) - 0 - - - 0 - 1 - - - - - True - True - baseline - True - panel_length_adjustment - 0 - 0 - right - - - - 1 - 1 - - - - - True - False - center - - Start - Middle - End - - - - 1 - 2 - - - - - True - False - Anchor - 0 - - - 0 - 2 - - - - - - - - - - - - - - False - True - 0 - - True @@ -5259,7 +5241,7 @@ False True - 1 + 0 @@ -5538,7 +5520,7 @@ False True - 2 + 1 @@ -5982,7 +5964,7 @@ False True - 3 + 2 diff --git a/appIcons.js b/appIcons.js index 1ccfbd6..05c2921 100644 --- a/appIcons.js +++ b/appIcons.js @@ -47,6 +47,7 @@ const Workspace = imports.ui.workspace; const Me = imports.misc.extensionUtils.getCurrentExtension(); const Utils = Me.imports.utils; const Panel = Me.imports.panel; +const PanelSettings = Me.imports.panelSettings; const Taskbar = Me.imports.taskbar; const Progress = Me.imports.progress; const _ = imports.gettext.domain(Utils.TRANSLATION_DOMAIN).gettext; @@ -573,9 +574,9 @@ var taskbarAppIcon = Utils.defineClass({ }, _setAppIconPadding: function() { - let padding = getIconPadding(); + let padding = getIconPadding(this.dtpPanel.monitor.index); let margin = Me.settings.get_int('appicon-margin'); - + this.actor.set_style('padding:' + (this.dtpPanel.checkIfVertical() ? margin + 'px 0' : '0 ' + margin + 'px;')); this._iconContainer.set_style('padding: ' + padding + 'px;'); }, @@ -1365,8 +1366,8 @@ function cssHexTocssRgba(cssHex, opacity) { return 'rgba(' + [r, g, b].join(',') + ',' + opacity + ')'; } -function getIconPadding() { - let panelSize = Me.settings.get_int('panel-size'); +function getIconPadding(monitorIndex) { + let panelSize = PanelSettings.getPanelSize(Me.settings, monitorIndex); let padding = Me.settings.get_int('appicon-padding'); let availSize = panelSize - Taskbar.MIN_ICON_SIZE - panelSize % 2; @@ -1684,7 +1685,7 @@ var ShowAppsIconWrapper = Utils.defineClass({ }, setShowAppsPadding: function() { - let padding = getIconPadding(); + let padding = getIconPadding(this.realShowAppsIcon._dtpPanel.monitor.index); let sidePadding = Me.settings.get_int('show-apps-icon-side-padding'); let isVertical = this.realShowAppsIcon._dtpPanel.checkIfVertical(); diff --git a/panel.js b/panel.js index 94ba6c6..7c00aa5 100644 --- a/panel.js +++ b/panel.js @@ -36,6 +36,7 @@ const AppIcons = Me.imports.appIcons; const Utils = Me.imports.utils; const Taskbar = Me.imports.taskbar; const Pos = Me.imports.panelPositions; +const PanelSettings = Me.imports.panelSettings; const PanelStyle = Me.imports.panelStyle; const Lang = imports.lang; const Main = imports.ui.main; @@ -535,8 +536,7 @@ var dtpPanel = Utils.defineClass({ }, getPosition: function() { - //for now, use the previous "global" position setting as default. The 'panel-position' should be deleted in the future - let position = this.panelManager.panelPositions[this.monitor.index] || Me.settings.get_string('panel-position'); + let position = PanelSettings.getPanelPosition(Me.settings, this.monitor.index); if (position == Pos.TOP) { return St.Side.TOP; @@ -652,12 +652,12 @@ var dtpPanel = Utils.defineClass({ _bindSettingsChanges: function() { let isVertical = this.checkIfVertical(); - + this._signalsHandler.add( [ Me.settings, [ - 'changed::panel-size', + 'changed::panel-sizes', 'changed::group-apps' ], () => this._resetGeometry() @@ -814,14 +814,15 @@ var dtpPanel = Utils.defineClass({ let topPadding = panelBoxTheme.get_padding(St.Side.TOP); let tbPadding = topPadding + panelBoxTheme.get_padding(St.Side.BOTTOM); let position = this.getPosition(); - let length = Me.settings.get_int('panel-length') / 100; - let anchor = Me.settings.get_string('panel-anchor'); + let length = PanelSettings.getPanelLength(Me.settings, this.monitor.index) / 100; + let anchor = PanelSettings.getPanelAnchor(Me.settings, this.monitor.index); let anchorPlaceOnMonitor = 0; let gsTopPanelOffset = 0; let x = 0, y = 0; let w = 0, h = 0; - this.dtpSize = Me.settings.get_int('panel-size') * scaleFactor; + const panelSize = PanelSettings.getPanelSize(Me.settings, this.monitor.index); + this.dtpSize = panelSize * scaleFactor; if (Me.settings.get_boolean('stockgs-keep-top-panel') && Main.layoutManager.primaryMonitor == this.monitor) { gsTopPanelOffset = Main.layoutManager.panelBox.height - topPadding; diff --git a/panelManager.js b/panelManager.js index 539f721..ba9efeb 100755 --- a/panelManager.js +++ b/panelManager.js @@ -30,7 +30,7 @@ const Me = imports.misc.extensionUtils.getCurrentExtension(); const Overview = Me.imports.overview; const Panel = Me.imports.panel; -const Pos = Me.imports.panelPositions; +const PanelSettings = Me.imports.panelSettings; const Proximity = Me.imports.proximity; const Taskbar = Me.imports.taskbar; const Utils = Me.imports.utils; @@ -72,8 +72,7 @@ var dtpPanelManager = Utils.defineClass({ enable: function(reset) { let dtpPrimaryIndex = Me.settings.get_int('primary-monitor'); - - this.panelPositions = Pos.getSettingsPositions(Me.settings, 'panel-positions'); + this.dtpPrimaryMonitor = Main.layoutManager.monitors[dtpPrimaryIndex] || Main.layoutManager.primaryMonitor; this.proximityManager = new Proximity.ProximityManager(); @@ -240,8 +239,8 @@ var dtpPanelManager = Utils.defineClass({ 'changed::multi-monitors', 'changed::isolate-monitors', 'changed::panel-positions', - 'changed::panel-length', - 'changed::panel-anchor', + 'changed::panel-lengths', + 'changed::panel-anchors', 'changed::stockgs-keep-top-panel' ], () => this._reset() @@ -437,7 +436,7 @@ var dtpPanelManager = Utils.defineClass({ }, _updatePanelElementPositions: function() { - this.panelsElementPositions = Pos.getSettingsPositions(Me.settings, 'panel-element-positions'); + this.panelsElementPositions = PanelSettings.getSettingsJson(Me.settings, 'panel-element-positions'); this.allPanels.forEach(p => p.updateElementPositions()); }, diff --git a/panelPositions.js b/panelPositions.js index 3197d27..52458bb 100644 --- a/panelPositions.js +++ b/panelPositions.js @@ -56,18 +56,6 @@ var optionDialogFunctions = {}; optionDialogFunctions[SHOW_APPS_BTN] = '_showShowAppsButtonOptions'; optionDialogFunctions[DESKTOP_BTN] = '_showDesktopButtonOptions'; -function getSettingsPositions(settings, setting) { - var positions = null; - - try { - positions = JSON.parse(settings.get_string(setting)); - } catch(e) { - log('Error parsing positions: ' + e.message); - } - - return positions; -} - function checkIfCentered(position) { return position == CENTERED || position == CENTERED_MONITOR; } \ No newline at end of file diff --git a/panelSettings.js b/panelSettings.js new file mode 100644 index 0000000..3eeac9b --- /dev/null +++ b/panelSettings.js @@ -0,0 +1,112 @@ +/* + * This file is part of the Dash-To-Panel extension for Gnome 3 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +const Me = imports.misc.extensionUtils.getCurrentExtension(); +const Pos = Me.imports.panelPositions; + +/** Return object representing a settings value that is stored as JSON. */ +function getSettingsJson(settings, setting) { + try { + return JSON.parse(settings.get_string(setting)); + } catch(e) { + log('Error parsing positions: ' + e.message); + } +} +/** Write value object as JSON to setting in settings. */ +function setSettingsJson(settings, setting, value) { + try { + const json = JSON.stringify(value); + settings.set_string(setting, json); + } catch(e) { + log('Error serializing setting: ' + e.message); + } +} + +/** Returns size of panel on a specific monitor, in pixels. */ +function getPanelSize(settings, monitorIndex) { + const sizes = getSettingsJson(settings, 'panel-sizes'); + // Pull in deprecated setting if panel-sizes does not have setting for monitor. + const fallbackSize = settings.get_int('panel-size'); + const theDefault = 48; + return sizes[monitorIndex] || fallbackSize || theDefault; +} + +function setPanelSize(settings, monitorIndex, value) { + if (!(Number.isInteger(value) && value <= 128 && value >= 16)) { + log(`Not setting invalid panel size: ${value}`); + return; + } + let sizes = getSettingsJson(settings, 'panel-sizes'); + sizes[monitorIndex] = value; + setSettingsJson(settings, 'panel-sizes', sizes); +} + +/** + * Returns length of panel on a specific monitor, as a whole number percent, + * from settings. e.g. 100 + */ +function getPanelLength(settings, monitorIndex) { + const lengths = getSettingsJson(settings, 'panel-lengths'); + const theDefault = 100; + return lengths[monitorIndex] || theDefault; +} + +function setPanelLength(settings, monitorIndex, value) { + if (!(Number.isInteger(value) && value <= 100 && value >= 0)) { + log(`Not setting invalid panel length: ${value}`); + return; + } + let lengths = getSettingsJson(settings, 'panel-lengths'); + lengths[monitorIndex] = value; + setSettingsJson(settings, 'panel-lengths', lengths); +} + +/** Returns position of panel on a specific monitor. */ +function getPanelPosition(settings, monitorIndex) { + const positions = getSettingsJson(settings, 'panel-positions'); + const fallbackPosition = settings.get_string('panel-position'); + const theDefault = Pos.BOTTOM; + return positions[monitorIndex] || fallbackPosition || theDefault; +} + +function setPanelPosition(settings, monitorIndex, value) { + if (!(value === Pos.TOP || value === Pos.BOTTOM || value === Pos.LEFT + || value === Pos.RIGHT)) { + log(`Not setting invalid panel position: ${value}`); + return; + } + const positions = getSettingsJson(settings, 'panel-positions'); + positions[monitorIndex] = value; + setSettingsJson(settings, 'panel-positions', positions); +} + +/** Returns anchor location of panel on a specific monitor. */ +function getPanelAnchor(settings, monitorIndex) { + const anchors = getSettingsJson(settings, 'panel-anchors'); + const theDefault = Pos.MIDDLE; + return anchors[monitorIndex] || theDefault; +} + +function setPanelAnchor(settings, monitorIndex, value) { + if (!(value === Pos.START || value === Pos.MIDDLE || value === Pos.END)) { + log(`Not setting invalid panel anchor: ${value}`); + return; + } + const anchors = getSettingsJson(settings, 'panel-anchors'); + anchors[monitorIndex] = value; + setSettingsJson(settings, 'panel-anchors', anchors); +} diff --git a/prefs.js b/prefs.js index 7c575ec..76b3149 100644 --- a/prefs.js +++ b/prefs.js @@ -35,6 +35,7 @@ const Gettext = imports.gettext.domain(Me.metadata['gettext-domain']); const _ = Gettext.gettext; const N_ = function(e) { return e }; const Update = Me.imports.update; +const PanelSettings = Me.imports.panelSettings; const Pos = Me.imports.panelPositions; const SCALE_UPDATE_TIMEOUT = 500; @@ -220,35 +221,22 @@ const Settings = new Lang.Class({ topRadio.set_tooltip_text(!topAvailable ? _('Unavailable when gnome-shell top panel is present') : ''); }, - /** - * Returns an object, with monitor index string keys to values that are Pos.TOP, Pos.BOTTOM, Pos.LEFT, - * or Pos.RIGHT. - */ - _getPanelPositions: function() { - return Pos.getSettingsPositions(this._settings, 'panel-positions'); - }, - _getPanelPosition: function(monitorIndex) { - let panelPositionsSettings = this._getPanelPositions(); - - return panelPositionsSettings[monitorIndex] || this._settings.get_string('panel-position'); + return PanelSettings.getPanelPosition(this._settings, monitorIndex); }, _setPanelPosition: function(position) { - let panelPositionsSettings = this._getPanelPositions(); - let preventTop = this._settings.get_boolean('stockgs-keep-top-panel') && position == Pos.TOP; - let monitorSync = this._settings.get_boolean('panel-element-positions-monitors-sync'); - let monitors = monitorSync ? this.monitors : [this._currentMonitorIndex]; - - monitors.forEach(m => panelPositionsSettings[m] = preventTop && this.monitors[0] == m ? Pos.BOTTOM : position); - - this._settings.set_string('panel-positions', JSON.stringify(panelPositionsSettings)); - this._setAnchorLabels(); + const monitorSync = this._settings.get_boolean('panel-element-positions-monitors-sync'); + const monitorsToSetFor = monitorSync ? this.monitors : [this._currentMonitorIndex]; + monitorsToSetFor.forEach(monitorIndex => { + PanelSettings.setPanelPosition(this._settings, monitorIndex, position); + }); + this._setAnchorLabels(this._currentMonitorIndex); }, _setPositionRadios: function(position) { this._ignorePositionRadios = true; - + switch (position) { case Pos.BOTTOM: this._builder.get_object('position_bottom_button').set_active(true); @@ -268,16 +256,23 @@ const Settings = new Lang.Class({ }, /** - * Set panel anchor combo labels according to whether panel is vertical, horizontal, or a mix. + * Set panel anchor combo labels according to whether the monitor's panel is vertical + * or horizontal, or if all monitors' panels are being configured and they are a mix + * of vertical and horizontal. */ - _setAnchorLabels: function() { - const positions = this._getPanelPositions(); - const monitorIndices = Object.getOwnPropertyNames(positions); - const allVertical = monitorIndices.every(i => positions[i] === Pos.LEFT || positions[i] === Pos.RIGHT); - const allHorizontal = monitorIndices.every(i => positions[i] === Pos.TOP || positions[i] === Pos.BOTTOM); + _setAnchorLabels: function(currentMonitorIndex) { + const monitorSync = this._settings.get_boolean('panel-element-positions-monitors-sync'); + const monitorsToSetFor = monitorSync ? this.monitors : [currentMonitorIndex]; + const allVertical = monitorsToSetFor.every(i => { + const position = PanelSettings.getPanelPosition(this._settings, i); + return position === Pos.LEFT || position === Pos.RIGHT + }); + const allHorizontal = monitorsToSetFor.every(i => { + const position = PanelSettings.getPanelPosition(this._settings, i); + return position === Pos.TOP || position === Pos.BOTTOM; + }); const anchor_combo = this._builder.get_object('panel_anchor_combo'); - const anchor = this._settings.get_string('panel-anchor'); anchor_combo.remove_all(); if (allHorizontal) { @@ -289,24 +284,69 @@ const Settings = new Lang.Class({ anchor_combo.append(Pos.MIDDLE, _('Middle')); anchor_combo.append(Pos.END, _('Bottom')); } else { - // Mix of horizontal and vertical panels on different monitors. + // Setting for a mix of horizontal and vertical panels on different monitors. anchor_combo.append(Pos.START, _('Start')); anchor_combo.append(Pos.MIDDLE, _('Middle')); anchor_combo.append(Pos.END, _('End')); } - anchor_combo.set_active_id(anchor); + // Set combo box after re-populating its options. But only if it's for a single-panel + // configuration, or a multi-panel configuration where they all have the same anchor + // setting. So don't set the combo box if there is a multi-panel configuration with + // different anchor settings. + const someAnchor = PanelSettings.getPanelAnchor(this._settings, currentMonitorIndex); + if (monitorsToSetFor.every(i => + PanelSettings.getPanelAnchor(this._settings, i) === someAnchor)) { + const panel_anchor = PanelSettings.getPanelAnchor(this._settings, currentMonitorIndex); + this._builder.get_object('panel_anchor_combo').set_active_id(panel_anchor); + } + }, + + /** + * When a monitor is selected, update the widgets for panel position, size, anchoring, + * and contents so they accurately show the settings for the panel on that monitor. + */ + _updateWidgetSettingsForMonitor: function(monitorIndex) { + // Update display of panel screen position setting + this._maybeDisableTopPosition(); + const panelPosition = this._getPanelPosition(monitorIndex); + this._setPositionRadios(panelPosition); + + // Update display of thickness, length, and anchor settings + const panel_size_scale = this._builder.get_object('panel_size_scale'); + const size = PanelSettings.getPanelSize(this._settings, monitorIndex); + panel_size_scale.set_value(size); + + const panel_length_scale = this._builder.get_object('panel_length_scale'); + const length = PanelSettings.getPanelLength(this._settings, monitorIndex); + panel_length_scale.set_value(length); + this._setAnchorWidgetSensitivity(length); + + this._setAnchorLabels(monitorIndex); + + // Update display of panel content settings + this._displayPanelPositionsForMonitor(monitorIndex); + }, + + /** + * Anchor is only relevant if panel length is less than 100%. Enable or disable + * anchor widget sensitivity accordingly. + */ + _setAnchorWidgetSensitivity: function(panelLength) { + const isPartialLength = panelLength < 100; + this._builder.get_object('panel_anchor_label').set_sensitive(isPartialLength); + this._builder.get_object('panel_anchor_combo').set_sensitive(isPartialLength); }, _displayPanelPositionsForMonitor: function(monitorIndex) { let taskbarListBox = this._builder.get_object('taskbar_display_listbox'); - + taskbarListBox.get_children().forEach(c => c.destroy()); let labels = {}; let panelPosition = this._getPanelPosition(monitorIndex); let isVertical = panelPosition == Pos.LEFT || panelPosition == Pos.RIGHT; - let panelElementPositionsSettings = Pos.getSettingsPositions(this._settings, 'panel-element-positions'); + let panelElementPositionsSettings = PanelSettings.getSettingsJson(this._settings, 'panel-element-positions'); let panelElementPositions = panelElementPositionsSettings[monitorIndex] || Pos.defaults; let updateElementsSettings = () => { let newPanelElementPositions = []; @@ -320,14 +360,12 @@ const Settings = new Lang.Class({ position: c.positionCombo.get_active_id() }); }); - + monitors.forEach(m => panelElementPositionsSettings[m] = newPanelElementPositions); this._settings.set_string('panel-element-positions', JSON.stringify(panelElementPositionsSettings)); }; - this._maybeDisableTopPosition(); - this._setPositionRadios(panelPosition); - + labels[Pos.SHOW_APPS_BTN] = _('Show Applications button'); labels[Pos.ACTIVITIES_BTN] = _('Activities button'); labels[Pos.TASKBAR] = _('Taskbar'); @@ -515,13 +553,12 @@ const Settings = new Lang.Class({ _bindSettings: function() { // size options let panel_size_scale = this._builder.get_object('panel_size_scale'); - panel_size_scale.set_range(DEFAULT_PANEL_SIZES[DEFAULT_PANEL_SIZES.length-1], DEFAULT_PANEL_SIZES[0]); - panel_size_scale.set_value(this._settings.get_int('panel-size')); + panel_size_scale.set_range(DEFAULT_PANEL_SIZES[DEFAULT_PANEL_SIZES.length - 1], DEFAULT_PANEL_SIZES[0]); DEFAULT_PANEL_SIZES.slice(1, -1).forEach(function(val) { panel_size_scale.add_mark(val, Gtk.PositionType.TOP, val.toString()); }); - // Corrent for rtl languages + // Correct for rtl languages if (this._rtl) { // Flip value position: this is not done automatically panel_size_scale.set_value_pos(Gtk.PositionType.LEFT); @@ -786,7 +823,11 @@ const Settings = new Lang.Class({ 'sensitive', Gio.SettingsBindFlags.INVERT_BOOLEAN); - this._settings.connect('changed::panel-element-positions-monitors-sync', () => this._maybeDisableTopPosition()); + this._settings.connect('changed::panel-element-positions-monitors-sync', () => { + this._maybeDisableTopPosition(); + // The anchor combo box may has different labels for single- or all-monitor configuration. + this._setAnchorLabels(this._currentMonitorIndex); + }); this._builder.get_object('multimon_primary_combo').connect('changed', Lang.bind (this, function(widget) { this._settings.set_int('primary-monitor', this.monitors[widget.get_active()]); @@ -794,12 +835,9 @@ const Settings = new Lang.Class({ this._builder.get_object('taskbar_position_monitor_combo').connect('changed', Lang.bind (this, function(widget) { this._currentMonitorIndex = this.monitors[widget.get_active()]; - this._displayPanelPositionsForMonitor(this._currentMonitorIndex); + this._updateWidgetSettingsForMonitor(this._currentMonitorIndex); })); - //panel positions - this._displayPanelPositionsForMonitor(this._currentMonitorIndex); - this._settings.bind('multi-monitors', this._builder.get_object('multimon_multi_switch'), 'active', @@ -809,35 +847,31 @@ const Settings = new Lang.Class({ this._builder.get_object('multimon_multi_switch').set_sensitive(false); } - // Length and anchoring along screen edge - - // Anchor is only relevant if panel length is less than 100%. - const setAnchorWidgetSensitivity = (panelLength) => { - const isPartialLength = panelLength < 100; - this._builder.get_object('panel_anchor_label').set_sensitive(isPartialLength); - this._builder.get_object('panel_anchor_combo').set_sensitive(isPartialLength); - } - const panel_length_scale = this._builder.get_object('panel_length_scale'); - const length = this._settings.get_int('panel-length'); - panel_length_scale.set_value(length); - setAnchorWidgetSensitivity(length); panel_length_scale.connect('value-changed', Lang.bind (this, function(widget) { const value = widget.get_value(); - this._settings.set_int('panel-length', value); - setAnchorWidgetSensitivity(value); + const monitorSync = this._settings.get_boolean('panel-element-positions-monitors-sync'); + const monitorsToSetFor = monitorSync ? this.monitors : [this._currentMonitorIndex]; + monitorsToSetFor.forEach(monitorIndex => { + PanelSettings.setPanelLength(this._settings, monitorIndex, value); + }); + + this._setAnchorWidgetSensitivity(value); })); - this._builder.get_object('panel_anchor_combo').set_active_id(this._settings.get_string('panel-anchor')); this._builder.get_object('panel_anchor_combo').connect('changed', Lang.bind (this, function(widget) { const value = widget.get_active_id(); // Value can be null while anchor labels are being swapped out if (value !== null) { - this._settings.set_string('panel-anchor', value); + const monitorSync = this._settings.get_boolean('panel-element-positions-monitors-sync'); + const monitorsToSetFor = monitorSync ? this.monitors : [this._currentMonitorIndex]; + monitorsToSetFor.forEach(monitorIndex => { + PanelSettings.setPanelAnchor(this._settings, monitorIndex, value); + }); } })); - this._setAnchorLabels(); + this._updateWidgetSettingsForMonitor(this._currentMonitorIndex); //dynamic opacity this._settings.bind('trans-use-custom-bg', @@ -1922,14 +1956,20 @@ const Settings = new Lang.Class({ {objectName: 'tray_padding_scale', valueName: 'tray-padding', range: DEFAULT_PADDING_SIZES }, {objectName: 'leftbox_padding_scale', valueName: 'leftbox-padding', range: DEFAULT_PADDING_SIZES }, {objectName: 'statusicon_padding_scale', valueName: 'status-icon-padding', range: DEFAULT_PADDING_SIZES }, - {objectName: 'panel_length_scale', valueName: 'panel-length', range: LENGTH_MARKS } + {objectName: 'panel_length_scale', valueName: '', range: LENGTH_MARKS } ]; - + for(var idx in sizeScales) { let size_scale = this._builder.get_object(sizeScales[idx].objectName); let range = sizeScales[idx].range; - size_scale.set_range(range[range.length-1], range[0]); - size_scale.set_value(this._settings.get_int(sizeScales[idx].valueName)); + size_scale.set_range(range[range.length - 1], range[0]); + let value; + if (sizeScales[idx].objectName === 'panel_length_scale') { + value = PanelSettings.getPanelLength(this._settings, this._currentMonitorIndex); + } else { + value = this._settings.get_int(sizeScales[idx].valueName); + } + size_scale.set_value(value); // Add marks from range arrays, omitting the first and last values. range.slice(1, -1).forEach(function(val) { size_scale.add_mark(val, Gtk.PositionType.TOP, val.toString()); @@ -2141,12 +2181,18 @@ const Settings = new Lang.Class({ }, panel_size_scale_value_changed_cb: function(scale) { - // Avoid settings the size consinuosly + // Avoid settings the size continuously if (this._panel_size_timeout > 0) Mainloop.source_remove(this._panel_size_timeout); this._panel_size_timeout = Mainloop.timeout_add(SCALE_UPDATE_TIMEOUT, Lang.bind(this, function() { - this._settings.set_int('panel-size', scale.get_value()); + const value = scale.get_value(); + const monitorSync = this._settings.get_boolean('panel-element-positions-monitors-sync'); + const monitorsToSetFor = monitorSync ? this.monitors : [this._currentMonitorIndex]; + monitorsToSetFor.forEach(monitorIndex => { + PanelSettings.setPanelSize(this._settings, monitorIndex, value); + }); + this._panel_size_timeout = 0; return GLib.SOURCE_REMOVE; })); 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 30967cf..728c520 100644 --- a/schemas/org.gnome.shell.extensions.dash-to-panel.gschema.xml +++ b/schemas/org.gnome.shell.extensions.dash-to-panel.gschema.xml @@ -40,11 +40,6 @@ - - - - - @@ -74,7 +69,7 @@ 'BOTTOM' - Panel position + Panel position (Deprecated) Panel is shown on the Bottom or Top of the screen. @@ -92,19 +87,24 @@ Panel element positions Panel element positions (JSON). - - 100 - Percentage of screen edge for panel to span - Length of the panel, in percent. + + '{}' + Percentages of screen edge for panel to span + Length of the panels, in percent (JSON). - - 'MIDDLE' - Position along screen edge - Where to show the panel if it is not the full length of the screen edge. + + '{}' + Positions along screen edge + Where to show the panels if it is not the full length of the screen edge (JSON). + + + '{}' + Panel sizes + Sizes of panels, in pixels. 48 - Panel size + Panel size (Deprecated) Set the size of the panel. diff --git a/taskbar.js b/taskbar.js index 60bcb17..89849d3 100644 --- a/taskbar.js +++ b/taskbar.js @@ -46,6 +46,7 @@ const Workspace = imports.ui.workspace; const Me = imports.misc.extensionUtils.getCurrentExtension(); const AppIcons = Me.imports.appIcons; const Panel = Me.imports.panel; +const PanelSettings = Me.imports.panelSettings; const Utils = Me.imports.utils; const WindowPreview = Me.imports.windowPreview; @@ -700,7 +701,8 @@ var taskbar = Utils.defineClass({ }, _adjustIconSize: function() { - let panelSize = Me.settings.get_int('panel-size'); + const thisMonitorIndex = this.dtpPanel.monitor.index; + let panelSize = PanelSettings.getPanelSize(Me.settings, thisMonitorIndex); let availSize = panelSize - Me.settings.get_int('appicon-padding') * 2; let minIconSize = MIN_ICON_SIZE + panelSize % 2; diff --git a/utils.js b/utils.js index 8081fca..c2469b3 100644 --- a/utils.js +++ b/utils.js @@ -23,7 +23,7 @@ const Clutter = imports.gi.Clutter; const Config = imports.misc.config; -const GdkPixbuf = imports.gi.GdkPixbuf +const GdkPixbuf = imports.gi.GdkPixbuf; const Gi = imports._gi; const Gio = imports.gi.Gio; const GLib = imports.gi.GLib; diff --git a/windowPreview.js b/windowPreview.js index ab35af9..0464c87 100644 --- a/windowPreview.js +++ b/windowPreview.js @@ -144,7 +144,7 @@ var PreviewMenu = Utils.defineClass({ [ Me.settings, [ - 'changed::panel-size', + 'changed::panel-sizes', 'changed::window-preview-size', 'changed::window-preview-padding', 'changed::window-preview-show-title'