Code:
214,215c214,215
< function WindowList() {
< this._init();
---
> function WindowList(mon) {
> this._init(mon);
219c219,221
< _init: function() {
---
> _monitor : 0,
>
> _init: function(mon) {
223a226
> this._monitor = mon;
243a247,248
> global.screen.connect('window-entered-monitor', Lang.bind(this, this._windowEnteredMonitor));
>
244a250,271
>
> },
>
> _windowEnteredMonitor: function(metaScreen, monitorIndex, metaWindow) {
> // if window entered THIS monitor and isn't already present, add it. Otherwise
> // if present, remove it.
> if (monitorIndex==this._monitor){
> let present=false;
> for ( let i = 0; i < this._windows.length; ++i ) {
> if (this._windows[i].metaWindow == metaWindow) present=true;
> }
> if (!present) this._addListItem(metaWindow);
> } else {
> for ( let i = 0; i < this._windows.length; ++i ) {
> if (this._windows[i].metaWindow == metaWindow){
> this.actor.remove_actor(this._windows[i].actor);
> this._windows[i].actor.destroy();
> this._windows.splice(i, 1);
> }
> }
> }
> this._onFocus();
257c284
< if ( app ) {
---
> if ( app && metaWindow.get_monitor() == this._monitor && metaWindow.title!='gkrellm'){ // metaWindow should be on THIS monitor
259c286
< this._windows.push(item);
---
> this._windows.push(item);
261,264c288
< item.actor.connect('notify::hover',
< Lang.bind(this, function() {
< this._onHover(item);
< }));
---
> item.actor.connect('notify::hover', Lang.bind(this, function() { this._onHover(item); }));
433c457
< bottomPanel.workspaceSwitcher._createButtons();
---
> bottomPanel[0].workspaceSwitcher._createButtons();
756,757c780,781
< function BottomPanel() {
< this._init();
---
> function BottomPanel(mon) {
> this._init(mon);
761c785,787
< _init : function() {
---
> _monitor : 0,
>
> _init : function(mon) {
765a792
> this._monitor=mon;
767c794
< let windowList = new WindowList();
---
> let windowList = new WindowList(this._monitor);
770,774c797,804
< this.workspaceSwitcher = new WorkspaceSwitcher();
< this.actor.add(this.workspaceSwitcher.actor);
<
< this.messageButton = new MessageButton();
< this.actor.add(this.messageButton.actor);
---
> // only add workspace switcher and message button to primary monitor.
> if (Main.layoutManager.monitors[this._monitor] == Main.layoutManager.primaryMonitor){
> this.workspaceSwitcher = new WorkspaceSwitcher();
> this.actor.add(this.workspaceSwitcher.actor);
>
> this.messageButton = new MessageButton();
> this.actor.add(this.messageButton.actor);
> }
779,780c809,810
< global.screen.connect('monitors-changed', Lang.bind(this,
< this.relayout));
---
> //global.screen.connect('monitors-changed', Lang.bind(this, this.relayout));
> this.relayout();
784c814
< let primary = Main.layoutManager.primaryMonitor;
---
> let monitor = Main.layoutManager.monitors[this._monitor];
786,788c816,818
< let h = this.actor.get_theme_node().get_height();
< this.actor.set_position(primary.x, primary.y+primary.height-h);
< this.actor.set_size(primary.width, -1);
---
> let h = this.actor.get_theme_node().get_height();
> this.actor.set_position(monitor.x, monitor.y+monitor.height-h);
> this.actor.set_size(monitor.width, -1);
812c842
< availHeight -= bottomPanel.actor.height;
---
> availHeight -= bottomPanel[0].actor.height;
934c964
< let h = bottomPanel.actor.get_theme_node().get_height();
---
> let h = bottomPanel[0].actor.get_theme_node().get_height();
1072c1102
< let bottomPanel = null;
---
> let bottomPanel = new Array();
1092,1093c1122,1148
< bottomPanel = new BottomPanel();
< bottomPanel.relayout();
---
> global.screen.connect('monitors-changed', Lang.bind(this, this.relayout));
>
> for (let i=0; i<Main.layoutManager.monitors.length; i++)
> bottomPanel[i] = new BottomPanel(i);
> }
>
> // if a monitor is removed or added, remove all bottomPanels and create new for
> // current list of monitors.
> function relayout() {
> for (let i=0; i<bottomPanel.length; i++){
> if ( bottomPanel[i] ) {
> if ( bottomPanel[i].messageButton.actorAddedId ) {
> Main.messageTray._summary.disconnect(
> bottomPanel[i].messageButton.actorAddedId);
> }
> if ( bottomPanel[i].messageButton.actorRemovedId ) {
> Main.messageTray._summary.disconnect(
> bottomPanel[i].messageButton.actorRemovedId);
> }
> Main.layoutManager.removeChrome(bottomPanel[i].actor);
> bottomPanel[i] = null;
> }
> }
> bottomPanel = new Array();
> for (let i=0; i<Main.layoutManager.monitors.length; i++)
> bottomPanel[i] = new BottomPanel(i);
>
1116,1123c1171,1182
< if ( bottomPanel ) {
< if ( bottomPanel.messageButton.actorAddedId ) {
< Main.messageTray._summary.disconnect(
< bottomPanel.messageButton.actorAddedId);
< }
< if ( bottomPanel.messageButton.actorRemovedId ) {
< Main.messageTray._summary.disconnect(
< bottomPanel.messageButton.actorRemovedId);
---
> for (let i=0; i<bottomPanel.length; i++){
> if ( bottomPanel[i] ) {
> if ( bottomPanel[i].messageButton.actorAddedId ) {
> Main.messageTray._summary.disconnect(
> bottomPanel[i].messageButton.actorAddedId);
> }
> if ( bottomPanel[i].messageButton.actorRemovedId ) {
> Main.messageTray._summary.disconnect(
> bottomPanel[i].messageButton.actorRemovedId);
> }
> Main.layoutManager.removeChrome(bottomPanel[i].actor);
> bottomPanel[i] = null;
1125,1126d1183
< Main.layoutManager.removeChrome(bottomPanel.actor);
< bottomPanel = null;
This patch I wrote makes bottom panel work on multiple-monitor desktops.