diff --git a/Settings.ui b/Settings.ui index 01a1d32..b6a71e2 100644 --- a/Settings.ui +++ b/Settings.ui @@ -5060,9 +5060,7 @@ True True False - center center - 0 True True @@ -5070,7 +5068,7 @@ False True - 1 + 0 @@ -5079,20 +5077,52 @@ True True False - center center - 0 bottom True dots_bottom_button + + False + True + 1 + + + + + Left + True + True + False + center + True + dots_bottom_button + + False True 2 + + + Right + True + True + False + center + True + dots_bottom_button + + + + False + True + 3 + + False diff --git a/appIcons.js b/appIcons.js index 52c9a28..fd0a35c 100644 --- a/appIcons.js +++ b/appIcons.js @@ -66,7 +66,9 @@ let DOT_STYLE = { let DOT_POSITION = { TOP: "TOP", - BOTTOM: "BOTTOM" + BOTTOM: "BOTTOM", + LEFT: 'LEFT', + RIGHT: 'RIGHT' } let recentlyClickedAppLoopId = 0; @@ -132,9 +134,15 @@ var taskbarAppIcon = Utils.defineClass({ let isVertical = Panel.checkIfVertical(); + let dtpIconContainerOpts = { layout_manager: new Clutter.BinLayout() }; + + if (!this._isGroupApps) { + dtpIconContainerOpts.style = 'padding: ' + (isVertical ? '4px' : '0 4px'); + } + this._container = new St.Widget({ style_class: 'dtp-container', layout_manager: new Clutter.BinLayout() }); this._dotsContainer = new St.Widget({ layout_manager: new Clutter.BinLayout() }); - this._dtpIconContainer = new St.Widget({ style: 'padding: ' + (isVertical ? '4px 0' : '0 4px'), layout_manager: new Clutter.BinLayout() }); + this._dtpIconContainer = new St.Widget(dtpIconContainerOpts); this.actor.remove_actor(this._iconContainer); @@ -209,7 +217,7 @@ var taskbarAppIcon = Utils.defineClass({ this._dtpSettingsSignalIds = [ Me.settings.connect('changed::dot-position', Lang.bind(this, this._settingsChangeRefresh)), - Me.settings.connect('changed::dot-size', Lang.bind(this, this._updateDotSize)), + Me.settings.connect('changed::dot-size', Lang.bind(this, this._settingsChangeRefresh)), Me.settings.connect('changed::dot-style-focused', Lang.bind(this, this._settingsChangeRefresh)), Me.settings.connect('changed::dot-style-unfocused', Lang.bind(this, this._settingsChangeRefresh)), Me.settings.connect('changed::dot-color-dominant', Lang.bind(this, this._settingsChangeRefresh)), @@ -376,7 +384,6 @@ var taskbarAppIcon = Utils.defineClass({ this._focusedDots = new St.Widget({ layout_manager: new Clutter.BinLayout(), x_expand: true, y_expand: true, - height: this._getRunningIndicatorHeight(), visible: false }); @@ -385,9 +392,10 @@ var taskbarAppIcon = Utils.defineClass({ this.actor.disconnect(mappedId); }); } else { - this._focusedDots = new St.DrawingArea({ width:1, y_expand: true }); + let dotsOpts = { width: 1, y_expand: true, pivot_point: new Clutter.Point({ x: .5, y: .5 }) }; + this._focusedDots = new St.DrawingArea(dotsOpts), this._focusedDots._tweeningToWidth = null; - this._unfocusedDots = new St.DrawingArea({width:1, y_expand: true}); + this._unfocusedDots = new St.DrawingArea(dotsOpts); this._unfocusedDots._tweeningToWidth = null; this._focusedDots.connect('repaint', Lang.bind(this, function() { @@ -418,14 +426,6 @@ var taskbarAppIcon = Utils.defineClass({ this._dotsContainer.add_child(this._focusedDots); }, - _updateDotSize: function() { - if (!this._isGroupApps) { - this._focusedDots.height = this._getRunningIndicatorHeight(); - } - - this._settingsChangeRefresh(); - }, - _settingsChangeRefresh: function() { if (this._isGroupApps) { this._updateWindows(); @@ -449,7 +449,6 @@ var taskbarAppIcon = Utils.defineClass({ this._windowTitle.clutter_text.natural_width_set = useFixedWidth; this._windowTitle.set_style('font-size: ' + Me.settings.get_int('group-apps-label-font-size') + 'px;' + 'font-weight: ' + fontWeight + ';' + - (Panel.checkIfVertical() ? 'padding-left: 4px;' : '') + (useFixedWidth ? '' : 'max-width: ' + maxLabelWidth + 'px;') + 'color: ' + Me.settings.get_string('group-apps-label-font-color')); } @@ -587,20 +586,26 @@ var taskbarAppIcon = Utils.defineClass({ _displayProperIndicator: function (force) { let isFocused = this._isFocusedWindow(); + let position = Me.settings.get_string('dot-position'); this._setIconStyle(isFocused); if(!this._isGroupApps) { if (this.window && (Me.settings.get_boolean('group-apps-underline-unfocused') || isFocused)) { - let dotPosition = Me.settings.get_string('dot-position'); + let align = Clutter.ActorAlign[position == DOT_POSITION.TOP || position == DOT_POSITION.LEFT ? 'START' : 'END']; - this._focusedDots.y_align = dotPosition == DOT_POSITION.TOP ? Clutter.ActorAlign.START : Clutter.ActorAlign.END; + this._focusedDots.set_size(0, 0); + this._focusedDots[position == DOT_POSITION.TOP || position == DOT_POSITION.BOTTOM ? 'height' : 'width'] = this._getRunningIndicatorSize(); + + this._focusedDots.y_align = this._focusedDots.x_align = Clutter.ActorAlign.FILL; + this._focusedDots[(position == DOT_POSITION.TOP || position == DOT_POSITION.BOTTOM ? 'y' : 'x') + '_align'] = align; this._focusedDots.background_color = this._getRunningIndicatorColor(isFocused); this._focusedDots.show(); } else if (this._focusedDots.visible) { this._focusedDots.hide(); } } else { + let rotation = 0; let containerWidth = this._container.width; let focusedDotStyle = Me.settings.get_string('dot-style-focused'); let unfocusedDotStyle = Me.settings.get_string('dot-style-unfocused'); @@ -622,6 +627,16 @@ var taskbarAppIcon = Utils.defineClass({ this.actor.remove_style_class_name('focused'); } }); + + if (position == DOT_POSITION.BOTTOM) { + rotation = 180; + } else if (position == DOT_POSITION.LEFT) { + rotation = 270; + } else if (position == DOT_POSITION.RIGHT) { + rotation = 90; + } + + this._focusedDots.rotation_angle_z = this._unfocusedDots.rotation_angle_z = rotation; if(focusedIsWide) { newFocusedDotsWidth = (isFocused && this._nWindows > 0) ? containerWidth : 0; @@ -911,7 +926,7 @@ var taskbarAppIcon = Utils.defineClass({ return Math.min(this._nWindows, MAX_INDICATORS); }, - _getRunningIndicatorHeight: function() { + _getRunningIndicatorSize: function() { return Me.settings.get_int('dot-size') * St.ThemeContext.get_for_stage(global.stage).scale_factor; }, @@ -970,16 +985,14 @@ var taskbarAppIcon = Utils.defineClass({ let bodyColor = this._getRunningIndicatorColor(isFocused); let [width, height] = area.get_surface_size(); let cr = area.get_context(); - let size = this._getRunningIndicatorHeight(); - let padding = 0; // distance from the margin - let yOffset = Me.settings.get_string('dot-position') == DOT_POSITION.TOP ? 0 : (height - padding - size); + let size = this._getRunningIndicatorSize(); if(type == DOT_STYLE.DOTS) { // Draw the required numbers of dots let radius = size/2; let spacing = Math.ceil(width/18); // separation between the dots - cr.translate((width - (2*n)*radius - (n-1)*spacing)/2, yOffset); + cr.translate((width - (2*n)*radius - (n-1)*spacing)/2, 0); Clutter.cairo_set_source_color(cr, bodyColor); for (let i = 0; i < n; i++) { @@ -990,7 +1003,7 @@ var taskbarAppIcon = Utils.defineClass({ } else if(type == DOT_STYLE.SQUARES) { let spacing = Math.ceil(width/18); // separation between the dots - cr.translate(Math.floor((width - n*size - (n-1)*spacing)/2), yOffset); + cr.translate(Math.floor((width - n*size - (n-1)*spacing)/2), 0); Clutter.cairo_set_source_color(cr, bodyColor); for (let i = 0; i < n; i++) { @@ -1002,7 +1015,7 @@ var taskbarAppIcon = Utils.defineClass({ let spacing = Math.ceil(width/18); // separation between the dots let dashLength = Math.floor(width/4) - spacing; - cr.translate(Math.floor((width - n*dashLength - (n-1)*spacing)/2), yOffset); + cr.translate(Math.floor((width - n*dashLength - (n-1)*spacing)/2), 0); Clutter.cairo_set_source_color(cr, bodyColor); for (let i = 0; i < n; i++) { @@ -1014,7 +1027,7 @@ var taskbarAppIcon = Utils.defineClass({ let spacing = Math.ceil(width/18); // separation between the dots let dashLength = Math.ceil((width - ((n-1)*spacing))/n); - cr.translate(0, yOffset); + cr.translate(0, 0); Clutter.cairo_set_source_color(cr, bodyColor); for (let i = 0; i < n; i++) { @@ -1026,7 +1039,7 @@ var taskbarAppIcon = Utils.defineClass({ let spacing = size; // separation between the dots let lineLength = width - (size*(n-1)) - (spacing*(n-1)); - cr.translate(0, yOffset); + cr.translate(0, 0); Clutter.cairo_set_source_color(cr, bodyColor); cr.newSubPath(); @@ -1038,7 +1051,7 @@ var taskbarAppIcon = Utils.defineClass({ cr.fill(); } else if (type == DOT_STYLE.METRO) { if(n <= 1) { - cr.translate(0, yOffset); + cr.translate(0, 0); Clutter.cairo_set_source_color(cr, bodyColor); cr.newSubPath(); cr.rectangle(0, 0, width, size); @@ -1049,7 +1062,7 @@ var taskbarAppIcon = Utils.defineClass({ let blackenedColor = bodyColor.shade(.3); let darkenedColor = bodyColor.shade(.7); - cr.translate(0, yOffset); + cr.translate(0, 0); Clutter.cairo_set_source_color(cr, bodyColor); cr.newSubPath(); @@ -1065,7 +1078,7 @@ var taskbarAppIcon = Utils.defineClass({ cr.fill(); } } else { // solid - cr.translate(0, yOffset); + cr.translate(0, 0); Clutter.cairo_set_source_color(cr, bodyColor); cr.newSubPath(); cr.rectangle(0, 0, width, size); diff --git a/panel.js b/panel.js index e1f8af2..9dc66cc 100644 --- a/panel.js +++ b/panel.js @@ -60,6 +60,7 @@ let tracker = Shell.WindowTracker.get_default(); var sizeFunc; var fixedCoord; var varCoord; +var size; function getPosition() { let position = Me.settings.get_string('panel-position'); @@ -99,18 +100,6 @@ var dtpPanelWrapper = Utils.defineClass({ Utils.wrapActor(this.panel); Utils.wrapActor(this.panel.statusArea.activities || 0); - - if (!isSecondary) { - if (checkIfVertical()) { - sizeFunc = 'get_preferred_height', - fixedCoord = { c1: 'x1', c2: 'x2' }, - varCoord = { c1: 'y1', c2: 'y2' }; - } else { - sizeFunc = 'get_preferred_width'; - fixedCoord = { c1: 'y1', c2: 'y2' }; - varCoord = { c1: 'x1', c2: 'x2' }; - } - } }, enable : function() { @@ -454,8 +443,7 @@ var dtpPanelWrapper = Utils.defineClass({ _bindSettingsChanges: function() { this._dtpSettingsSignalIds = [ Me.settings.connect('changed::panel-size', Lang.bind(this, function() { - this._setPanelPosition(); - this.taskbar.resetAppIcons(); + this._resetGeometry(); })), Me.settings.connect('changed::appicon-margin', Lang.bind(this, function() { @@ -482,14 +470,13 @@ var dtpPanelWrapper = Utils.defineClass({ this._displayShowDesktopButton(Me.settings.get_boolean('show-showdesktop-button')); })), - Me.settings.connect('changed::showdesktop-button-width', () => this._setShowDesktopButtonWidth()) + Me.settings.connect('changed::showdesktop-button-width', () => this._setShowDesktopButtonWidth()), + + Me.settings.connect('changed::group-apps', () => this._resetGeometry()) ]; if (checkIfVertical()) { - this._dtpSettingsSignalIds.push( - Me.settings.connect('changed::group-apps-label-max-width', () => this._resetGeometry()), - Me.settings.connect('changed::group-apps', () => this._resetGeometry()), - ); + this._dtpSettingsSignalIds.push(Me.settings.connect('changed::group-apps-label-max-width', () => this._resetGeometry())); } }, @@ -508,19 +495,30 @@ var dtpPanelWrapper = Utils.defineClass({ }, _getGeometry: function() { + let scaleFactor = St.ThemeContext.get_for_stage(global.stage).scale_factor || 1; let position = getPosition(); - let size = Me.settings.get_int('panel-size'); let x = 0, y = 0; let w = 0, h = 0; + size = Me.settings.get_int('panel-size') * scaleFactor; + if (checkIfVertical()) { if (!Me.settings.get_boolean('group-apps')) { - size += Me.settings.get_int('group-apps-label-max-width'); + // add 8 for the 4px css side padding of _dtpIconContainer when vertical + size += Me.settings.get_int('group-apps-label-max-width') + 8 / scaleFactor; } + sizeFunc = 'get_preferred_height', + fixedCoord = { c1: 'x1', c2: 'x2' }, + varCoord = { c1: 'y1', c2: 'y2' }; + w = size; h = this.monitor.height; } else { + sizeFunc = 'get_preferred_width'; + fixedCoord = { c1: 'y1', c2: 'y2' }; + varCoord = { c1: 'x1', c2: 'x2' }; + w = this.monitor.width; h = size; } @@ -539,8 +537,7 @@ var dtpPanelWrapper = Utils.defineClass({ return { x: x, y: y, w: w, h: h, - position: position, - size: size * (St.ThemeContext.get_for_stage(global.stage).scale_factor || 1) + position: position }; }, diff --git a/panelManager.js b/panelManager.js index fb61ff7..05bdcfc 100755 --- a/panelManager.js +++ b/panelManager.js @@ -309,7 +309,7 @@ var dtpPanelManager = Utils.defineClass({ _getBoxPointerPreferredHeight: function(boxPointer, alloc, monitor) { if (boxPointer._dtpInPanel && boxPointer.sourceActor && Me.settings.get_boolean('intellihide')) { monitor = monitor || Main.layoutManager.findMonitorForActor(boxPointer.sourceActor); - let excess = alloc.natural_size + Me.settings.get_int('panel-size') + 10 - monitor.height; // 10 is arbitrary + let excess = alloc.natural_size + Panel.size + 10 - monitor.height; // 10 is arbitrary if (excess > 0) { alloc.natural_size -= excess; diff --git a/prefs.js b/prefs.js index 8c905e6..32ba4bd 100644 --- a/prefs.js +++ b/prefs.js @@ -256,7 +256,12 @@ const Settings = new Lang.Class({ case 'TOP': this._builder.get_object('dots_top_button').set_active(true); break; - + case 'LEFT': + this._builder.get_object('dots_left_button').set_active(true); + break; + case 'RIGHT': + this._builder.get_object('dots_right_button').set_active(true); + break; } this._builder.get_object('dot_style_focused_combo').set_active_id(this._settings.get_string('dot-style-focused')); @@ -1809,6 +1814,16 @@ const Settings = new Lang.Class({ this._settings.set_string('dot-position', "TOP"); }, + dots_left_button_toggled_cb: function(button) { + if (button.get_active()) + this._settings.set_string('dot-position', "LEFT"); + }, + + dots_right_button_toggled_cb: function(button) { + if (button.get_active()) + this._settings.set_string('dot-position', "RIGHT"); + }, + preview_title_position_bottom_button_toggled_cb: function(button) { if (button.get_active()) this._settings.set_string('window-preview-title-position', 'BOTTOM'); diff --git a/windowPreview.js b/windowPreview.js index c7542da..2aa3fd6 100644 --- a/windowPreview.js +++ b/windowPreview.js @@ -78,7 +78,7 @@ var PreviewMenu = Utils.defineClass({ this.isVertical = geom.position == St.Side.LEFT || geom.position == St.Side.RIGHT; this._translationProp = 'translation_' + (this.isVertical ? 'x' : 'y'); this._translationDirection = (geom.position == St.Side.TOP || geom.position == St.Side.LEFT ? -1 : 1); - this._translationOffset = Math.min(Me.settings.get_int('panel-size'), MAX_TRANSLATION) * this._translationDirection; + this._translationOffset = Math.min(Panel.size, MAX_TRANSLATION) * this._translationDirection; this.menu = new St.Widget({ name: 'preview-menu', @@ -417,7 +417,6 @@ var PreviewMenu = Utils.defineClass({ let x, y, w, h; let geom = this._panelWrapper.geom; let panelBoxTheme = this._panelWrapper.panelBox.get_theme_node(); - let panelSize = geom.size; let previewSize = (Me.settings.get_int('window-preview-size') + Me.settings.get_int('window-preview-padding') * 2) * scaleFactor; @@ -432,13 +431,13 @@ var PreviewMenu = Utils.defineClass({ } if (geom.position == St.Side.LEFT) { - x = this._panelWrapper.monitor.x + panelSize + panelBoxTheme.get_padding(St.Side.LEFT); + x = this._panelWrapper.monitor.x + Panel.size + panelBoxTheme.get_padding(St.Side.LEFT); } else if (geom.position == St.Side.RIGHT) { - x = this._panelWrapper.monitor.x + this._panelWrapper.monitor.width - (panelSize + previewSize) - panelBoxTheme.get_padding(St.Side.RIGHT); + x = this._panelWrapper.monitor.x + this._panelWrapper.monitor.width - (Panel.size + previewSize) - panelBoxTheme.get_padding(St.Side.RIGHT); } else if (geom.position == St.Side.TOP) { - y = this._panelWrapper.monitor.y + panelSize + panelBoxTheme.get_padding(St.Side.TOP); + y = this._panelWrapper.monitor.y + Panel.size + panelBoxTheme.get_padding(St.Side.TOP); } else { //St.Side.BOTTOM - y = this._panelWrapper.monitor.y + this._panelWrapper.monitor.height - (panelSize + panelBoxTheme.get_padding(St.Side.BOTTOM) + previewSize + headerHeight); + y = this._panelWrapper.monitor.y + this._panelWrapper.monitor.height - (Panel.size + panelBoxTheme.get_padding(St.Side.BOTTOM) + previewSize + headerHeight); } Utils.setClip(this, x, y, w, h);