diff --git a/appIcons.js b/appIcons.js
index bfc9bda..ad0e82a 100644
--- a/appIcons.js
+++ b/appIcons.js
@@ -150,7 +150,7 @@ var taskbarAppIcon = Utils.defineClass({
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({ layout_manager: new Clutter.BinLayout(), style: getIconContainerStyle() });
+ this._dtpIconContainer = new St.Widget({ layout_manager: new Clutter.BinLayout(), style: this.getIconContainerStyle() });
this.actor.remove_actor(this._iconContainer);
@@ -181,7 +181,7 @@ var taskbarAppIcon = Utils.defineClass({
this._container.add_child(this._dotsContainer);
this.actor.set_child(this._container);
- if (Panel.checkIfVertical()) {
+ if (panel.checkIfVertical()) {
this.actor.set_width(panel.geom.w);
}
@@ -482,7 +482,7 @@ var taskbarAppIcon = Utils.defineClass({
_updateWindowTitleStyle: function() {
if (this._windowTitle) {
let useFixedWidth = Me.settings.get_boolean('group-apps-use-fixed-width');
- let variableWidth = !useFixedWidth || Panel.checkIfVertical() || this.dtpPanel.taskbar.fullScrollView;
+ let variableWidth = !useFixedWidth || this.dtpPanel.checkIfVertical() || this.dtpPanel.taskbar.fullScrollView;
let fontWeight = Me.settings.get_string('group-apps-label-font-weight');
let fontColor = this.window.minimized ?
Me.settings.get_string('group-apps-label-font-color-minimized') :
@@ -536,7 +536,7 @@ var taskbarAppIcon = Utils.defineClass({
let bgSvg = '/img/highlight_stacked_bg';
if (pos == DOT_POSITION.LEFT || pos == DOT_POSITION.RIGHT) {
- bgSvg += (Panel.checkIfVertical() ? '_2' : '_3');
+ bgSvg += (this.dtpPanel.checkIfVertical() ? '_2' : '_3');
}
inlineStyle += "background-image: url('" + Me.path + bgSvg + ".svg');" +
@@ -575,7 +575,7 @@ var taskbarAppIcon = Utils.defineClass({
let padding = getIconPadding();
let margin = Me.settings.get_int('appicon-margin');
- this.actor.set_style('padding:' + (Panel.checkIfVertical() ? margin + 'px 0' : '0 ' + margin + 'px;'));
+ this.actor.set_style('padding:' + (this.dtpPanel.checkIfVertical() ? margin + 'px 0' : '0 ' + margin + 'px;'));
this._iconContainer.set_style('padding: ' + padding + 'px;');
},
@@ -588,7 +588,7 @@ var taskbarAppIcon = Utils.defineClass({
}
if (!this._menu) {
- this._menu = new taskbarSecondaryMenu(this);
+ this._menu = new taskbarSecondaryMenu(this, this.dtpPanel);
this._menu.connect('activate-window', Lang.bind(this, function (menu, window) {
this.activateWindow(window, Me.settings);
}));
@@ -1223,24 +1223,23 @@ var taskbarAppIcon = Utils.defineClass({
getAppIconInterestingWindows: function(isolateMonitors) {
return getInterestingWindows(this.app, this.dtpPanel.monitor, isolateMonitors);
- }
+ },
+ getIconContainerStyle: function() {
+ let style = 'padding: ';
+ let isVertical = this.dtpPanel.checkIfVertical();
+
+ if (Me.settings.get_boolean('group-apps')) {
+ style += (isVertical ? '0;' : '0 ' + DEFAULT_PADDING_SIZE + 'px;');
+ } else {
+ style += (isVertical ? '' : '0 ') + DEFAULT_PADDING_SIZE + 'px;';
+ }
+
+ return style;
+ }
});
taskbarAppIcon.prototype.scaleAndFade = taskbarAppIcon.prototype.undoScaleAndFade = () => {};
-function getIconContainerStyle() {
- let style = 'padding: ';
- let isVertical = Panel.checkIfVertical();
-
- if (Me.settings.get_boolean('group-apps')) {
- style += (isVertical ? '0;' : '0 ' + DEFAULT_PADDING_SIZE + 'px;');
- } else {
- style += (isVertical ? '' : '0 ') + DEFAULT_PADDING_SIZE + 'px;';
- }
-
- return style;
-}
-
function minimizeWindow(app, param, monitor){
// Param true make all app windows minimize
let windows = getInterestingWindows(app, monitor);
@@ -1403,13 +1402,13 @@ var taskbarSecondaryMenu = Utils.defineClass({
Extends: AppDisplay.AppIconMenu,
ParentConstrParams: [[0]],
- _init: function(source) {
+ _init: function(source, panel) {
// Damm it, there has to be a proper way of doing this...
// As I can't call the parent parent constructor (?) passing the side
// parameter, I overwite what I need later
this.callParent('_init', source);
- let side = Panel.getPosition();
+ let side = panel.getPosition();
// Change the initialized side where required.
this._arrowSide = side;
this._boxPointer._arrowSide = side;
@@ -1544,7 +1543,7 @@ function ItemShowLabel() {
let labelWidth = this.label.get_width();
let labelHeight = this.label.get_height();
- let position = Panel.getPosition();
+ let position = this._dtpPanel.getPosition();
let labelOffset = node.get_length('-x-offset');
let xOffset = Math.floor((itemWidth - labelWidth) / 2);
@@ -1607,7 +1606,7 @@ function ItemShowLabel() {
var ShowAppsIconWrapper = Utils.defineClass({
Name: 'DashToPanel.ShowAppsIconWrapper',
- _init: function() {
+ _init: function(dtpPanel) {
this.realShowAppsIcon = new Dash.ShowAppsIcon();
Utils.wrapActor(this.realShowAppsIcon);
@@ -1638,6 +1637,7 @@ var ShowAppsIconWrapper = Utils.defineClass({
this._menuManager = new PopupMenu.PopupMenuManager(this.actor);
this._menuTimeoutId = 0;
+ this.realShowAppsIcon._dtpPanel = dtpPanel;
Taskbar.extendDashItemContainer(this.realShowAppsIcon);
let customIconPath = Me.settings.get_string('show-apps-icon-file');
@@ -1698,14 +1698,14 @@ var ShowAppsIconWrapper = Utils.defineClass({
setShowAppsPadding: function() {
let padding = getIconPadding();
let sidePadding = Me.settings.get_int('show-apps-icon-side-padding');
- let isVertical = Panel.checkIfVertical();
+ let isVertical = this.realShowAppsIcon._dtpPanel.checkIfVertical();
this.actor.set_style('padding:' + (padding + (isVertical ? sidePadding : 0)) + 'px ' + (padding + (isVertical ? 0 : sidePadding)) + 'px;');
},
createMenu: function() {
if (!this._menu) {
- this._menu = new MyShowAppsIconMenu(this.actor);
+ this._menu = new MyShowAppsIconMenu(this.actor, this.realShowAppsIcon._dtpPanel);
this._menu.connect('open-state-changed', Lang.bind(this, function(menu, isPoppedUp) {
if (!isPoppedUp)
this._onMenuPoppedDown();
@@ -1754,7 +1754,7 @@ Signals.addSignalMethods(ShowAppsIconWrapper.prototype);
var MyShowAppsIconMenu = Utils.defineClass({
Name: 'DashToPanel.ShowAppsIconMenu',
Extends: taskbarSecondaryMenu,
- ParentConstrParams: [[0]],
+ ParentConstrParams: [[0], [1]],
_dtpRedisplay: function() {
this.removeAll();
diff --git a/intellihide.js b/intellihide.js
index c4c9c97..7673b43 100644
--- a/intellihide.js
+++ b/intellihide.js
@@ -21,7 +21,7 @@ const Meta = imports.gi.Meta;
const Shell = imports.gi.Shell;
const St = imports.gi.St;
-const GrabHelper = imports.ui.grabHelper;
+var GrabHelper = imports.ui.grabHelper;
const Layout = imports.ui.layout;
const Main = imports.ui.main;
const OverviewControls = imports.ui.overviewControls;
@@ -79,7 +79,7 @@ var Intellihide = Utils.defineClass({
this._pendingUpdate = false;
this._hoveredOut = false;
this._windowOverlap = false;
- this._translationProp = 'translation_' + (Panel.checkIfVertical() ? 'x' : 'y');
+ this._translationProp = 'translation_' + (this._dtpPanel.checkIfVertical() ? 'x' : 'y');
this._panelBox.translation_y = 0;
this._panelBox.translation_x = 0;
@@ -251,7 +251,7 @@ var Intellihide = Utils.defineClass({
let position = this._dtpPanel.geom.position;
let opts = { display: global.display };
- if (Panel.checkIfVertical()) {
+ if (this._dtpPanel.checkIfVertical()) {
opts.y1 = this._monitor.y;
opts.y2 = this._monitor.y + this._monitor.height;
opts.x1 = opts.x2 = this._monitor.x;
diff --git a/panel.js b/panel.js
index 7e2bd99..e2dba2a 100644
--- a/panel.js
+++ b/panel.js
@@ -62,10 +62,6 @@ const _ = imports.gettext.domain(Me.imports.utils.TRANSLATION_DOMAIN).gettext;
let tracker = Shell.WindowTracker.get_default();
var panelBoxes = ['_leftBox', '_centerBox', '_rightBox'];
-var sizeFunc;
-var fixedCoord;
-var varCoord;
-var size;
//timeout names
const T1 = 'startDynamicTransparencyTimeout';
@@ -76,30 +72,6 @@ const T5 = 'trackerFocusAppTimeout';
const T6 = 'scrollPanelDelayTimeout';
const T7 = 'waitPanelBoxAllocation';
-function getPosition() {
- let position = Me.settings.get_string('panel-position');
-
- if (position == 'TOP') {
- return St.Side.TOP;
- } else if (position == 'RIGHT') {
- return St.Side.RIGHT;
- } else if (position == 'BOTTOM') {
- return St.Side.BOTTOM;
- }
-
- return St.Side.LEFT;
-}
-
-function checkIfVertical() {
- let position = getPosition();
-
- return (position == St.Side.LEFT || position == St.Side.RIGHT);
-}
-
-function getOrientation() {
- return (checkIfVertical() ? 'vertical' : 'horizontal');
-}
-
function setMenuArrow(arrowIcon, side) {
let parent = arrowIcon.get_parent();
let iconNames = {
@@ -119,7 +91,7 @@ var dtpPanel = Utils.defineClass({
Extends: St.Widget,
_init: function(panelManager, monitor, panelBox, isStandalone) {
- let position = getPosition();
+ let position = this.getPosition();
this.callParent('_init', { layout_manager: new Clutter.BinLayout() });
@@ -201,8 +173,7 @@ var dtpPanel = Utils.defineClass({
// Create a wrapper around the real showAppsIcon in order to add a popupMenu. Most of
// its behavior is handled by the taskbar, but its positioning is done at the panel level
- this.showAppsIconWrapper = new AppIcons.ShowAppsIconWrapper();
- this.showAppsIconWrapper._dtpPanel = this;
+ this.showAppsIconWrapper = new AppIcons.ShowAppsIconWrapper(this);
this.panel.actor.add_child(this.showAppsIconWrapper.realShowAppsIcon);
this.panel.actor._delegate = this;
@@ -243,7 +214,7 @@ var dtpPanel = Utils.defineClass({
},
enable : function() {
- let position = getPosition();
+ let position = this.getPosition();
if (this.statusArea.aggregateMenu) {
Utils.getIndicators(this.statusArea.aggregateMenu._volume)._dtpIgnoreScroll = 1;
@@ -339,7 +310,7 @@ var dtpPanel = Utils.defineClass({
this._setAllocationMap();
- this.panel.actor.add_style_class_name('dashtopanelMainPanel ' + getOrientation());
+ this.panel.actor.add_style_class_name('dashtopanelMainPanel ' + this.getOrientation());
// Since Gnome 3.8 dragging an app without having opened the overview before cause the attemp to
//animate a null target since some variables are not initialized when the viewSelector is created
@@ -417,7 +388,7 @@ var dtpPanel = Utils.defineClass({
this.panelStyle.enable(this);
- if (checkIfVertical()) {
+ if (this.checkIfVertical()) {
this._signalsHandler.add([
this.panelBox,
'notify::visible',
@@ -549,6 +520,30 @@ var dtpPanel = Utils.defineClass({
return DND.DragMotionResult.CONTINUE;
},
+ getPosition: function() {
+ let position = Me.settings.get_string('panel-position');
+
+ if (position == 'TOP') {
+ return St.Side.TOP;
+ } else if (position == 'RIGHT') {
+ return St.Side.RIGHT;
+ } else if (position == 'BOTTOM') {
+ return St.Side.BOTTOM;
+ }
+
+ return St.Side.LEFT;
+ },
+
+ checkIfVertical: function() {
+ let position = this.getPosition();
+
+ return (position == St.Side.LEFT || position == St.Side.RIGHT);
+ },
+
+ getOrientation: function() {
+ return (this.checkIfVertical() ? 'vertical' : 'horizontal');
+ },
+
updateElementPositions: function() {
let panelPositions = this.panelManager.panelsElementPositions[this.monitor.index] || Pos.defaults;
@@ -556,7 +551,7 @@ var dtpPanel = Utils.defineClass({
this._disablePanelCornerSignals();
- if (getPosition() == St.Side.TOP) {
+ if (this.getPosition() == St.Side.TOP) {
let visibleElements = panelPositions.filter(pp => pp.visible);
let connectCorner = (corner, button) => {
corner._button = button;
@@ -645,7 +640,7 @@ var dtpPanel = Utils.defineClass({
},
_bindSettingsChanges: function() {
- let isVertical = checkIfVertical();
+ let isVertical = this.checkIfVertical();
this._signalsHandler.add(
[
@@ -742,7 +737,7 @@ var dtpPanel = Utils.defineClass({
},
_setPanelGhostSize: function() {
- this._myPanelGhost.set_size(this.width, checkIfVertical() ? 1 : this.height);
+ this._myPanelGhost.set_size(this.width, this.checkIfVertical() ? 1 : this.height);
},
_setSearchEntryOffset: function(offset) {
@@ -751,7 +746,7 @@ var dtpPanel = Utils.defineClass({
//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 paddingSide = this.getPosition() == St.Side.LEFT ? 'left' : 'right';
let scaleFactor = Utils.getScaleFactor();
let style = offset ? 'padding-' + paddingSide + ':' + (offset / scaleFactor) + 'px;' : null;
let searchEntry = Main.overview._searchEntry || Main.overview._overview._searchEntry;
@@ -788,7 +783,7 @@ var dtpPanel = Utils.defineClass({
this.intellihide.reset();
}
- if (checkIfVertical()) {
+ if (this.checkIfVertical()) {
this.showAppsIconWrapper.realShowAppsIcon.toggleButton.set_width(this.geom.w);
this._refreshVerticalAlloc();
this._setSearchEntryOffset(this.geom.w);
@@ -801,47 +796,47 @@ var dtpPanel = Utils.defineClass({
let lrPadding = panelBoxTheme.get_padding(St.Side.RIGHT) + panelBoxTheme.get_padding(St.Side.LEFT);
let topPadding = panelBoxTheme.get_padding(St.Side.TOP);
let tbPadding = topPadding + panelBoxTheme.get_padding(St.Side.BOTTOM);
- let position = getPosition();
+ let position = this.getPosition();
let gsTopPanelOffset = 0;
let x = 0, y = 0;
let w = 0, h = 0;
- size = Me.settings.get_int('panel-size') * scaleFactor;
+ this.dtpSize = 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 - topPadding;
}
- if (checkIfVertical()) {
+ if (this.checkIfVertical()) {
if (!Me.settings.get_boolean('group-apps')) {
// add window title width and side padding of _dtpIconContainer when vertical
- size += Me.settings.get_int('group-apps-label-max-width') + AppIcons.DEFAULT_PADDING_SIZE * 2 / scaleFactor;
+ this.dtpSize += Me.settings.get_int('group-apps-label-max-width') + AppIcons.DEFAULT_PADDING_SIZE * 2 / scaleFactor;
}
- sizeFunc = 'get_preferred_height',
- fixedCoord = { c1: 'x1', c2: 'x2' },
- varCoord = { c1: 'y1', c2: 'y2' };
+ this.sizeFunc = 'get_preferred_height',
+ this.fixedCoord = { c1: 'x1', c2: 'x2' },
+ this.varCoord = { c1: 'y1', c2: 'y2' };
- w = size;
+ w = this.dtpSize;
h = this.monitor.height - tbPadding - gsTopPanelOffset;
} else {
- sizeFunc = 'get_preferred_width';
- fixedCoord = { c1: 'y1', c2: 'y2' };
- varCoord = { c1: 'x1', c2: 'x2' };
+ this.sizeFunc = 'get_preferred_width';
+ this.fixedCoord = { c1: 'y1', c2: 'y2' };
+ this.varCoord = { c1: 'x1', c2: 'x2' };
w = this.monitor.width - lrPadding;
- h = size;
+ h = this.dtpSize;
}
if (position == St.Side.TOP || position == St.Side.LEFT) {
x = this.monitor.x;
y = this.monitor.y + gsTopPanelOffset;
} else if (position == St.Side.RIGHT) {
- x = this.monitor.x + this.monitor.width - size - lrPadding;
+ x = this.monitor.x + this.monitor.width - this.dtpSize - lrPadding;
y = this.monitor.y + gsTopPanelOffset;
} else { //BOTTOM
x = this.monitor.x;
- y = this.monitor.y + this.monitor.height - size - tbPadding;
+ y = this.monitor.y + this.monitor.height - this.dtpSize - tbPadding;
}
return {
@@ -889,9 +884,9 @@ var dtpPanel = Utils.defineClass({
group.elements.forEach(element => {
if (!update) {
- element.box[fixedCoord.c1] = panelAlloc[fixedCoord.c1];
- element.box[fixedCoord.c2] = panelAlloc[fixedCoord.c2];
- element.natSize = element.actor[sizeFunc](-1)[1];
+ element.box[this.fixedCoord.c1] = panelAlloc[this.fixedCoord.c1];
+ element.box[this.fixedCoord.c2] = panelAlloc[this.fixedCoord.c2];
+ element.natSize = element.actor[this.sizeFunc](-1)[1];
}
if (!group.isCentered || Pos.checkIfCentered(element.position)) {
@@ -931,9 +926,9 @@ var dtpPanel = Utils.defineClass({
for (; i < l; ++i) {
let refGroup = this._elementGroups[i];
- if (i < group.index && (!refGroup.fixed || refGroup[varCoord.c2] > tlLimit)) {
+ if (i < group.index && (!refGroup.fixed || refGroup[this.varCoord.c2] > tlLimit)) {
tlSize += refGroup.size;
- } else if (i > group.index && (!refGroup.fixed || refGroup[varCoord.c1] < brLimit)) {
+ } else if (i > group.index && (!refGroup.fixed || refGroup[this.varCoord.c1] < brLimit)) {
brSize += refGroup.size;
}
}
@@ -961,8 +956,8 @@ var dtpPanel = Utils.defineClass({
group.elements.forEach(element => {
let params = [element.box, flags];
- element.box[varCoord.c1] = Math.round(currentPosition);
- element.box[varCoord.c2] = Math.round((currentPosition += element.natSize));
+ element.box[this.varCoord.c1] = Math.round(currentPosition);
+ element.box[this.varCoord.c2] = Math.round((currentPosition += element.natSize));
if (element.isBox) {
params.push(1);
@@ -971,8 +966,8 @@ var dtpPanel = Utils.defineClass({
element.actor.allocate.apply(element.actor, params);
});
- group[varCoord.c1] = startPosition;
- group[varCoord.c2] = currentPosition;
+ group[this.varCoord.c1] = startPosition;
+ group[this.varCoord.c2] = currentPosition;
group.fixed = 1;
++fixed;
};
@@ -990,7 +985,7 @@ var dtpPanel = Utils.defineClass({
});
if (centeredMonitorGroup) {
- allocateGroup(centeredMonitorGroup, panelAlloc[varCoord.c1], panelAlloc[varCoord.c2]);
+ allocateGroup(centeredMonitorGroup, panelAlloc[this.varCoord.c1], panelAlloc[this.varCoord.c2]);
}
let iterations = 0; //failsafe
@@ -1004,13 +999,13 @@ var dtpPanel = Utils.defineClass({
let prevGroup = this._elementGroups[i - 1];
let nextGroup = this._elementGroups[i + 1];
- let prevLimit = prevGroup && prevGroup.fixed ? prevGroup[varCoord.c2] : panelAlloc[varCoord.c1];
- let nextLimit = nextGroup && nextGroup.fixed ? nextGroup[varCoord.c1] : panelAlloc[varCoord.c2];
+ let prevLimit = prevGroup && prevGroup.fixed ? prevGroup[this.varCoord.c2] : panelAlloc[this.varCoord.c1];
+ let nextLimit = nextGroup && nextGroup.fixed ? nextGroup[this.varCoord.c1] : panelAlloc[this.varCoord.c2];
if (group.position == Pos.STACKED_TL) {
- allocateGroup(group, panelAlloc[varCoord.c1], nextLimit);
+ allocateGroup(group, panelAlloc[this.varCoord.c1], nextLimit);
} else if (group.position == Pos.STACKED_BR) {
- allocateGroup(group, prevLimit, panelAlloc[varCoord.c2]);
+ allocateGroup(group, prevLimit, panelAlloc[this.varCoord.c2]);
} else if ((!prevGroup || prevGroup.fixed) && (!nextGroup || nextGroup.fixed)) { // CENTERED
allocateGroup(group, prevLimit, nextLimit);
}
@@ -1021,18 +1016,18 @@ var dtpPanel = Utils.defineClass({
let childBoxLeftCorner = new Clutter.ActorBox();
let childBoxRightCorner = new Clutter.ActorBox();
let currentCornerSize = this.cornerSize;
- let panelAllocFixedSize = box[fixedCoord.c2] - box[fixedCoord.c1];
+ let panelAllocFixedSize = box[this.fixedCoord.c2] - box[this.fixedCoord.c1];
- [ , 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;
+ [ , this.cornerSize] = this.panel._leftCorner.actor[this.sizeFunc](-1);
+ childBoxLeftCorner[this.varCoord.c1] = 0;
+ childBoxLeftCorner[this.varCoord.c2] = this.cornerSize;
+ childBoxLeftCorner[this.fixedCoord.c1] = panelAllocFixedSize;
+ childBoxLeftCorner[this.fixedCoord.c2] = panelAllocFixedSize + this.cornerSize;
- childBoxRightCorner[varCoord.c1] = box[varCoord.c2] - this.cornerSize;
- childBoxRightCorner[varCoord.c2] = box[varCoord.c2];
- childBoxRightCorner[fixedCoord.c1] = panelAllocFixedSize;
- childBoxRightCorner[fixedCoord.c2] = panelAllocFixedSize + this.cornerSize;
+ childBoxRightCorner[this.varCoord.c1] = box[this.varCoord.c2] - this.cornerSize;
+ childBoxRightCorner[this.varCoord.c2] = box[this.varCoord.c2];
+ childBoxRightCorner[this.fixedCoord.c1] = panelAllocFixedSize;
+ childBoxRightCorner[this.fixedCoord.c2] = panelAllocFixedSize + this.cornerSize;
this.panel._leftCorner.actor.allocate(childBoxLeftCorner, flags);
this.panel._rightCorner.actor.allocate(childBoxRightCorner, flags);
@@ -1049,7 +1044,7 @@ var dtpPanel = Utils.defineClass({
this.set_size(this.geom.w, this.geom.h);
clipContainer.set_position(this.geom.x, this.geom.y);
- this._setVertical(this.panel.actor, checkIfVertical());
+ this._setVertical(this.panel.actor, this.checkIfVertical());
// styles for theming
Object.keys(St.Side).forEach(p => {
@@ -1090,8 +1085,8 @@ var dtpPanel = Utils.defineClass({
return Clutter.EVENT_PROPAGATE;
}
- let params = checkIfVertical() ? [stageY, 'y', 'height'] : [stageX, 'x', 'width'];
- let dragWindow = this._getDraggableWindowForPosition.apply(this, params.concat(['maximized_' + getOrientation() + 'ly']));
+ let params = this.checkIfVertical() ? [stageY, 'y', 'height'] : [stageX, 'x', 'width'];
+ let dragWindow = this._getDraggableWindowForPosition.apply(this, params.concat(['maximized_' + this.getOrientation() + 'ly']));
if (!dragWindow)
return Clutter.EVENT_PROPAGATE;
@@ -1126,7 +1121,7 @@ var dtpPanel = Utils.defineClass({
},
_onBoxActorAdded: function(box) {
- if (checkIfVertical()) {
+ if (this.checkIfVertical()) {
this._setVertical(box, true);
}
},
@@ -1161,8 +1156,8 @@ var dtpPanel = Utils.defineClass({
let [, natWidth] = actor.get_preferred_width(-1);
child.x_align = Clutter.ActorAlign[isVertical ? 'CENTER' : 'START'];
- actor.set_width(isVertical ? size : -1);
- isVertical = isVertical && (natWidth > size);
+ actor.set_width(isVertical ? this.dtpSize : -1);
+ isVertical = isVertical && (natWidth > this.dtpSize);
actor[(isVertical ? 'add' : 'remove') + '_style_class_name']('vertical');
}
}
@@ -1294,7 +1289,7 @@ var dtpPanel = Utils.defineClass({
_setShowDesktopButtonSize: function() {
if (this._showDesktopButton) {
let buttonSize = Me.settings.get_int('showdesktop-button-width') + 'px;';
- let isVertical = checkIfVertical();
+ let isVertical = this.checkIfVertical();
let sytle = isVertical ? 'border-top-width:1px;height:' + buttonSize : 'border-left-width:1px;width:' + buttonSize;
this._showDesktopButton.set_style(sytle);
diff --git a/panelManager.js b/panelManager.js
index 312a33f..f17a23d 100755
--- a/panelManager.js
+++ b/panelManager.js
@@ -93,8 +93,8 @@ var dtpPanelManager = Utils.defineClass({
global.dashToPanel.panels = this.allPanels;
global.dashToPanel.emit('panels-created');
- let panelPosition = Panel.getPosition();
this.allPanels.forEach(p => {
+ let panelPosition = p.getPosition();
let leftOrRight = (panelPosition == St.Side.LEFT || panelPosition == St.Side.RIGHT);
p.panelBox.set_size(
@@ -121,7 +121,7 @@ var dtpPanelManager = Utils.defineClass({
this._updatePanelElementPositions();
this.setFocusedMonitor(this.dtpPrimaryMonitor);
- if (Panel.checkIfVertical()) {
+ if (this.primaryPanel.checkIfVertical()) {
Main.wm._getPositionForDirection = newGetPositionForDirection;
}
@@ -261,7 +261,7 @@ var dtpPanelManager = Utils.defineClass({
);
Panel.panelBoxes.forEach(c => this._signalsHandler.add(
- [Main.panel[c], 'actor-added', (parent, child) => this._adjustPanelMenuButton(this._getPanelMenuButton(child), this.primaryPanel.monitor, Panel.getPosition())]
+ [Main.panel[c], 'actor-added', (parent, child) => this._adjustPanelMenuButton(this._getPanelMenuButton(child), this.primaryPanel.monitor, this.primaryPanel.getPosition())]
));
this._setKeyBindings(true);
@@ -429,7 +429,7 @@ var dtpPanelManager = Utils.defineClass({
},
_updatePanelElementPositions: function() {
- this.panelsElementPositions = Pos.getSettingsPositions(Me.settings);
+ this.panelsElementPositions = Pos.getSettingsPositions(Me.settings, 'panel-element-positions');
this.allPanels.forEach(p => p.updateElementPositions());
},
@@ -452,7 +452,8 @@ 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 + Panel.size + 10 - monitor.height; // 10 is arbitrary
+ let panel = global.dashToPanel.panels.find(p => p.monitor == monitor);
+ let excess = alloc.natural_size + panel.dtpSize + 10 - monitor.height; // 10 is arbitrary
if (excess > 0) {
alloc.natural_size -= excess;
@@ -676,11 +677,11 @@ function newUpdateHotCorners() {
return;
}
- let panelPosition = Panel.getPosition();
- let panelTopLeft = panelPosition == St.Side.TOP || panelPosition == St.Side.LEFT;
-
// build new hot corners
for (let i = 0; i < this.monitors.length; i++) {
+ let panel = global.dashToPanel.panels.find(p => p.monitor.index == i);
+ let panelPosition = panel.getPosition();
+ let panelTopLeft = panelPosition == St.Side.TOP || panelPosition == St.Side.LEFT;
let monitor = this.monitors[i];
let cornerX = this._rtl ? monitor.x + monitor.width : monitor.x;
let cornerY = monitor.y;
@@ -724,7 +725,7 @@ function newUpdateHotCorners() {
let corner = new Layout.HotCorner(this, monitor, cornerX, cornerY);
corner.setBarrierSize = size => corner.__proto__.setBarrierSize.call(corner, Math.min(size, 32));
- corner.setBarrierSize(Panel.size);
+ corner.setBarrierSize(panel.dtpSize);
this.hotCorners.push(corner);
} else {
this.hotCorners.push(null);
@@ -757,7 +758,7 @@ function newUpdatePanelBarrier(panel) {
let fixed1 = panel.monitor.y;
let fixed2 = panel.monitor.y + barrierSize;
- if (Panel.checkIfVertical()) {
+ if (panel.checkIfVertical()) {
barriers._rightPanelBarrier.push(panel.monitor.y + panel.monitor.height, Meta.BarrierDirection.POSITIVE_Y);
barriers._leftPanelBarrier.push(panel.monitor.y, Meta.BarrierDirection.NEGATIVE_Y);
} else {
@@ -765,7 +766,7 @@ function newUpdatePanelBarrier(panel) {
barriers._leftPanelBarrier.push(panel.monitor.x, Meta.BarrierDirection.POSITIVE_X);
}
- switch (Panel.getPosition()) {
+ switch (panel.getPosition()) {
//values are initialized as St.Side.TOP
case St.Side.BOTTOM:
fixed1 = panel.monitor.y + panel.monitor.height - barrierSize;
@@ -798,16 +799,17 @@ function newUpdatePanelBarrier(panel) {
directions: barriers[k][2]
};
- barrierOptions[Panel.varCoord.c1] = barrierOptions[Panel.varCoord.c2] = barriers[k][1];
- barrierOptions[Panel.fixedCoord.c1] = fixed1;
- barrierOptions[Panel.fixedCoord.c2] = fixed2;
+ barrierOptions[panel.varCoord.c1] = barrierOptions[panel.varCoord.c2] = barriers[k][1];
+ barrierOptions[panel.fixedCoord.c1] = fixed1;
+ barrierOptions[panel.fixedCoord.c2] = fixed2;
barriers[k][0][k] = new Meta.Barrier(barrierOptions);
});
}
function _newLookingGlassResize() {
- let topOffset = Panel.getPosition() == St.Side.TOP ? Panel.size : 32;
+ let primaryMonitorPanel = global.dashToPanel.panels.find(p => p.monitor == Main.layoutManager.primaryMonitor);
+ let topOffset = primaryMonitorPanel.getPosition() == St.Side.TOP ? primaryMonitorPanel.size : 32;
this._oldResize();
Utils.wrapActor(this);
diff --git a/panelPositions.js b/panelPositions.js
index b635803..5b98e06 100644
--- a/panelPositions.js
+++ b/panelPositions.js
@@ -47,11 +47,11 @@ var optionDialogFunctions = {};
optionDialogFunctions[SHOW_APPS_BTN] = '_showShowAppsButtonOptions';
optionDialogFunctions[DESKTOP_BTN] = '_showDesktopButtonOptions';
-function getSettingsPositions(settings) {
+function getSettingsPositions(settings, setting) {
var positions = null;
try {
- positions = JSON.parse(settings.get_string('panel-element-positions'));
+ positions = JSON.parse(settings.get_string(setting));
} catch(e) {
log('Error parsing positions: ' + e.message);
}
diff --git a/panelStyle.js b/panelStyle.js
index 73e5072..2697ace 100644
--- a/panelStyle.js
+++ b/panelStyle.js
@@ -79,7 +79,7 @@ var dtpPanelStyle = Utils.defineClass({
this._rightBoxOperations = [];
let trayPadding = Me.settings.get_int('tray-padding');
- let isVertical = Panel.checkIfVertical();
+ let isVertical = this.panel.checkIfVertical();
let paddingStyle = 'padding: ' + (isVertical ? '%dpx 0' : '0 %dpx');
if(trayPadding >= 0) {
diff --git a/prefs.js b/prefs.js
index 5206154..11c02f1 100644
--- a/prefs.js
+++ b/prefs.js
@@ -216,7 +216,7 @@ const Settings = new Lang.Class({
let labels = {};
let position = this._settings.get_string('panel-position');
let isVertical = position == 'LEFT' || position == 'RIGHT';
- let positionSettings = Pos.getSettingsPositions(this._settings);
+ let positionSettings = Pos.getSettingsPositions(this._settings, 'panel-element-positions');
let panelInfo = positionSettings[monitorIndex] || Pos.defaults;
let updateSettings = () => {
let newPanelInfo = [];
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 61021a0..74c0671 100644
--- a/schemas/org.gnome.shell.extensions.dash-to-panel.gschema.xml
+++ b/schemas/org.gnome.shell.extensions.dash-to-panel.gschema.xml
@@ -77,6 +77,11 @@
Sync element positions
Sync panel element positions on all monitors.
+
+ '{}'
+ Panel positions
+ Panel positions (JSON).
+
'{}'
Panel element positions
diff --git a/taskbar.js b/taskbar.js
index bdadcb8..2133198 100644
--- a/taskbar.js
+++ b/taskbar.js
@@ -80,24 +80,25 @@ var taskbarActor = Utils.defineClass({
this._delegate = delegate;
this._currentBackgroundColor = 0;
this.callParent('_init', { name: 'dashtopanelTaskbar',
- layout_manager: new Clutter.BoxLayout({ orientation: Clutter.Orientation[Panel.getOrientation().toUpperCase()] }),
+ layout_manager: new Clutter.BoxLayout({ orientation: Clutter.Orientation[delegate.dtpPanel.getOrientation().toUpperCase()] }),
clip_to_allocation: true });
},
vfunc_allocate: function(box, flags) {
this.set_allocation(box, flags);
- let availFixedSize = box[Panel.fixedCoord.c2] - box[Panel.fixedCoord.c1];
- let availVarSize = box[Panel.varCoord.c2] - box[Panel.varCoord.c1];
+ let panel = this._delegate.dtpPanel;
+ let availFixedSize = box[panel.fixedCoord.c2] - box[panel.fixedCoord.c1];
+ let availVarSize = box[panel.varCoord.c2] - box[panel.varCoord.c1];
let [, scrollview, leftFade, rightFade] = this.get_children();
- let [, natSize] = this[Panel.sizeFunc](availFixedSize);
+ let [, natSize] = this[panel.sizeFunc](availFixedSize);
let childBox = new Clutter.ActorBox();
- let orientation = Panel.getOrientation();
+ let orientation = panel.getOrientation();
- childBox[Panel.varCoord.c1] = box[Panel.varCoord.c1];
- childBox[Panel.varCoord.c2] = Math.min(availVarSize, natSize);
- childBox[Panel.fixedCoord.c1] = box[Panel.fixedCoord.c1];
- childBox[Panel.fixedCoord.c2] = box[Panel.fixedCoord.c2];
+ childBox[panel.varCoord.c1] = box[panel.varCoord.c1];
+ childBox[panel.varCoord.c2] = Math.min(availVarSize, natSize);
+ childBox[panel.fixedCoord.c1] = box[panel.fixedCoord.c1];
+ childBox[panel.fixedCoord.c2] = box[panel.fixedCoord.c2];
scrollview.allocate(childBox, flags);
@@ -105,8 +106,8 @@ var taskbarActor = Utils.defineClass({
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;
+ if (this._currentBackgroundColor !== panel.dynamicTransparency.currentBackgroundColor) {
+ this._currentBackgroundColor = panel.dynamicTransparency.currentBackgroundColor;
let gradientStyle = 'background-gradient-start: ' + this._currentBackgroundColor +
'background-gradient-direction: ' + orientation;
@@ -114,11 +115,11 @@ var taskbarActor = Utils.defineClass({
rightFade.set_style(gradientStyle);
}
- childBox[Panel.varCoord.c2] = childBox[Panel.varCoord.c1] + (value > 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] - (value + pageSize < upper ? scrollview._dtpFadeSize : 0);
- childBox[Panel.varCoord.c2] = box[Panel.varCoord.c2];
+ 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);
},
@@ -171,7 +172,7 @@ var taskbar = Utils.defineClass({
this._labelShowing = false;
this.fullScrollView = 0;
- let isVertical = Panel.checkIfVertical();
+ let isVertical = panel.checkIfVertical();
this._box = new St.BoxLayout({ vertical: isVertical,
clip_to_allocation: false,
@@ -210,7 +211,7 @@ var taskbar = Utils.defineClass({
this._container.add_child(new St.Widget({ width: 0, reactive: false }));
this._container.add_actor(this._scrollView);
- let orientation = 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',
@@ -378,7 +379,7 @@ var taskbar = Utils.defineClass({
_onScrollEvent: function(actor, event) {
- let orientation = Panel.getOrientation();
+ let orientation = this.dtpPanel.getOrientation();
// reset timeout to avid conflicts with the mousehover event
if (this._ensureAppIconVisibilityTimeoutId>0) {
@@ -427,7 +428,7 @@ var taskbar = Utils.defineClass({
// 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 (!Panel.checkIfVertical() && !this.isGroupApps) {
+ if (!this.dtpPanel.checkIfVertical() && !this.isGroupApps) {
let initial = this.fullScrollView;
if (!this.fullScrollView && Math.floor(adjustment.upper) > adjustment.page_size) {
@@ -584,6 +585,7 @@ var taskbar = Utils.defineClass({
let item = new Dash.DashItemContainer();
+ item._dtpPanel = this.dtpPanel
extendDashItemContainer(item);
item.setChild(appIcon.actor);
@@ -905,7 +907,7 @@ var taskbar = Utils.defineClass({
this._shownInitially = false;
this._redisplay();
- if (geometryChange && Panel.checkIfVertical()) {
+ if (geometryChange && this.dtpPanel.checkIfVertical()) {
this.previewMenu._updateClip();
}
},
@@ -968,7 +970,7 @@ var taskbar = Utils.defineClass({
this._box.insert_child_above(source._dashItemContainer, null);
}
- let isVertical = Panel.checkIfVertical();
+ let isVertical = this.dtpPanel.checkIfVertical();
let sizeProp = isVertical ? 'height' : 'width';
let posProp = isVertical ? 'y' : 'x';
let pos = isVertical ? y : x;
@@ -1242,7 +1244,7 @@ var DragPlaceholderItem = Utils.defineClass({
Extends: St.Widget,
_init: function(appIcon, iconSize) {
- this.callParent('_init', { style: AppIcons.getIconContainerStyle(), layout_manager: new Clutter.BinLayout() });
+ this.callParent('_init', { style: appIcon.getIconContainerStyle(), layout_manager: new Clutter.BinLayout() });
this.child = { _delegate: appIcon };
diff --git a/transparency.js b/transparency.js
index 835f88a..aa86d7a 100644
--- a/transparency.js
+++ b/transparency.js
@@ -134,7 +134,7 @@ var DynamicTransparency = Utils.defineClass({
this._proximityManager.removeWatch(this._proximityWatchId);
if (Me.settings.get_boolean('trans-use-dynamic-opacity')) {
- let isVertical = Panel.checkIfVertical();
+ let isVertical = this._dtpPanel.checkIfVertical();
let threshold = Me.settings.get_int('trans-dynamic-distance');
this._proximityWatchId = this._proximityManager.createWatch(
@@ -206,7 +206,7 @@ var DynamicTransparency = Utils.defineClass({
this._gradientStyle = '';
if (Me.settings.get_boolean('trans-use-custom-gradient')) {
- this._gradientStyle += 'background-gradient-direction: ' + (Panel.checkIfVertical() ? 'horizontal;' : 'vertical;') +
+ this._gradientStyle += 'background-gradient-direction: ' + (this._dtpPanel.checkIfVertical() ? 'horizontal;' : 'vertical;') +
'background-gradient-start: ' + Utils.getrgbaColor(Me.settings.get_string('trans-gradient-top-color'),
Me.settings.get_double('trans-gradient-top-opacity')) +
'background-gradient-end: ' + Utils.getrgbaColor(Me.settings.get_string('trans-gradient-bottom-color'),
diff --git a/windowPreview.js b/windowPreview.js
index 2cad787..b8a4dff 100644
--- a/windowPreview.js
+++ b/windowPreview.js
@@ -53,7 +53,6 @@ const FADE_SIZE = 36;
const PEEK_INDEX_PROP = '_dtpPeekInitialIndex';
let headerHeight = 0;
-let clipHeight = 0;
let alphaBg = 0;
let isLeftButtons = false;
let isTopHeader = true;
@@ -80,7 +79,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(Panel.size, MAX_TRANSLATION) * this._translationDirection;
+ this._translationOffset = Math.min(panel.dtpSize, MAX_TRANSLATION) * this._translationDirection;
this.menu = new St.Widget({
name: 'preview-menu',
@@ -192,7 +191,7 @@ var PreviewMenu = Utils.defineClass({
if (!this.opened) {
this._refreshGlobals();
- this.set_height(clipHeight);
+ this.set_height(this.clipHeight);
this.menu.show();
setStyle(this.menu, 'background: ' + Utils.getrgbaColor(this.panel.dynamicTransparency.backgroundColorRgb, alphaBg));
@@ -442,25 +441,25 @@ var PreviewMenu = Utils.defineClass({
if (this.isVertical) {
w = previewSize;
- clipHeight = this.panel.monitor.height;
+ this.clipHeight = this.panel.monitor.height;
y = this.panel.monitor.y;
} else {
w = this.panel.monitor.width;
- clipHeight = (previewSize + headerHeight);
+ this.clipHeight = (previewSize + headerHeight);
x = this.panel.monitor.x;
}
if (geom.position == St.Side.LEFT) {
- x = this.panel.monitor.x + Panel.size + panelBoxTheme.get_padding(St.Side.LEFT);
+ x = this.panel.monitor.x + this.panel.dtpSize + panelBoxTheme.get_padding(St.Side.LEFT);
} else if (geom.position == St.Side.RIGHT) {
- x = this.panel.monitor.x + this.panel.monitor.width - (Panel.size + previewSize) - panelBoxTheme.get_padding(St.Side.RIGHT);
+ x = this.panel.monitor.x + this.panel.monitor.width - (this.panel.dtpSize + previewSize) - panelBoxTheme.get_padding(St.Side.RIGHT);
} else if (geom.position == St.Side.TOP) {
- y = this.panel.monitor.y + Panel.size + panelBoxTheme.get_padding(St.Side.TOP);
+ y = this.panel.monitor.y + this.panel.dtpSize + panelBoxTheme.get_padding(St.Side.TOP);
} else { //St.Side.BOTTOM
- y = this.panel.monitor.y + this.panel.monitor.height - (Panel.size + panelBoxTheme.get_padding(St.Side.BOTTOM) + previewSize + headerHeight);
+ y = this.panel.monitor.y + this.panel.monitor.height - (this.panel.dtpSize + panelBoxTheme.get_padding(St.Side.BOTTOM) + previewSize + headerHeight);
}
- Utils.setClip(this, x, y, w, clipHeight);
+ Utils.setClip(this, x, y, w, this.clipHeight);
},
_updatePosition: function() {
@@ -526,7 +525,7 @@ var PreviewMenu = Utils.defineClass({
let endBg = Utils.getrgbaColor(this.panel.dynamicTransparency.backgroundColorRgb, 0)
let fadeStyle = 'background-gradient-start:' + startBg +
'background-gradient-end:' + endBg +
- 'background-gradient-direction:' + Panel.getOrientation();
+ 'background-gradient-direction:' + this.panel.getOrientation();
if (this.isVertical) {
y = end ? this.panel.monitor.height - FADE_SIZE : 0;