mirror of
https://github.com/morgan9e/dash-to-panel
synced 2026-04-14 00:04:17 +09:00
Use custom panel on primary monitor
This commit is contained in:
12
appIcons.js
12
appIcons.js
@@ -97,8 +97,8 @@ var taskbarAppIcon = Utils.defineClass({
|
||||
Extends: (Dash.DashIcon || AppDisplay.AppIcon),
|
||||
ParentConstrParams: [[0, 'app'], [2]],
|
||||
|
||||
_init: function(appInfo, panelWrapper, iconParams, previewMenu) {
|
||||
this.panelWrapper = panelWrapper;
|
||||
_init: function(appInfo, panel, iconParams, previewMenu) {
|
||||
this.panel = panel;
|
||||
this._nWindows = 0;
|
||||
this.window = appInfo.window;
|
||||
this.isLauncher = appInfo.isLauncher;
|
||||
@@ -174,7 +174,7 @@ var taskbarAppIcon = Utils.defineClass({
|
||||
this.actor.set_child(this._container);
|
||||
|
||||
if (isVertical) {
|
||||
this.actor.set_width(panelWrapper.geom.w);
|
||||
this.actor.set_width(panel.geom.w);
|
||||
}
|
||||
|
||||
// Monitor windows-changes instead of app state.
|
||||
@@ -513,7 +513,7 @@ var taskbarAppIcon = Utils.defineClass({
|
||||
return global.display.focus_window &&
|
||||
(!Me.settings.get_boolean('multi-monitors') || // only check same monitor index if multi window is enabled.
|
||||
!Me.settings.get_boolean('isolate-monitors') ||
|
||||
global.display.focus_window.get_monitor() === this.panelWrapper.monitor.index);
|
||||
global.display.focus_window.get_monitor() === this.panel.monitor.index);
|
||||
},
|
||||
|
||||
_setAppIconPadding: function() {
|
||||
@@ -789,7 +789,7 @@ var taskbarAppIcon = Utils.defineClass({
|
||||
}
|
||||
} else {
|
||||
//grouped application behaviors
|
||||
let monitor = this.panelWrapper.monitor;
|
||||
let monitor = this.panel.monitor;
|
||||
let appHasFocus = this._checkIfFocusedApp() && this._checkIfMonitorHasFocus();
|
||||
|
||||
switch (buttonAction) {
|
||||
@@ -1142,7 +1142,7 @@ var taskbarAppIcon = Utils.defineClass({
|
||||
},
|
||||
|
||||
getAppIconInterestingWindows: function(isolateMonitors) {
|
||||
return getInterestingWindows(this.app, this.panelWrapper.monitor, isolateMonitors);
|
||||
return getInterestingWindows(this.app, this.panel.monitor, isolateMonitors);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
@@ -354,14 +354,12 @@ var Intellihide = Utils.defineClass({
|
||||
},
|
||||
|
||||
_checkIfGrab: function() {
|
||||
if (GrabHelper._grabHelperStack.some(gh => this._panelBox.contains(gh._owner))) {
|
||||
if (GrabHelper._grabHelperStack.some(gh => gh._owner == this._dtpPanel.grabOwner)) {
|
||||
//there currently is a grab on a child of the panel, check again soon to catch its release
|
||||
this._timeoutsHandler.add([T1, CHECK_GRAB_MS, () => this._queueUpdatePanelPosition()]);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
},
|
||||
|
||||
_revealPanel: function(immediate) {
|
||||
|
||||
492
panel.js
492
panel.js
@@ -86,48 +86,93 @@ function getOrientation() {
|
||||
return (checkIfVertical() ? 'vertical' : 'horizontal');
|
||||
}
|
||||
|
||||
var dtpPanelWrapper = Utils.defineClass({
|
||||
Name: 'DashToPanel.PanelWrapper',
|
||||
var dtpPanel = Utils.defineClass({
|
||||
Name: 'DashToPanel-Panel',
|
||||
Extends: St.Widget,
|
||||
|
||||
_init: function(panelManager, monitor, panelBox, isSecondary) {
|
||||
this.callParent('_init', { name: 'panel', reactive: true });
|
||||
|
||||
Utils.wrapActor(this);
|
||||
|
||||
_init: function(panelManager, monitor, panel, panelBox, isSecondary) {
|
||||
this.panelManager = panelManager;
|
||||
this.panelStyle = new PanelStyle.dtpPanelStyle();
|
||||
|
||||
this.monitor = monitor;
|
||||
this.panel = panel;
|
||||
this.panelBox = panelBox;
|
||||
this.isSecondary = isSecondary;
|
||||
this._sessionStyle = null;
|
||||
|
||||
Utils.wrapActor(this.panel);
|
||||
Utils.wrapActor(this.panel.statusArea.activities || 0);
|
||||
this._leftCorner = new Panel.PanelCorner(St.Side.LEFT);
|
||||
this.add_actor(this._leftCorner.actor);
|
||||
|
||||
this._rightCorner = new Panel.PanelCorner(St.Side.RIGHT);
|
||||
this.add_actor(this._rightCorner.actor);
|
||||
|
||||
this._dtpSettingsSignalIds = [];
|
||||
|
||||
if (isSecondary) {
|
||||
this.statusArea = {};
|
||||
|
||||
this._leftBox = new St.BoxLayout({ name: 'panelLeft' });
|
||||
this._centerBox = new St.BoxLayout({ name: 'panelCenter' });
|
||||
this._rightBox = new St.BoxLayout({ name: 'panelRight' });
|
||||
|
||||
this.menuManager = new PopupMenu.PopupMenuManager(this);
|
||||
this.grabOwner = this;
|
||||
|
||||
//adding the clock to the centerbox will correctly position it according to dtp settings (event in dtpPanel)
|
||||
this._setPanelMenu('show-status-menu-all-monitors', 'aggregateMenu', dtpSecondaryAggregateMenu, this._rightBox, true);
|
||||
this._setPanelMenu('show-clock-all-monitors', 'dateMenu', DateMenu.DateMenuButton, this._centerBox, true);
|
||||
} else {
|
||||
this.statusArea = Main.panel.statusArea;
|
||||
this.menuManager = Main.panel.menuManager;
|
||||
this.grabOwner = Main.panel;
|
||||
|
||||
['_leftBox', '_centerBox', '_rightBox'].forEach(p => {
|
||||
Main.panel.actor.remove_child(Main.panel[p]);
|
||||
this[p] = Main.panel[p];
|
||||
});
|
||||
}
|
||||
|
||||
this.add_child(this._leftBox);
|
||||
this.add_child(this._centerBox);
|
||||
this.add_child(this._rightBox);
|
||||
|
||||
Utils.wrapActor(this.statusArea.activities || 0);
|
||||
|
||||
if (Main.panel._onButtonPress) {
|
||||
this.connect('button-press-event', Main.panel._onButtonPress.bind(this));
|
||||
this.connect('touch-event', Main.panel._onButtonPress.bind(this));
|
||||
}
|
||||
|
||||
if (Main.panel._onKeyPress) {
|
||||
this.connect('key-press-event', Main.panel._onKeyPress.bind(this));
|
||||
}
|
||||
|
||||
Main.ctrlAltTabManager.addGroup(this, _("Top Bar")+" "+ monitor.index, 'focus-top-bar-symbolic',
|
||||
{ sortGroup: CtrlAltTab.SortGroup.TOP });
|
||||
},
|
||||
|
||||
enable : function() {
|
||||
let taskbarPosition = Me.settings.get_string('taskbar-position');
|
||||
if (taskbarPosition == 'CENTEREDCONTENT' || taskbarPosition == 'CENTEREDMONITOR') {
|
||||
this.container = this.panel._centerBox;
|
||||
this.container = this._centerBox;
|
||||
} else {
|
||||
this.container = this.panel._leftBox;
|
||||
this.container = this._leftBox;
|
||||
}
|
||||
this.appMenu = this.panel.statusArea.appMenu;
|
||||
|
||||
if (this.panel.statusArea.aggregateMenu) {
|
||||
this.panel.statusArea.aggregateMenu._volume.indicators._dtpIgnoreScroll = 1;
|
||||
if (this.statusArea.aggregateMenu) {
|
||||
this.statusArea.aggregateMenu._volume.indicators._dtpIgnoreScroll = 1;
|
||||
}
|
||||
|
||||
this.geom = this._getGeometry();
|
||||
|
||||
this._oldPanelActorDelegate = this.panel.actor._delegate;
|
||||
this.panel.actor._delegate = this;
|
||||
|
||||
this._oldPanelHeight = this.panel.actor.get_height();
|
||||
|
||||
this.panelBg = new St.Widget({ layout_manager: new Clutter.BinLayout() });
|
||||
this.panelBox.remove_actor(this.panel.actor);
|
||||
this.panelBg.add_child(this.panel.actor);
|
||||
this.panelBox.remove_actor(this);
|
||||
this.panelBg.add_child(this);
|
||||
this.panelBox.add(this.panelBg);
|
||||
|
||||
this.panelBg.styles = 'border-radius: ' + this.panel.actor.get_theme_node().get_border_radius(0) + 'px;';
|
||||
this.panelBg.styles = 'border-radius: ' + this.get_theme_node().get_border_radius(0) + 'px;';
|
||||
|
||||
this._adjustForOverview();
|
||||
|
||||
@@ -142,32 +187,10 @@ var dtpPanelWrapper = Utils.defineClass({
|
||||
this._setPanelPosition();
|
||||
}));
|
||||
|
||||
// The main panel's connection to the "allocate" signal is competing with this extension
|
||||
// trying to move the centerBox over to the right, creating a never-ending cycle.
|
||||
// Since we don't have the ID to disconnect that handler, wrap the allocate() function
|
||||
// it calls instead. If the call didn't originate from this file, ignore it.
|
||||
this.panel._leftBox.oldLeftBoxAllocate = this.panel._leftBox.allocate;
|
||||
this.panel._leftBox.allocate = Lang.bind(this.panel._leftBox, function(box, flags, isFromDashToPanel) {
|
||||
if(isFromDashToPanel === true)
|
||||
this.oldLeftBoxAllocate(box, flags);
|
||||
});
|
||||
|
||||
this.panel._centerBox.oldCenterBoxAllocate = this.panel._centerBox.allocate;
|
||||
this.panel._centerBox.allocate = Lang.bind(this.panel._centerBox, function(box, flags, isFromDashToPanel) {
|
||||
if(isFromDashToPanel === true)
|
||||
this.oldCenterBoxAllocate(box, flags);
|
||||
});
|
||||
|
||||
this.panel._rightBox.oldRightBoxAllocate = this.panel._rightBox.allocate;
|
||||
this.panel._rightBox.allocate = Lang.bind(this.panel._rightBox, function(box, flags, isFromDashToPanel) {
|
||||
if(isFromDashToPanel === true)
|
||||
this.oldRightBoxAllocate(box, flags);
|
||||
});
|
||||
|
||||
if (!this.isSecondary) {
|
||||
// The overview uses the this.panel height as a margin by way of a "ghost" transparent Clone
|
||||
// This pushes everything down, which isn't desired when the this.panel is moved to the bottom
|
||||
// I'm adding a 2nd ghost this.panel and will resize the top or bottom ghost depending on the this.panel position
|
||||
// The overview uses the panel height as a margin by way of a "ghost" transparent Clone
|
||||
// This pushes everything down, which isn't desired when the panel is moved to the bottom
|
||||
// I'm adding a 2nd ghost panel and will resize the top or bottom ghost depending on the panel position
|
||||
if (this.geom.position != St.Side.TOP) {
|
||||
this._myPanelGhost = new Clutter.Actor({
|
||||
x: this.geom.x,
|
||||
@@ -187,25 +210,20 @@ var dtpPanelWrapper = Utils.defineClass({
|
||||
}
|
||||
|
||||
Main.overview._panelGhost.set_height(0);
|
||||
}
|
||||
|
||||
if (this.panel.vfunc_allocate) {
|
||||
this._panelConnectId = 0;
|
||||
Utils.hookVfunc(this.panel.__proto__, 'allocate', (box, flags) => this._vfunc_allocate(box, flags));
|
||||
} else {
|
||||
this._panelConnectId = this.panel.actor.connect('allocate', (actor,box,flags) => this._allocate(actor,box,flags));
|
||||
Main.overview._panelGhost.set_height(this.geom.h);
|
||||
}
|
||||
}
|
||||
|
||||
this.panel.menuManager._oldChangeMenu = this.panel.menuManager._changeMenu;
|
||||
this.panel.menuManager._changeMenu = (menu) => {
|
||||
this.menuManager._oldChangeMenu = this.menuManager._changeMenu;
|
||||
this.menuManager._changeMenu = (menu) => {
|
||||
if (!Me.settings.get_boolean('stockgs-panelbtn-click-only')) {
|
||||
this.panel.menuManager._oldChangeMenu(menu);
|
||||
this.menuManager._oldChangeMenu(menu);
|
||||
}
|
||||
};
|
||||
|
||||
if(this.appMenu)
|
||||
this.panel._leftBox.remove_child(this.appMenu.container);
|
||||
if(this.statusArea.appMenu)
|
||||
this._leftBox.remove_child(this.statusArea.appMenu.container);
|
||||
|
||||
//the timeout makes sure the theme's styles are computed before initially applying the transparency
|
||||
this.startDynamicTransparencyId = Mainloop.timeout_add(0, () => {
|
||||
@@ -223,7 +241,7 @@ var dtpPanelWrapper = Utils.defineClass({
|
||||
this._setClockLocation(Me.settings.get_string('location-clock'));
|
||||
this._displayShowDesktopButton(Me.settings.get_boolean('show-showdesktop-button'));
|
||||
|
||||
this.panel.actor.add_style_class_name('dashtopanelMainPanel');
|
||||
this.add_style_class_name('dashtopanelMainPanel');
|
||||
|
||||
// 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
|
||||
@@ -275,19 +293,19 @@ var dtpPanelWrapper = Utils.defineClass({
|
||||
() => this._adjustForOverview()
|
||||
],
|
||||
[
|
||||
this.panel._rightBox,
|
||||
this._rightBox,
|
||||
'actor-added',
|
||||
Lang.bind(this, function() {
|
||||
this._setClockLocation(Me.settings.get_string('location-clock'));
|
||||
})
|
||||
],
|
||||
[
|
||||
this.panel._centerBox,
|
||||
this._centerBox,
|
||||
'actor-added',
|
||||
() => this._setClockLocation(Me.settings.get_string('location-clock'))
|
||||
],
|
||||
[
|
||||
this.panel.actor,
|
||||
this,
|
||||
'scroll-event',
|
||||
this._onPanelMouseScroll.bind(this)
|
||||
]
|
||||
@@ -295,23 +313,12 @@ var dtpPanelWrapper = Utils.defineClass({
|
||||
|
||||
this._bindSettingsChanges();
|
||||
|
||||
this.panelStyle.enable(this.panel);
|
||||
|
||||
// Dynamic transparency is available on Gnome 3.26
|
||||
if (this.panel._updateSolidStyle) {
|
||||
this._injectionsHandler = new Utils.InjectionsHandler();
|
||||
this._injectionsHandler.addWithLabel('transparency', [
|
||||
this.panel,
|
||||
'_updateSolidStyle',
|
||||
() => {}
|
||||
]);
|
||||
this.panel.actor.remove_style_class_name('solid');
|
||||
}
|
||||
this.panelStyle.enable(this);
|
||||
|
||||
// Since we are usually visible but not usually changing, make sure
|
||||
// most repaint requests don't actually require us to repaint anything.
|
||||
// This saves significant CPU when repainting the screen.
|
||||
this.panel.actor.set_offscreen_redirect(Clutter.OffscreenRedirect.ALWAYS);
|
||||
// Since we are usually visible but not usually changing, make sure
|
||||
// most repaint requests don't actually require us to repaint anything.
|
||||
// This saves significant CPU when repainting the screen.
|
||||
this.set_offscreen_redirect(Clutter.OffscreenRedirect.ALWAYS);
|
||||
},
|
||||
|
||||
disable: function () {
|
||||
@@ -320,8 +327,8 @@ var dtpPanelWrapper = Utils.defineClass({
|
||||
this._signalsHandler.destroy();
|
||||
this.container.remove_child(this.taskbar.actor);
|
||||
this._setAppmenuVisible(false);
|
||||
if(this.appMenu)
|
||||
this.panel._leftBox.add_child(this.appMenu.container);
|
||||
if(this.statusArea.appMenu)
|
||||
this._leftBox.add_child(this.statusArea.appMenu.container);
|
||||
|
||||
if (this.startIntellihideId) {
|
||||
Mainloop.source_remove(this.startIntellihideId);
|
||||
@@ -352,12 +359,10 @@ var dtpPanelWrapper = Utils.defineClass({
|
||||
// reset stored icon size to the default dash
|
||||
Main.overview.dashIconSize = Main.overview._controls.dash.iconSize;
|
||||
|
||||
this.panelBg.remove_actor(this.panel.actor);
|
||||
this.panelBox.add(this.panel.actor);
|
||||
this.panelBg.remove_actor(this);
|
||||
this.panelBox.add(this);
|
||||
|
||||
this.panel.actor.remove_style_class_name('dashtopanelMainPanel');
|
||||
|
||||
// remove this.panel styling
|
||||
// remove panel styling
|
||||
if(this._HeightNotifyListener !== null) {
|
||||
this.panelBox.disconnect(this._HeightNotifyListener);
|
||||
}
|
||||
@@ -369,22 +374,17 @@ var dtpPanelWrapper = Utils.defineClass({
|
||||
Me.settings.disconnect(this._dtpSettingsSignalIds[i]);
|
||||
}
|
||||
|
||||
this._removeTopLimit();
|
||||
|
||||
if (this.panel._updateSolidStyle) {
|
||||
this._injectionsHandler.removeWithLabel('transparency');
|
||||
this._injectionsHandler.destroy();
|
||||
}
|
||||
|
||||
this.panel.menuManager._changeMenu = this.panel.menuManager._oldChangeMenu;
|
||||
this.panel.actor._delegate = this._oldPanelActorDelegate;
|
||||
this.menuManager._changeMenu = this.menuManager._oldChangeMenu;
|
||||
|
||||
if (!this.isSecondary) {
|
||||
this.panel.actor.set_height(this._oldPanelHeight);
|
||||
this.panel.actor.set_width(-1);
|
||||
this._setVertical(this.panel.actor, false);
|
||||
['_leftBox', '_centerBox', '_rightBox'].forEach(p => {
|
||||
this.remove_child(Main.panel[p]);
|
||||
Main.panel.actor.add_child(Main.panel[p]);
|
||||
});
|
||||
|
||||
this._setVertical(this, false);
|
||||
|
||||
Main.overview._panelGhost.set_size(this.monitor.width, this._oldPanelHeight);
|
||||
Main.overview._panelGhost.set_size(this.monitor.width, Main.panel.height);
|
||||
|
||||
if (this._myPanelGhost) {
|
||||
this._myPanelGhost.get_parent().remove_actor(this._myPanelGhost);
|
||||
@@ -394,40 +394,38 @@ var dtpPanelWrapper = Utils.defineClass({
|
||||
this._setClockLocation("BUTTONSLEFT");
|
||||
this._displayShowDesktopButton(false);
|
||||
|
||||
if (this._panelConnectId) {
|
||||
this.panel.actor.disconnect(this._panelConnectId);
|
||||
} else {
|
||||
Utils.hookVfunc(this.panel.__proto__, 'allocate', this.panel.__proto__.vfunc_allocate);
|
||||
if (this.statusArea.aggregateMenu) {
|
||||
delete this.statusArea.aggregateMenu._volume.indicators._dtpIgnoreScroll;
|
||||
}
|
||||
|
||||
if (this.panel.statusArea.aggregateMenu) {
|
||||
delete this.panel.statusArea.aggregateMenu._volume.indicators._dtpIgnoreScroll;
|
||||
}
|
||||
|
||||
this.panel._leftBox.allocate = this.panel._leftBox.oldLeftBoxAllocate;
|
||||
delete this.panel._leftBox.oldLeftBoxAllocate;
|
||||
|
||||
this.panel._centerBox.allocate = this.panel._centerBox.oldCenterBoxAllocate;
|
||||
delete this.panel._centerBox.oldCenterBoxAllocate;
|
||||
|
||||
this.panel._rightBox.allocate = this.panel._rightBox.oldRightBoxAllocate;
|
||||
delete this.panel._rightBox.oldRightBoxAllocate;
|
||||
} else {
|
||||
this.panel.delegate = null;
|
||||
Main.layoutManager.removeChrome(this.panelBox);
|
||||
this.panel.destroy();
|
||||
this.panelBox.destroy();
|
||||
this._removePanelMenu('dateMenu');
|
||||
this._removePanelMenu('aggregateMenu');
|
||||
}
|
||||
|
||||
this.appMenu = null;
|
||||
Main.ctrlAltTabManager.removeGroup(this);
|
||||
|
||||
Main.layoutManager.removeChrome(this.panelBox);
|
||||
this.panelBox.destroy();
|
||||
|
||||
this.container = null;
|
||||
this.panel = null;
|
||||
this.taskbar = null;
|
||||
this._panelConnectId = null;
|
||||
this._signalsHandler = null;
|
||||
this._HeightNotifyListener = null;
|
||||
},
|
||||
|
||||
//next 3 functions are needed by other extensions to add elements to the secondary panel
|
||||
addToStatusArea: function(role, indicator, position, box) {
|
||||
return Main.panel.addToStatusArea.call(this, role, indicator, position, box);
|
||||
},
|
||||
|
||||
_addToPanelBox: function(role, indicator, position, box) {
|
||||
Main.panel._addToPanelBox.call(this, role, indicator, position, box);
|
||||
},
|
||||
|
||||
_onMenuSet: function(indicator) {
|
||||
Main.panel._onMenuSet.call(this, indicator);
|
||||
},
|
||||
|
||||
handleDragOver: function(source, actor, x, y, time) {
|
||||
if (source == Main.xdndHandler) {
|
||||
|
||||
@@ -441,7 +439,7 @@ var dtpPanelWrapper = Utils.defineClass({
|
||||
},
|
||||
|
||||
_bindSettingsChanges: function() {
|
||||
this._dtpSettingsSignalIds = [
|
||||
this._dtpSettingsSignalIds = this._dtpSettingsSignalIds.concat([
|
||||
Me.settings.connect('changed::panel-size', Lang.bind(this, function() {
|
||||
this._resetGeometry();
|
||||
})),
|
||||
@@ -470,16 +468,45 @@ 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._setShowDesktopButtonSize()),
|
||||
|
||||
Me.settings.connect('changed::group-apps', () => this._resetGeometry())
|
||||
];
|
||||
]);
|
||||
|
||||
if (checkIfVertical()) {
|
||||
this._dtpSettingsSignalIds.push(Me.settings.connect('changed::group-apps-label-max-width', () => this._resetGeometry()));
|
||||
}
|
||||
},
|
||||
|
||||
_setPanelMenu: function(settingName, propName, constr, container, isInit) {
|
||||
if (isInit) {
|
||||
this._dtpSettingsSignalIds.push(Me.settings.connect(
|
||||
'changed::' + settingName, () => this._setPanelMenu(settingName, propName, constr, container)));
|
||||
}
|
||||
|
||||
if (!Me.settings.get_boolean(settingName)) {
|
||||
this._removePanelMenu(propName);
|
||||
} else if (!this.statusArea[propName]) {
|
||||
this.statusArea[propName] = new constr();
|
||||
this.menuManager.addMenu(this.statusArea[propName].menu);
|
||||
container.insert_child_at_index(this.statusArea[propName].container, 0);
|
||||
}
|
||||
},
|
||||
|
||||
_removePanelMenu: function(propName) {
|
||||
if (this.statusArea[propName]) {
|
||||
let parent = this.statusArea[propName].container.get_parent();
|
||||
|
||||
if (parent) {
|
||||
parent.remove_actor(this.statusArea[propName].container);
|
||||
}
|
||||
|
||||
//this.statusArea[propName].destroy(); //buggy for now, gnome-shell never destroys those menus
|
||||
this.menuManager.removeMenu(this.statusArea[propName].menu);
|
||||
this.statusArea[propName] = null;
|
||||
}
|
||||
},
|
||||
|
||||
_adjustForOverview: function() {
|
||||
let isFocusedMonitor = this.panelManager.checkIfFocusedMonitor(this.monitor);
|
||||
let isOverview = !!Main.overview.visibleTarget;
|
||||
@@ -541,18 +568,14 @@ var dtpPanelWrapper = Utils.defineClass({
|
||||
};
|
||||
},
|
||||
|
||||
_vfunc_allocate: function(box, flags) {
|
||||
this.panel.set_allocation(box, flags);
|
||||
this._allocate(null, box, flags);
|
||||
},
|
||||
|
||||
_allocate: function(actor, box, flags) {
|
||||
vfunc_allocate: function(box, flags) {
|
||||
this.set_allocation(box, flags);
|
||||
|
||||
let panelAllocVarSize = box[varCoord.c2] - box[varCoord.c1];
|
||||
let panelAllocFixedSize = box[fixedCoord.c2] - box[fixedCoord.c1];
|
||||
let [, leftNaturalSize] = this.panel._leftBox[sizeFunc](-1);
|
||||
let [, centerNaturalSize] = this.panel._centerBox[sizeFunc](-1);
|
||||
let [, rightNaturalSize] = this.panel._rightBox[sizeFunc](-1);
|
||||
|
||||
let [, leftNaturalSize] = this._leftBox[sizeFunc](-1);
|
||||
let [, centerNaturalSize] = this._centerBox[sizeFunc](-1);
|
||||
let [, rightNaturalSize] = this._rightBox[sizeFunc](-1);
|
||||
let taskbarPosition = Me.settings.get_string('taskbar-position');
|
||||
|
||||
// The _rightBox is always allocated the same, regardless of taskbar position setting
|
||||
@@ -597,7 +620,7 @@ var dtpPanelWrapper = Utils.defineClass({
|
||||
childBoxLeft[fixedCoord.c2] = childBoxCenter[fixedCoord.c2] = childBoxRight[fixedCoord.c2] = panelAllocFixedSize;
|
||||
|
||||
// if it is a RTL language, the boxes are switched around, and we need to invert the coordinates
|
||||
if (this.panel.actor.get_text_direction() == Clutter.TextDirection.RTL) {
|
||||
if (this.get_text_direction() == Clutter.TextDirection.RTL) {
|
||||
childBoxLeft[varCoord.c1] = panelAllocVarSize - leftAllocSize;
|
||||
childBoxLeft[varCoord.c2] = panelAllocVarSize;
|
||||
|
||||
@@ -618,53 +641,41 @@ var dtpPanelWrapper = Utils.defineClass({
|
||||
}
|
||||
|
||||
let childBoxLeftCorner = new Clutter.ActorBox();
|
||||
let [ , cornerSize] = this.panel._leftCorner.actor[sizeFunc](-1);
|
||||
let [ , cornerSize] = this._leftCorner.actor[sizeFunc](-1);
|
||||
childBoxLeftCorner[varCoord.c1] = 0;
|
||||
childBoxLeftCorner[varCoord.c2] = cornerSize;
|
||||
childBoxLeftCorner[fixedCoord.c1] = panelAllocFixedSize;
|
||||
childBoxLeftCorner[fixedCoord.c2] = panelAllocFixedSize + cornerSize;
|
||||
|
||||
let childBoxRightCorner = new Clutter.ActorBox();
|
||||
[ , cornerSize] = this.panel._rightCorner.actor[sizeFunc](-1);
|
||||
[ , cornerSize] = this._rightCorner.actor[sizeFunc](-1);
|
||||
childBoxRightCorner[varCoord.c1] = panelAllocVarSize - cornerSize;
|
||||
childBoxRightCorner[varCoord.c2] = panelAllocVarSize;
|
||||
childBoxRightCorner[fixedCoord.c1] = panelAllocFixedSize;
|
||||
childBoxRightCorner[fixedCoord.c2] = panelAllocFixedSize + cornerSize;
|
||||
|
||||
this.panel._leftBox.allocate(childBoxLeft, flags, true);
|
||||
this.panel._centerBox.allocate(childBoxCenter, flags, true);
|
||||
this.panel._rightBox.allocate(childBoxRight, flags, true);
|
||||
this.panel._leftCorner.actor.allocate(childBoxLeftCorner, flags);
|
||||
this.panel._rightCorner.actor.allocate(childBoxRightCorner, flags);
|
||||
this._leftBox.allocate(childBoxLeft, flags);
|
||||
this._centerBox.allocate(childBoxCenter, flags);
|
||||
this._rightBox.allocate(childBoxRight, flags);
|
||||
this._leftCorner.actor.allocate(childBoxLeftCorner, flags);
|
||||
this._rightCorner.actor.allocate(childBoxRightCorner, flags);
|
||||
},
|
||||
|
||||
_setPanelPosition: function(verticalize) {
|
||||
let container = this.intellihide && this.intellihide.enabled ? this.panelBox.get_parent() : this.panelBox;
|
||||
|
||||
this.panel.actor.set_size(this.geom.w, this.geom.h);
|
||||
this.set_size(this.geom.w, this.geom.h);
|
||||
container.set_position(this.geom.x, this.geom.y)
|
||||
|
||||
if (verticalize) {
|
||||
this._setVertical(this.panel.actor, checkIfVertical());
|
||||
}
|
||||
|
||||
if (this.geom.position == St.Side.TOP) {
|
||||
this._removeTopLimit();
|
||||
} else {
|
||||
if (!this._topLimit) {
|
||||
this._topLimit = new St.BoxLayout({ name: 'topLimit' });
|
||||
Main.layoutManager.addChrome(this._topLimit, { affectsStruts: true, trackFullscreen: true });
|
||||
}
|
||||
|
||||
this._topLimit.set_position(this.monitor.x, this.monitor.y);
|
||||
this._topLimit.set_size(this.monitor.width, -1);
|
||||
this._setVertical(this, checkIfVertical());
|
||||
}
|
||||
|
||||
// styles for theming
|
||||
Object.keys(St.Side).forEach(p => {
|
||||
let cssName = p.charAt(0) + p.slice(1).toLowerCase();
|
||||
|
||||
this.panel.actor[(p == this.geom.position ? 'add' : 'remove') + '_style_class_name']('dashtopanel' + cssName);
|
||||
this[(p == this.geom.position ? 'add' : 'remove') + '_style_class_name']('dashtopanel' + cssName);
|
||||
});
|
||||
|
||||
Main.layoutManager._updateHotCorners();
|
||||
@@ -681,43 +692,38 @@ var dtpPanelWrapper = Utils.defineClass({
|
||||
}
|
||||
},
|
||||
|
||||
_removeTopLimit: function() {
|
||||
if (this._topLimit) {
|
||||
Main.layoutManager.removeChrome(this._topLimit);
|
||||
this._topLimit = null;
|
||||
}
|
||||
},
|
||||
|
||||
_setActivitiesButtonVisible: function(isVisible) {
|
||||
if(this.panel.statusArea.activities)
|
||||
isVisible ? this.panel.statusArea.activities.actor.show() :
|
||||
this.panel.statusArea.activities.actor.hide();
|
||||
if(this.statusArea.activities)
|
||||
isVisible ? this.statusArea.activities.actor.show() :
|
||||
this.statusArea.activities.actor.hide();
|
||||
},
|
||||
|
||||
_setAppmenuVisible: function(isVisible) {
|
||||
let parent;
|
||||
if(this.appMenu)
|
||||
parent = this.appMenu.container.get_parent();
|
||||
let appMenu = this.statusArea.appMenu;
|
||||
|
||||
if(appMenu)
|
||||
parent = appMenu.container.get_parent();
|
||||
|
||||
if (parent) {
|
||||
parent.remove_child(this.appMenu.container);
|
||||
parent.remove_child(appMenu.container);
|
||||
}
|
||||
|
||||
if (isVisible && this.appMenu) {
|
||||
if (isVisible && appMenu) {
|
||||
let taskbarPosition = Me.settings.get_string('taskbar-position');
|
||||
if (taskbarPosition == 'CENTEREDCONTENT' || taskbarPosition == 'CENTEREDMONITOR') {
|
||||
this.panel._leftBox.insert_child_above(this.appMenu.container, null);
|
||||
this._leftBox.insert_child_above(appMenu.container, null);
|
||||
} else {
|
||||
this.panel._centerBox.insert_child_at_index(this.appMenu.container, 0);
|
||||
this._centerBox.insert_child_at_index(appMenu.container, 0);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
_setClockLocation: function(loc) {
|
||||
if(!this.panel.statusArea.dateMenu)
|
||||
if(!this.statusArea.dateMenu)
|
||||
return;
|
||||
|
||||
let dateMenuContainer = this.panel.statusArea.dateMenu.container;
|
||||
let dateMenuContainer = this.statusArea.dateMenu.container;
|
||||
let parent = dateMenuContainer.get_parent();
|
||||
let destination;
|
||||
let refSibling = null;
|
||||
@@ -727,10 +733,10 @@ var dtpPanelWrapper = Utils.defineClass({
|
||||
}
|
||||
|
||||
if (loc.indexOf('BUTTONS') == 0) {
|
||||
destination = this.panel._centerBox;
|
||||
destination = this._centerBox;
|
||||
} else if (loc.indexOf('STATUS') == 0) {
|
||||
refSibling = this.panel.statusArea.aggregateMenu ? this.panel.statusArea.aggregateMenu.container : null;
|
||||
destination = this.panel._rightBox;
|
||||
refSibling = this.statusArea.aggregateMenu ? this.statusArea.aggregateMenu.container : null;
|
||||
destination = this._rightBox;
|
||||
} else { //TASKBAR
|
||||
refSibling = this.taskbar.actor;
|
||||
destination = refSibling.get_parent();
|
||||
@@ -756,7 +762,7 @@ var dtpPanelWrapper = Utils.defineClass({
|
||||
y_fill: true,
|
||||
track_hover: true });
|
||||
|
||||
this._setShowDesktopButtonWidth();
|
||||
this._setShowDesktopButtonSize();
|
||||
|
||||
this._showDesktopButton.connect('button-press-event', Lang.bind(this, this._onShowDesktopButtonPress));
|
||||
|
||||
@@ -785,20 +791,25 @@ var dtpPanelWrapper = Utils.defineClass({
|
||||
}
|
||||
}));
|
||||
|
||||
this.panel._rightBox.insert_child_at_index(this._showDesktopButton, this.panel._rightBox.get_children().length);
|
||||
this._rightBox.insert_child_at_index(this._showDesktopButton, this._rightBox.get_children().length);
|
||||
} else {
|
||||
if(!this._showDesktopButton)
|
||||
return;
|
||||
|
||||
this.panel._rightBox.remove_child(this._showDesktopButton);
|
||||
this._rightBox.remove_child(this._showDesktopButton);
|
||||
this._showDesktopButton.destroy();
|
||||
this._showDesktopButton = null;
|
||||
}
|
||||
},
|
||||
|
||||
_setShowDesktopButtonWidth: function() {
|
||||
_setShowDesktopButtonSize: function() {
|
||||
if (this._showDesktopButton) {
|
||||
this._showDesktopButton.set_style('width: ' + Me.settings.get_int('showdesktop-button-width') + 'px;');
|
||||
let buttonSize = Me.settings.get_int('showdesktop-button-width') + 'px;';
|
||||
let isVertical = checkIfVertical();
|
||||
let sytle = isVertical ? 'border-top-width:1px;height:' + buttonSize : 'border-left-width:1px;width:' + buttonSize;
|
||||
|
||||
this._showDesktopButton.set_style(sytle);
|
||||
this._showDesktopButton[(isVertical ? 'x' : 'y') + '_expand'] = true;
|
||||
}
|
||||
},
|
||||
|
||||
@@ -879,123 +890,6 @@ var dtpPanelWrapper = Utils.defineClass({
|
||||
},
|
||||
});
|
||||
|
||||
var dtpSecondaryPanel = Utils.defineClass({
|
||||
Name: 'DashToPanel-SecondaryPanel',
|
||||
Extends: St.Widget,
|
||||
|
||||
_init: function(settings, monitor) {
|
||||
this.callParent('_init', { name: 'panel', reactive: true });
|
||||
|
||||
Me.settings = settings;
|
||||
|
||||
this.actor = this;
|
||||
this._sessionStyle = null;
|
||||
|
||||
this.statusArea = { };
|
||||
|
||||
this.menuManager = new PopupMenu.PopupMenuManager(this);
|
||||
|
||||
this._leftBox = new St.BoxLayout({ name: 'panelLeft' });
|
||||
this.add_actor(this._leftBox);
|
||||
this._centerBox = new St.BoxLayout({ name: 'panelCenter' });
|
||||
this.add_actor(this._centerBox);
|
||||
this._rightBox = new St.BoxLayout({ name: 'panelRight' });
|
||||
this.add_actor(this._rightBox);
|
||||
|
||||
this._leftCorner = new Panel.PanelCorner(St.Side.LEFT);
|
||||
this.add_actor(this._leftCorner.actor);
|
||||
|
||||
this._rightCorner = new Panel.PanelCorner(St.Side.RIGHT);
|
||||
this.add_actor(this._rightCorner.actor);
|
||||
|
||||
this._panelMenuSignalIds = [];
|
||||
|
||||
//adding the clock to the centerbox will correctly position it according to dtp settings (event in dtpPanelWrapper)
|
||||
this._setPanelMenu('show-status-menu-all-monitors', 'aggregateMenu', dtpSecondaryAggregateMenu, this._rightBox, true);
|
||||
this._setPanelMenu('show-clock-all-monitors', 'dateMenu', DateMenu.DateMenuButton, this._centerBox, true);
|
||||
|
||||
this.connect('destroy', Lang.bind(this, this._onDestroy));
|
||||
|
||||
if (Main.panel._onButtonPress) {
|
||||
this.connect('button-press-event', Main.panel._onButtonPress.bind(this));
|
||||
this.connect('touch-event', Main.panel._onButtonPress.bind(this));
|
||||
}
|
||||
|
||||
if (Main.panel._onKeyPress) {
|
||||
this.connect('key-press-event', Main.panel._onKeyPress.bind(this));
|
||||
}
|
||||
|
||||
Main.ctrlAltTabManager.addGroup(this, _("Top Bar")+" "+ monitor.index, 'focus-top-bar-symbolic',
|
||||
{ sortGroup: CtrlAltTab.SortGroup.TOP });
|
||||
|
||||
},
|
||||
|
||||
vfunc_allocate: function(box, flags) {
|
||||
if (this.delegate) {
|
||||
this.delegate._vfunc_allocate(box, flags);
|
||||
}
|
||||
},
|
||||
|
||||
vfunc_get_preferred_width: function(forHeight) {
|
||||
if (this.delegate) {
|
||||
return [0, this.delegate.monitor.width];
|
||||
}
|
||||
|
||||
return [0, 0];
|
||||
},
|
||||
|
||||
_setPanelMenu: function(settingName, propName, constr, container, isInit) {
|
||||
if (isInit) {
|
||||
this._panelMenuSignalIds.push(Me.settings.connect(
|
||||
'changed::' + settingName, () => this._setPanelMenu(settingName, propName, constr, container)));
|
||||
}
|
||||
|
||||
if (!Me.settings.get_boolean(settingName)) {
|
||||
this._removePanelMenu(propName);
|
||||
} else if (!this.statusArea[propName]) {
|
||||
this.statusArea[propName] = new constr();
|
||||
this.menuManager.addMenu(this.statusArea[propName].menu);
|
||||
container.insert_child_at_index(this.statusArea[propName].container, 0);
|
||||
}
|
||||
},
|
||||
|
||||
_removePanelMenu: function(propName) {
|
||||
if (this.statusArea[propName]) {
|
||||
let parent = this.statusArea[propName].container.get_parent();
|
||||
|
||||
if (parent) {
|
||||
parent.remove_actor(this.statusArea[propName].container);
|
||||
}
|
||||
|
||||
//this.statusArea[propName].destroy(); //buggy for now, gnome-shell never destroys those menus
|
||||
this.menuManager.removeMenu(this.statusArea[propName].menu);
|
||||
this.statusArea[propName] = null;
|
||||
}
|
||||
},
|
||||
|
||||
_onDestroy: function() {
|
||||
Main.ctrlAltTabManager.removeGroup(this);
|
||||
|
||||
this._panelMenuSignalIds.forEach(id => Me.settings.disconnect(id));
|
||||
|
||||
this._removePanelMenu('dateMenu');
|
||||
this._removePanelMenu('aggregateMenu');
|
||||
},
|
||||
|
||||
//next 3 functions are needed by other extensions to add elements to the secondary panel
|
||||
addToStatusArea: function(role, indicator, position, box) {
|
||||
return Main.panel.addToStatusArea.call(this, role, indicator, position, box);
|
||||
},
|
||||
|
||||
_addToPanelBox: function(role, indicator, position, box) {
|
||||
Main.panel._addToPanelBox.call(this, role, indicator, position, box);
|
||||
},
|
||||
|
||||
_onMenuSet: function(indicator) {
|
||||
Main.panel._onMenuSet.call(this, indicator);
|
||||
},
|
||||
});
|
||||
|
||||
var dtpSecondaryAggregateMenu = Utils.defineClass({
|
||||
Name: 'dtpSecondaryAggregateMenu',
|
||||
Extends: PanelMenu.Button,
|
||||
|
||||
@@ -44,7 +44,6 @@ const St = imports.gi.St;
|
||||
const BoxPointer = imports.ui.boxpointer;
|
||||
const Dash = imports.ui.dash;
|
||||
const IconGrid = imports.ui.iconGrid;
|
||||
const LookingGlass = imports.ui.lookingGlass;
|
||||
const Main = imports.ui.main;
|
||||
const PanelMenu = imports.ui.panelMenu;
|
||||
const Layout = imports.ui.layout;
|
||||
@@ -68,28 +67,16 @@ var dtpPanelManager = Utils.defineClass({
|
||||
|
||||
this.proximityManager = new Proximity.ProximityManager();
|
||||
|
||||
this.primaryPanel = new Panel.dtpPanelWrapper(this, dtpPrimaryMonitor, Main.panel, Main.layoutManager.panelBox);
|
||||
this.primaryPanel.enable();
|
||||
Main.panel.actor.hide();
|
||||
|
||||
this.primaryPanel = this._createPanel(dtpPrimaryMonitor);
|
||||
this.allPanels = [ this.primaryPanel ];
|
||||
|
||||
this.overview.enable(this.primaryPanel);
|
||||
|
||||
if (Me.settings.get_boolean('multi-monitors')) {
|
||||
Main.layoutManager.monitors.forEach(monitor => {
|
||||
if (monitor == dtpPrimaryMonitor)
|
||||
return;
|
||||
|
||||
let panelBox = new St.BoxLayout({ name: 'panelBox' });
|
||||
Main.layoutManager.addChrome(panelBox, { affectsStruts: true, trackFullscreen: true });
|
||||
|
||||
let panel = new Panel.dtpSecondaryPanel(Me.settings, monitor);
|
||||
panelBox.add(panel.actor);
|
||||
|
||||
let panelWrapper = new Panel.dtpPanelWrapper(this, monitor, panel, panelBox, true);
|
||||
panel.delegate = panelWrapper;
|
||||
panelWrapper.enable();
|
||||
|
||||
this.allPanels.push(panelWrapper);
|
||||
Main.layoutManager.monitors.filter(m => m != dtpPrimaryMonitor).forEach(m => {
|
||||
this.allPanels.push(this._createPanel(m, true));
|
||||
});
|
||||
}
|
||||
|
||||
@@ -154,9 +141,6 @@ var dtpPanelManager = Utils.defineClass({
|
||||
|
||||
this._oldGetShowAppsButton = Main.overview.getShowAppsButton;
|
||||
Main.overview.getShowAppsButton = this._newGetShowAppsButton.bind(this);
|
||||
|
||||
LookingGlass.LookingGlass.prototype._oldResize = LookingGlass.LookingGlass.prototype._resize;
|
||||
LookingGlass.LookingGlass.prototype._resize = _newLookingGlassResize;
|
||||
|
||||
this._needsDashItemContainerAllocate = !Dash.DashItemContainer.prototype.hasOwnProperty('vfunc_allocate');
|
||||
|
||||
@@ -255,13 +239,7 @@ var dtpPanelManager = Utils.defineClass({
|
||||
Main.overview.viewSelector._workspacesDisplay._updateWorkspacesViews = this._oldUpdateWorkspacesViews;
|
||||
Main.overview.getShowAppsButton = this._oldGetShowAppsButton;
|
||||
|
||||
LookingGlass.LookingGlass.prototype._resize = LookingGlass.LookingGlass.prototype._oldResize;
|
||||
delete LookingGlass.LookingGlass.prototype._oldResize;
|
||||
|
||||
if (Main.layoutManager.primaryMonitor) {
|
||||
Main.layoutManager.panelBox.set_position(Main.layoutManager.primaryMonitor.x, Main.layoutManager.primaryMonitor.y);
|
||||
Main.layoutManager.panelBox.set_size(Main.layoutManager.primaryMonitor.width, -1);
|
||||
}
|
||||
Main.panel.actor.show();
|
||||
|
||||
if (this._needsDashItemContainerAllocate) {
|
||||
Utils.hookVfunc(Dash.DashItemContainer.prototype, 'allocate', function(box, flags) { this.vfunc_allocate(box, flags); });
|
||||
@@ -285,6 +263,17 @@ var dtpPanelManager = Utils.defineClass({
|
||||
return Main.overview.viewSelector._workspacesDisplay._primaryIndex == monitor.index;
|
||||
},
|
||||
|
||||
_createPanel: function(monitor, isSecondary) {
|
||||
let panelBox = new St.BoxLayout({ name: 'panelBox' });
|
||||
let panel = new Panel.dtpPanel(this, monitor, panelBox, isSecondary);
|
||||
|
||||
panelBox.add(panel);
|
||||
Main.layoutManager.addChrome(panelBox, { affectsStruts: true, trackFullscreen: true });
|
||||
panel.enable();
|
||||
|
||||
return panel;
|
||||
},
|
||||
|
||||
_reset: function() {
|
||||
this.disable(true);
|
||||
this.enable(true);
|
||||
@@ -562,8 +551,12 @@ function newSetBarrierSize(size) {
|
||||
}
|
||||
|
||||
function newUpdatePanelBarrier(panel) {
|
||||
if (this._rightPanelBarrier) {
|
||||
this._rightPanelBarrier.destroy();
|
||||
}
|
||||
|
||||
let barriers = {
|
||||
_rightPanelBarrier: [(panel.isSecondary ? panel : this)],
|
||||
_rightPanelBarrier: [panel],
|
||||
_leftPanelBarrier: [panel]
|
||||
};
|
||||
|
||||
@@ -631,16 +624,4 @@ function newUpdatePanelBarrier(panel) {
|
||||
|
||||
barriers[k][0][k] = new Meta.Barrier(barrierOptions);
|
||||
});
|
||||
}
|
||||
|
||||
function _newLookingGlassResize() {
|
||||
this._oldResize();
|
||||
|
||||
if (Panel.checkIfVertical()) {
|
||||
this._hiddenY = Main.layoutManager.primaryMonitor.y + 40 - this.actor.height;
|
||||
this._targetY = this._hiddenY + this.actor.height;
|
||||
this.actor.y = this._hiddenY;
|
||||
|
||||
this._objInspector.actor.set_position(this.actor.x + Math.floor(this.actor.width * 0.1), this._targetY + Math.floor(this.actor.height * 0.1));
|
||||
}
|
||||
}
|
||||
@@ -96,11 +96,7 @@
|
||||
}
|
||||
|
||||
.showdesktop-button {
|
||||
width: 4px;
|
||||
border: 1px solid rgba(200, 200, 200, .2);
|
||||
border-top-width: 0;
|
||||
border-right-width: 0;
|
||||
border-bottom-width: 0;
|
||||
border: 0 solid rgba(200, 200, 200, .2);
|
||||
}
|
||||
|
||||
.showdesktop-button-hovered {
|
||||
|
||||
40
taskbar.js
40
taskbar.js
@@ -108,10 +108,10 @@ var taskbarActor = Utils.defineClass({
|
||||
hupper = Math.floor(hupper);
|
||||
scrollview._dtpFadeSize = hupper > hpageSize ? this._delegate.iconSize : 0;
|
||||
|
||||
if (this._delegate.panelWrapper.dynamicTransparency &&
|
||||
this._currentBackgroundColor !== this._delegate.panelWrapper.dynamicTransparency.currentBackgroundColor) {
|
||||
this._currentBackgroundColor = this._delegate.panelWrapper.dynamicTransparency.currentBackgroundColor;
|
||||
let gradientStyle = 'background-gradient-start: ' + this._currentBackgroundColor + ';' +
|
||||
if (this._delegate.panel.dynamicTransparency &&
|
||||
this._currentBackgroundColor !== this._delegate.panel.dynamicTransparency.currentBackgroundColor) {
|
||||
this._currentBackgroundColor = this._delegate.panel.dynamicTransparency.currentBackgroundColor;
|
||||
let gradientStyle = 'background-gradient-start: ' + this._currentBackgroundColor +
|
||||
'background-gradient-direction: ' + orientation;
|
||||
|
||||
leftFade.set_style(gradientStyle);
|
||||
@@ -160,8 +160,8 @@ var taskbarActor = Utils.defineClass({
|
||||
var taskbar = Utils.defineClass({
|
||||
Name: 'DashToPanel.Taskbar',
|
||||
|
||||
_init : function(panelWrapper) {
|
||||
this.panelWrapper = panelWrapper;
|
||||
_init : function(panel) {
|
||||
this.panel = panel;
|
||||
|
||||
// start at smallest size due to running indicator drawing area expanding but not shrinking
|
||||
this.iconSize = 16;
|
||||
@@ -201,7 +201,7 @@ var taskbar = Utils.defineClass({
|
||||
this.showAppsButton = this._showAppsIcon.toggleButton;
|
||||
|
||||
if (isVertical) {
|
||||
this.showAppsButton.set_width(panelWrapper.geom.w);
|
||||
this.showAppsButton.set_width(panel.geom.w);
|
||||
}
|
||||
|
||||
this.showAppsButton.connect('notify::checked', Lang.bind(this, this._onShowAppsButtonToggled));
|
||||
@@ -229,7 +229,7 @@ var taskbar = Utils.defineClass({
|
||||
this._container.add_actor(fade1);
|
||||
this._container.add_actor(fade2);
|
||||
|
||||
this.previewMenu = new WindowPreview.PreviewMenu(panelWrapper);
|
||||
this.previewMenu = new WindowPreview.PreviewMenu(panel);
|
||||
this.previewMenu.enable();
|
||||
|
||||
if (!Me.settings.get_boolean('show-show-apps-button'))
|
||||
@@ -254,12 +254,12 @@ var taskbar = Utils.defineClass({
|
||||
|
||||
this._signalsHandler.add(
|
||||
[
|
||||
this.panelWrapper.panel.actor,
|
||||
this.panel,
|
||||
'notify::height',
|
||||
() => this._queueRedisplay()
|
||||
],
|
||||
[
|
||||
this.panelWrapper.panel.actor,
|
||||
this.panel,
|
||||
'notify::width',
|
||||
() => this._queueRedisplay()
|
||||
],
|
||||
@@ -539,7 +539,7 @@ var taskbar = Utils.defineClass({
|
||||
window: window,
|
||||
isLauncher: isLauncher
|
||||
},
|
||||
this.panelWrapper,
|
||||
this.panel,
|
||||
{
|
||||
setSizeManually: true,
|
||||
showLabel: false,
|
||||
@@ -745,8 +745,8 @@ var taskbar = Utils.defineClass({
|
||||
},
|
||||
|
||||
sortAppsCompareFunction: function(appA, appB) {
|
||||
return getAppStableSequence(appA, this.panelWrapper.monitor) -
|
||||
getAppStableSequence(appB, this.panelWrapper.monitor);
|
||||
return getAppStableSequence(appA, this.panel.monitor) -
|
||||
getAppStableSequence(appB, this.panel.monitor);
|
||||
},
|
||||
|
||||
getAppInfos: function() {
|
||||
@@ -834,7 +834,7 @@ var taskbar = Utils.defineClass({
|
||||
this._updateAppIcons();
|
||||
|
||||
// This will update the size, and the corresponding number for each icon on the primary panel
|
||||
if (!this.panelWrapper.isSecondary) {
|
||||
if (!this.panel.isSecondary) {
|
||||
this._updateNumberOverlay();
|
||||
}
|
||||
|
||||
@@ -847,7 +847,7 @@ var taskbar = Utils.defineClass({
|
||||
|
||||
_checkIfShowingFavorites: function() {
|
||||
return Me.settings.get_boolean('show-favorites') &&
|
||||
(!this.panelWrapper.isSecondary || Me.settings.get_boolean('show-favorites-all-monitors'));
|
||||
(!this.panel.isSecondary || Me.settings.get_boolean('show-favorites-all-monitors'));
|
||||
},
|
||||
|
||||
_getRunningApps: function() {
|
||||
@@ -870,7 +870,7 @@ var taskbar = Utils.defineClass({
|
||||
return apps.map(app => ({
|
||||
app: app,
|
||||
isLauncher: defaultIsLauncher || false,
|
||||
windows: defaultWindows || AppIcons.getInterestingWindows(app, this.panelWrapper.monitor)
|
||||
windows: defaultWindows || AppIcons.getInterestingWindows(app, this.panel.monitor)
|
||||
.sort(sortWindowsCompareFunction)
|
||||
}));
|
||||
},
|
||||
@@ -889,7 +889,7 @@ var taskbar = Utils.defineClass({
|
||||
this._redisplay();
|
||||
|
||||
if (Panel.checkIfVertical()) {
|
||||
this.showAppsButton.set_width(this.panelWrapper.geom.w);
|
||||
this.showAppsButton.set_width(this.panel.geom.w);
|
||||
this.previewMenu._updateClip();
|
||||
}
|
||||
},
|
||||
@@ -1015,7 +1015,7 @@ var taskbar = Utils.defineClass({
|
||||
let interestingWindows = {};
|
||||
let getAppWindows = app => {
|
||||
if (!interestingWindows[app]) {
|
||||
interestingWindows[app] = AppIcons.getInterestingWindows(app, this.panelWrapper.monitor);
|
||||
interestingWindows[app] = AppIcons.getInterestingWindows(app, this.panel.monitor);
|
||||
}
|
||||
|
||||
let appWindows = interestingWindows[app]; //prevents "reference to undefined property Symbol.toPrimitive" warning
|
||||
@@ -1121,12 +1121,12 @@ var taskbar = Utils.defineClass({
|
||||
}
|
||||
|
||||
//temporarily use as primary the monitor on which the showapps btn was clicked
|
||||
this.panelWrapper.panelManager.setFocusedMonitor(this.panelWrapper.monitor);
|
||||
this.panel.panelManager.setFocusedMonitor(this.panel.monitor);
|
||||
|
||||
//reset the primary monitor when exiting the overview
|
||||
let overviewHiddenId = Main.overview.connect('hidden', () => {
|
||||
Main.overview.disconnect(overviewHiddenId);
|
||||
this.panelWrapper.panelManager.setFocusedMonitor(this.panelWrapper.panelManager.primaryPanel.monitor, true);
|
||||
this.panel.panelManager.setFocusedMonitor(this.panel.panelManager.primaryPanel.monitor, true);
|
||||
});
|
||||
|
||||
// Finally show the overview
|
||||
|
||||
@@ -23,6 +23,7 @@ const Meta = imports.gi.Meta;
|
||||
const St = imports.gi.St;
|
||||
|
||||
const Me = imports.misc.extensionUtils.getCurrentExtension();
|
||||
const Panel = Me.imports.panel;
|
||||
const Proximity = Me.imports.proximity;
|
||||
const Utils = Me.imports.utils;
|
||||
|
||||
@@ -36,8 +37,8 @@ var DynamicTransparency = Utils.defineClass({
|
||||
this._windowOverlap = false;
|
||||
this.currentBackgroundColor = 0;
|
||||
|
||||
this._initialPanelStyle = dtpPanel.panel.actor.get_style();
|
||||
this._initialPanelCornerStyle = dtpPanel.panel._leftCorner.actor.get_style();
|
||||
this._initialPanelStyle = dtpPanel.get_style();
|
||||
this._initialPanelCornerStyle = dtpPanel._leftCorner.actor.get_style();
|
||||
|
||||
this._signalsHandler = new Utils.GlobalSignalsHandler();
|
||||
this._bindSignals();
|
||||
@@ -51,9 +52,9 @@ var DynamicTransparency = Utils.defineClass({
|
||||
this._signalsHandler.destroy();
|
||||
this._proximityManager.removeWatch(this._proximityWatchId);
|
||||
|
||||
this._dtpPanel.panel.actor.set_style(this._initialPanelStyle);
|
||||
this._dtpPanel.panel._leftCorner.actor.set_style(this._initialPanelCornerStyle);
|
||||
this._dtpPanel.panel._rightCorner.actor.set_style(this._initialPanelCornerStyle);
|
||||
this._dtpPanel.set_style(this._initialPanelStyle);
|
||||
this._dtpPanel._leftCorner.actor.set_style(this._initialPanelCornerStyle);
|
||||
this._dtpPanel._rightCorner.actor.set_style(this._initialPanelCornerStyle);
|
||||
},
|
||||
|
||||
_bindSignals: function() {
|
||||
@@ -165,7 +166,7 @@ var DynamicTransparency = Utils.defineClass({
|
||||
},
|
||||
|
||||
_updateComplementaryStyles: function() {
|
||||
let panelThemeNode = this._dtpPanel.panel.actor.get_theme_node();
|
||||
let panelThemeNode = this._dtpPanel.get_theme_node();
|
||||
|
||||
this._complementaryStyles = 'border-radius: ' + panelThemeNode.get_border_radius(0) + 'px;';
|
||||
},
|
||||
@@ -190,7 +191,7 @@ var DynamicTransparency = Utils.defineClass({
|
||||
this._gradientStyle = '';
|
||||
|
||||
if (Me.settings.get_boolean('trans-use-custom-gradient')) {
|
||||
this._gradientStyle += 'background-gradient-direction: vertical; ' +
|
||||
this._gradientStyle += 'background-gradient-direction: ' + (Panel.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'),
|
||||
@@ -205,12 +206,12 @@ var DynamicTransparency = Utils.defineClass({
|
||||
let cornerStyle = '-panel-corner-background-color: ' + this.currentBackgroundColor + transition;
|
||||
|
||||
this._dtpPanel.panelBg.set_style('background-color: ' + this.currentBackgroundColor + transition + this._complementaryStyles);
|
||||
this._dtpPanel.panel._leftCorner.actor.set_style(cornerStyle);
|
||||
this._dtpPanel.panel._rightCorner.actor.set_style(cornerStyle);
|
||||
this._dtpPanel._leftCorner.actor.set_style(cornerStyle);
|
||||
this._dtpPanel._rightCorner.actor.set_style(cornerStyle);
|
||||
},
|
||||
|
||||
_setGradient: function() {
|
||||
this._dtpPanel.panel.actor.set_style(
|
||||
this._dtpPanel.set_style(
|
||||
'background: none; ' +
|
||||
'border-image: none; ' +
|
||||
'background-image: none; ' +
|
||||
|
||||
@@ -65,11 +65,11 @@ var PreviewMenu = Utils.defineClass({
|
||||
Extends: St.Widget,
|
||||
Signals: { 'open-state-changed': {} },
|
||||
|
||||
_init: function(panelWrapper) {
|
||||
_init: function(panel) {
|
||||
this.callParent('_init', { layout_manager: new Clutter.BinLayout() });
|
||||
|
||||
let geom = panelWrapper.geom;
|
||||
this._panelWrapper = panelWrapper;
|
||||
let geom = panel.geom;
|
||||
this.panel = panel;
|
||||
this.currentAppIcon = null;
|
||||
this._focusedPreview = null;
|
||||
this._peekedWindow = null;
|
||||
@@ -128,7 +128,7 @@ var PreviewMenu = Utils.defineClass({
|
||||
this._onScrollEvent.bind(this)
|
||||
],
|
||||
[
|
||||
this._panelWrapper.panelBox,
|
||||
this.panel.panelBox,
|
||||
'style-changed',
|
||||
() => this._updateClip()
|
||||
],
|
||||
@@ -174,7 +174,7 @@ var PreviewMenu = Utils.defineClass({
|
||||
|
||||
if (!this.opened) {
|
||||
this._refreshGlobals();
|
||||
this.menu.set_style('background: ' + Utils.getrgbaColor(this._panelWrapper.dynamicTransparency.backgroundColorRgb, alphaBg));
|
||||
this.menu.set_style('background: ' + Utils.getrgbaColor(this.panel.dynamicTransparency.backgroundColorRgb, alphaBg));
|
||||
|
||||
this.show();
|
||||
}
|
||||
@@ -398,10 +398,10 @@ var PreviewMenu = Utils.defineClass({
|
||||
fixed: Me.settings.get_boolean('window-preview-fixed-y')
|
||||
};
|
||||
|
||||
if (this._panelWrapper.dynamicTransparency) {
|
||||
if (this.panel.dynamicTransparency) {
|
||||
alphaBg = Me.settings.get_boolean('preview-use-custom-opacity') ?
|
||||
Me.settings.get_int('preview-custom-opacity') * .01 :
|
||||
this._panelWrapper.dynamicTransparency.alpha;
|
||||
this.panel.dynamicTransparency.alpha;
|
||||
}
|
||||
},
|
||||
|
||||
@@ -415,29 +415,29 @@ var PreviewMenu = Utils.defineClass({
|
||||
|
||||
_updateClip: function() {
|
||||
let x, y, w, h;
|
||||
let geom = this._panelWrapper.geom;
|
||||
let panelBoxTheme = this._panelWrapper.panelBox.get_theme_node();
|
||||
let geom = this.panel.geom;
|
||||
let panelBoxTheme = this.panel.panelBox.get_theme_node();
|
||||
let previewSize = (Me.settings.get_int('window-preview-size') +
|
||||
Me.settings.get_int('window-preview-padding') * 2) * scaleFactor;
|
||||
|
||||
if (this.isVertical) {
|
||||
w = previewSize;
|
||||
h = this._panelWrapper.monitor.height;
|
||||
y = this._panelWrapper.monitor.y;
|
||||
h = this.panel.monitor.height;
|
||||
y = this.panel.monitor.y;
|
||||
} else {
|
||||
w = this._panelWrapper.monitor.width;
|
||||
w = this.panel.monitor.width;
|
||||
h = (previewSize + headerHeight);
|
||||
x = this._panelWrapper.monitor.x;
|
||||
x = this.panel.monitor.x;
|
||||
}
|
||||
|
||||
if (geom.position == St.Side.LEFT) {
|
||||
x = this._panelWrapper.monitor.x + Panel.size + panelBoxTheme.get_padding(St.Side.LEFT);
|
||||
x = this.panel.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 - (Panel.size + previewSize) - panelBoxTheme.get_padding(St.Side.RIGHT);
|
||||
x = this.panel.monitor.x + this.panel.monitor.width - (Panel.size + previewSize) - panelBoxTheme.get_padding(St.Side.RIGHT);
|
||||
} else if (geom.position == St.Side.TOP) {
|
||||
y = this._panelWrapper.monitor.y + Panel.size + panelBoxTheme.get_padding(St.Side.TOP);
|
||||
y = this.panel.monitor.y + Panel.size + panelBoxTheme.get_padding(St.Side.TOP);
|
||||
} else { //St.Side.BOTTOM
|
||||
y = this._panelWrapper.monitor.y + this._panelWrapper.monitor.height - (Panel.size + panelBoxTheme.get_padding(St.Side.BOTTOM) + previewSize + headerHeight);
|
||||
y = this.panel.monitor.y + this.panel.monitor.height - (Panel.size + panelBoxTheme.get_padding(St.Side.BOTTOM) + previewSize + headerHeight);
|
||||
}
|
||||
|
||||
Utils.setClip(this, x, y, w, h);
|
||||
@@ -451,18 +451,18 @@ var PreviewMenu = Utils.defineClass({
|
||||
let appIconMargin = Me.settings.get_int('appicon-margin') / scaleFactor;
|
||||
let x = 0, y = 0;
|
||||
|
||||
previewsWidth = Math.min(previewsWidth, this._panelWrapper.monitor.width);
|
||||
previewsHeight = Math.min(previewsHeight, this._panelWrapper.monitor.height);
|
||||
this._updateScrollFade(previewsWidth < this._panelWrapper.monitor.width && previewsHeight < this._panelWrapper.monitor.height);
|
||||
previewsWidth = Math.min(previewsWidth, this.panel.monitor.width);
|
||||
previewsHeight = Math.min(previewsHeight, this.panel.monitor.height);
|
||||
this._updateScrollFade(previewsWidth < this.panel.monitor.width && previewsHeight < this.panel.monitor.height);
|
||||
|
||||
if (this.isVertical) {
|
||||
y = sourceAllocation.y1 + appIconMargin - this._panelWrapper.monitor.y + (sourceContentBox.y2 - sourceContentBox.y1 - previewsHeight) * .5;
|
||||
y = sourceAllocation.y1 + appIconMargin - this.panel.monitor.y + (sourceContentBox.y2 - sourceContentBox.y1 - previewsHeight) * .5;
|
||||
y = Math.max(y, 0);
|
||||
y = Math.min(y, this._panelWrapper.monitor.height - previewsHeight);
|
||||
y = Math.min(y, this.panel.monitor.height - previewsHeight);
|
||||
} else {
|
||||
x = sourceAllocation.x1 + appIconMargin - this._panelWrapper.monitor.x + (sourceContentBox.x2 - sourceContentBox.x1 - previewsWidth) * .5;
|
||||
x = sourceAllocation.x1 + appIconMargin - this.panel.monitor.x + (sourceContentBox.x2 - sourceContentBox.x1 - previewsWidth) * .5;
|
||||
x = Math.max(x, 0);
|
||||
x = Math.min(x, this._panelWrapper.monitor.width - previewsWidth);
|
||||
x = Math.min(x, this.panel.monitor.width - previewsWidth);
|
||||
}
|
||||
|
||||
if (!this.opened) {
|
||||
@@ -501,32 +501,27 @@ var PreviewMenu = Utils.defineClass({
|
||||
},
|
||||
|
||||
_getFadeWidget: function(end) {
|
||||
let rotation = 0;
|
||||
let size = 0;
|
||||
let x = 0, y = 0;
|
||||
let startBg = Utils.getrgbaColor(this._panelWrapper.dynamicTransparency.backgroundColorRgb, Math.min(alphaBg + .1, 1));
|
||||
let endBg = Utils.getrgbaColor(this._panelWrapper.dynamicTransparency.backgroundColorRgb, 0)
|
||||
let startBg = Utils.getrgbaColor(this.panel.dynamicTransparency.backgroundColorRgb, Math.min(alphaBg + .1, 1));
|
||||
let endBg = Utils.getrgbaColor(this.panel.dynamicTransparency.backgroundColorRgb, 0)
|
||||
let fadeStyle = 'background-gradient-start:' + startBg +
|
||||
'background-gradient-end:' + endBg +
|
||||
'background-gradient-direction:' + Panel.getOrientation();
|
||||
|
||||
if (this.isVertical) {
|
||||
rotation = end ? 270 : 90;
|
||||
y = end ? this._panelWrapper.monitor.height - FADE_SIZE : 0;
|
||||
size = this.width;
|
||||
y = end ? this.panel.monitor.height - FADE_SIZE : 0;
|
||||
} else {
|
||||
rotation = end ? 180 : 0;
|
||||
x = end ? this._panelWrapper.monitor.width - FADE_SIZE : 0;
|
||||
size = this.height;
|
||||
x = end ? this.panel.monitor.width - FADE_SIZE : 0;
|
||||
}
|
||||
|
||||
let fadeWidget = new St.Widget({
|
||||
reactive: false,
|
||||
pivot_point: new Clutter.Point({ x: .5, y: .5 }),
|
||||
rotation_angle_z: rotation,
|
||||
rotation_angle_z: end ? 180 : 0,
|
||||
style: fadeStyle,
|
||||
x: x, y: y,
|
||||
width: FADE_SIZE, height: size
|
||||
width: this.isVertical ? this.width : FADE_SIZE,
|
||||
height: this.isVertical ? FADE_SIZE : this.height
|
||||
});
|
||||
|
||||
return fadeWidget;
|
||||
@@ -677,7 +672,6 @@ var Preview = Utils.defineClass({
|
||||
this.window = null;
|
||||
this._needsCloseButton = true;
|
||||
this.cloneWidth = this.cloneHeight = 0;
|
||||
this._panelWrapper = previewMenu._panelWrapper;
|
||||
this._previewMenu = previewMenu;
|
||||
this._padding = Me.settings.get_int('window-preview-padding') * scaleFactor;
|
||||
this._previewDimensions = this._getPreviewDimensions();
|
||||
@@ -948,7 +942,7 @@ var Preview = Utils.defineClass({
|
||||
|
||||
_getBackgroundColor: function(offset, alpha) {
|
||||
return 'background-color: ' + this._getRgbaColor(offset, alpha) +
|
||||
'transition-duration:' + this._panelWrapper.dynamicTransparency.animationDuration;
|
||||
'transition-duration:' + this._previewMenu.panel.dynamicTransparency.animationDuration;
|
||||
},
|
||||
|
||||
_getRgbaColor: function(offset, alpha) {
|
||||
@@ -958,7 +952,7 @@ var Preview = Utils.defineClass({
|
||||
alpha = alphaBg;
|
||||
}
|
||||
|
||||
return Utils.getrgbaColor(this._panelWrapper.dynamicTransparency.backgroundColorRgb, alpha, offset);
|
||||
return Utils.getrgbaColor(this._previewMenu.panel.dynamicTransparency.backgroundColorRgb, alpha, offset);
|
||||
},
|
||||
|
||||
_addClone: function(newCloneBin, animateSize) {
|
||||
|
||||
Reference in New Issue
Block a user