mirror of
https://github.com/BreizhHardware/multi-monitors-add-on.git
synced 2026-01-18 16:47:26 +01:00
Use method syntax and Function.prototype.bind.
This commit is contained in:
@@ -44,7 +44,7 @@ const SHOW_THUMBNAILS_SLIDER_ID = 'show-thumbnails-slider';
|
||||
const MultiMonitorsAddOn = new Lang.Class({
|
||||
Name: 'MultiMonitorsAddOn',
|
||||
|
||||
_init: function() {
|
||||
_init() {
|
||||
this._settings = Convenience.getSettings();
|
||||
this._ov_settings = new Gio.Settings({ schema: OVERRIDE_SCHEMA });
|
||||
this._mu_settings = new Gio.Settings({ schema: MUTTER_SCHEMA });
|
||||
@@ -58,7 +58,7 @@ const MultiMonitorsAddOn = new Lang.Class({
|
||||
this._mmMonitors = 0;
|
||||
},
|
||||
|
||||
_showIndicator: function() {
|
||||
_showIndicator() {
|
||||
if(this._settings.get_boolean(SHOW_INDICATOR_ID)) {
|
||||
if(!this.mmIndicator) {
|
||||
this.mmIndicator = Main.panel.addToStatusArea('MultiMonitorsAddOn', new MMIndicator.MultiMonitorsIndicator());
|
||||
@@ -69,14 +69,14 @@ const MultiMonitorsAddOn = new Lang.Class({
|
||||
}
|
||||
},
|
||||
|
||||
_hideIndicator: function() {
|
||||
_hideIndicator() {
|
||||
if(this.mmIndicator) {
|
||||
this.mmIndicator.destroy();
|
||||
this.mmIndicator = null;
|
||||
}
|
||||
},
|
||||
|
||||
_showThumbnailsSlider: function() {
|
||||
_showThumbnailsSlider() {
|
||||
if(this._settings.get_boolean(SHOW_THUMBNAILS_SLIDER_ID)){
|
||||
|
||||
if(this._ov_settings.get_boolean(WORKSPACES_ONLY_ON_PRIMARY_ID))
|
||||
@@ -122,7 +122,7 @@ const MultiMonitorsAddOn = new Lang.Class({
|
||||
}
|
||||
},
|
||||
|
||||
_hideThumbnailsSlider: function() {
|
||||
_hideThumbnailsSlider() {
|
||||
if (Main.mmOverview) {
|
||||
|
||||
if (!Main.overview.visible) {
|
||||
@@ -148,7 +148,7 @@ const MultiMonitorsAddOn = new Lang.Class({
|
||||
}
|
||||
},
|
||||
|
||||
_relayout: function() {
|
||||
_relayout() {
|
||||
// global.log(".....................................................................")
|
||||
if(this._mmMonitors!=Main.layoutManager.monitors.length){
|
||||
this._mmMonitors = Main.layoutManager.monitors.length;
|
||||
@@ -162,14 +162,14 @@ const MultiMonitorsAddOn = new Lang.Class({
|
||||
}
|
||||
},
|
||||
|
||||
_switchOffThumbnails: function() {
|
||||
_switchOffThumbnails() {
|
||||
if(this._ov_settings.get_boolean(WORKSPACES_ONLY_ON_PRIMARY_ID))
|
||||
this._settings.set_boolean(SHOW_THUMBNAILS_SLIDER_ID, false);
|
||||
if(this._mu_settings.get_boolean(WORKSPACES_ONLY_ON_PRIMARY_ID))
|
||||
this._settings.set_boolean(SHOW_THUMBNAILS_SLIDER_ID, false);
|
||||
},
|
||||
|
||||
enable: function(version) {
|
||||
enable(version) {
|
||||
global.log("Enable Multi Monitors Add-On ("+version+")...")
|
||||
|
||||
if(Main.panel.statusArea.MultiMonitorsAddOn)
|
||||
@@ -194,7 +194,7 @@ const MultiMonitorsAddOn = new Lang.Class({
|
||||
this._relayout();
|
||||
},
|
||||
|
||||
disable: function() {
|
||||
disable() {
|
||||
Main.layoutManager.disconnect(this._relayoutId);
|
||||
this._ov_settings.disconnect(this._switchOffThumbnailsOvId);
|
||||
this._mu_settings.disconnect(this._switchOffThumbnailsMuId);
|
||||
|
||||
@@ -33,7 +33,7 @@ var MultiMonitorsIndicator = new Lang.Class({
|
||||
Name: 'MultiMonitorsIndicator',
|
||||
Extends: PanelMenu.Button,
|
||||
|
||||
_init: function() {
|
||||
_init() {
|
||||
this.parent(0.0, "MultiMonitorsAddOn", false);
|
||||
|
||||
Convenience.initTranslations();
|
||||
@@ -52,17 +52,17 @@ var MultiMonitorsIndicator = new Lang.Class({
|
||||
this._viewMonitors();
|
||||
},
|
||||
|
||||
_onDestroy: function(actor) {
|
||||
_onDestroy(actor) {
|
||||
Main.layoutManager.disconnect(this._viewMonitorsId);
|
||||
},
|
||||
|
||||
_syncIndicatorsVisible: function() {
|
||||
this._mmStatusIcon.visible = this._mmStatusIcon.get_children().some(function(actor) {
|
||||
_syncIndicatorsVisible() {
|
||||
this._mmStatusIcon.visible = this._mmStatusIcon.get_children().some((actor) => {
|
||||
return actor.visible;
|
||||
});
|
||||
},
|
||||
|
||||
_viewMonitors: function() {
|
||||
_viewMonitors() {
|
||||
let monitors = this._mmStatusIcon.get_children();
|
||||
|
||||
let monitorChange = Main.layoutManager.monitors.length - monitors.length;
|
||||
@@ -95,22 +95,22 @@ var MultiMonitorsIndicator = new Lang.Class({
|
||||
}
|
||||
},
|
||||
|
||||
_onPreferences: function()
|
||||
_onPreferences()
|
||||
{
|
||||
Util.spawn(["gnome-shell-extension-prefs", "multi-monitors-add-on@spin83"]);
|
||||
},
|
||||
|
||||
_onInit2ndMonitor: function()
|
||||
_onInit2ndMonitor()
|
||||
{
|
||||
Util.spawn(["intel-virtual-output"]);
|
||||
},
|
||||
|
||||
_hideHello: function() {
|
||||
_hideHello() {
|
||||
Main.uiGroup.remove_actor(this.text);
|
||||
this.text = null;
|
||||
},
|
||||
|
||||
_showHello: function() {
|
||||
_showHello() {
|
||||
if (!this.text) {
|
||||
this.text = new St.Label({ style_class: 'helloworld-label', text: _("Multi Monitors Add-On") });
|
||||
Main.uiGroup.add_actor(this.text);
|
||||
|
||||
@@ -44,7 +44,7 @@ const MultiMonitorsCalendar = new Lang.Class({
|
||||
Name: 'MultiMonitorsCalendar',
|
||||
Extends: Calendar.Calendar,
|
||||
|
||||
_init: function() {
|
||||
_init() {
|
||||
this._currentVersion = Config.PACKAGE_VERSION.split('.');
|
||||
this._weekStart = Shell.util_get_week_start();
|
||||
this._settings = new Gio.Settings({ schema_id: 'org.gnome.desktop.calendar' });
|
||||
@@ -89,7 +89,7 @@ const MultiMonitorsCalendar = new Lang.Class({
|
||||
this._buildHeader ();
|
||||
},
|
||||
|
||||
_onDestroy: function(actor) {
|
||||
_onDestroy(actor) {
|
||||
this._settings.disconnect(this._showWeekdateKeyId);
|
||||
}
|
||||
});
|
||||
@@ -98,7 +98,7 @@ const MultiMonitorsEventsSection = new Lang.Class({
|
||||
Name: 'MultiMonitorsEventsSection',
|
||||
Extends: MessageList.MessageListSection,
|
||||
|
||||
_init: function() {
|
||||
_init() {
|
||||
this._currentVersion = Config.PACKAGE_VERSION.split('.');
|
||||
this._desktopSettings = new Gio.Settings({ schema_id: 'org.gnome.desktop.interface' });
|
||||
this._reloadEventsId = this._desktopSettings.connect('changed', this._reloadEvents.bind(this));
|
||||
@@ -125,7 +125,7 @@ const MultiMonitorsEventsSection = new Lang.Class({
|
||||
this._appInstalledChanged();
|
||||
},
|
||||
|
||||
_onDestroy: function(actor) {
|
||||
_onDestroy(actor) {
|
||||
this._desktopSettings.disconnect(this._reloadEventsId);
|
||||
this._defaultAppSystem.disconnect(this._appInstalledChangedId);
|
||||
},
|
||||
@@ -151,7 +151,7 @@ const MultiMonitorsNotificationSection = new Lang.Class({
|
||||
Name: 'MultiMonitorsNotificationSection',
|
||||
Extends: MessageList.MessageListSection,
|
||||
|
||||
_init: function() {
|
||||
_init() {
|
||||
this._currentVersion = Config.PACKAGE_VERSION.split('.');
|
||||
|
||||
this.parent();
|
||||
@@ -159,15 +159,15 @@ const MultiMonitorsNotificationSection = new Lang.Class({
|
||||
this._nUrgent = 0;
|
||||
|
||||
this._sourceAddedId = Main.messageTray.connect('source-added', this._sourceAdded.bind(this));
|
||||
Main.messageTray.getSources().forEach(function(source) {
|
||||
Main.messageTray.getSources().forEach((source) => {
|
||||
this._sourceAdded(Main.messageTray, source);
|
||||
}.bind(this));
|
||||
});
|
||||
|
||||
this.actor.connect('notify::mapped', this._onMapped.bind(this));
|
||||
this.actor.connect('destroy', this._onDestroy.bind(this));
|
||||
},
|
||||
|
||||
_onDestroy: function(actor) {
|
||||
_onDestroy(actor) {
|
||||
Main.messageTray.disconnect(this._sourceAddedId);
|
||||
let source, obj;
|
||||
for ([source, obj] of this._sources.entries()) {
|
||||
@@ -191,7 +191,7 @@ const MultiMonitorsCalendarMessageList = new Lang.Class({
|
||||
Name: 'MultiMonitorsCalendarMessageList',
|
||||
Extends: Calendar.CalendarMessageList,
|
||||
|
||||
_init: function() {
|
||||
_init() {
|
||||
this._currentVersion = Config.PACKAGE_VERSION.split('.');
|
||||
|
||||
this.actor = new St.Widget({ style_class: 'message-list',
|
||||
@@ -244,12 +244,12 @@ const MultiMonitorsCalendarMessageList = new Lang.Class({
|
||||
this.actor.connect('destroy', this._onDestroy.bind(this));
|
||||
},
|
||||
|
||||
_onDestroy: function(actor) {
|
||||
_onDestroy(actor) {
|
||||
this._destroy = true;
|
||||
Main.sessionMode.disconnect(this._sessionModeUpdatedId);
|
||||
},
|
||||
|
||||
_sync: function() {
|
||||
_sync() {
|
||||
if (this._destroy) return;
|
||||
this.parent();
|
||||
}
|
||||
@@ -259,7 +259,7 @@ var MultiMonitorsDateMenuButton = new Lang.Class({
|
||||
Name: 'MultiMonitorsDateMenuButton',
|
||||
Extends: PanelMenu.Button,
|
||||
|
||||
_init: function() {
|
||||
_init() {
|
||||
this._currentVersion = Config.PACKAGE_VERSION.split('.');
|
||||
let hbox;
|
||||
let vbox;
|
||||
@@ -295,12 +295,12 @@ var MultiMonitorsDateMenuButton = new Lang.Class({
|
||||
bin.add_actor(hbox);
|
||||
this._calendar = new MultiMonitorsCalendar();
|
||||
this._calendar.connect('selected-date-changed',
|
||||
function(calendar, date) {
|
||||
(calendar, date) => {
|
||||
layout.frozen = !DateMenu._isToday(date);
|
||||
this._messageList.setDate(date);
|
||||
}.bind(this));
|
||||
});
|
||||
|
||||
this.menu.connect('open-state-changed', function(menu, isOpen) {
|
||||
this.menu.connect('open-state-changed', (menu, isOpen) => {
|
||||
// Whenever the menu is opened, select today
|
||||
if (isOpen) {
|
||||
let now = new Date();
|
||||
@@ -308,7 +308,7 @@ var MultiMonitorsDateMenuButton = new Lang.Class({
|
||||
this._date.setDate(now);
|
||||
this._messageList.setDate(now);
|
||||
}
|
||||
}.bind(this));
|
||||
});
|
||||
|
||||
// Fill up the first column
|
||||
this._messageList = new MultiMonitorsCalendarMessageList();
|
||||
@@ -339,18 +339,18 @@ var MultiMonitorsDateMenuButton = new Lang.Class({
|
||||
this._sessionUpdated();
|
||||
},
|
||||
|
||||
_onDestroy: function(actor) {
|
||||
_onDestroy(actor) {
|
||||
Main.sessionMode.disconnect(this._sessionModeUpdatedId);
|
||||
if (this._currentVersion[0]==3 && this._currentVersion[1]>24) {
|
||||
this._clock.disconnect(this._clockNotifyTimezoneId);
|
||||
}
|
||||
},
|
||||
|
||||
_getEventSource: function() {
|
||||
_getEventSource() {
|
||||
return new Calendar.DBusEventSource();
|
||||
},
|
||||
|
||||
_setEventSource: function(eventSource) {
|
||||
_setEventSource(eventSource) {
|
||||
if (this._eventSource)
|
||||
this._eventSource.destroy();
|
||||
|
||||
@@ -362,7 +362,7 @@ var MultiMonitorsDateMenuButton = new Lang.Class({
|
||||
|
||||
_updateTimeZone: DateMenu.DateMenuButton.prototype._updateTimeZone,
|
||||
|
||||
_sessionUpdated: function() {
|
||||
_sessionUpdated() {
|
||||
let eventSource;
|
||||
let showEvents = Main.sessionMode.showCalendarEvents;
|
||||
if (showEvents) {
|
||||
|
||||
@@ -23,7 +23,7 @@ var SHOW_PANEL_ID = 'show-panel';
|
||||
|
||||
const MultiMonitorsPanelBox = new Lang.Class({
|
||||
Name: 'MultiMonitorsPanelBox',
|
||||
_init: function (monitor) {
|
||||
_init (monitor) {
|
||||
this._rightPanelBarrier = null;
|
||||
|
||||
this.panelBox = new St.BoxLayout({ name: 'panelBox', vertical: true });
|
||||
@@ -35,7 +35,7 @@ const MultiMonitorsPanelBox = new Lang.Class({
|
||||
this._panelBoxChangedId = this.panelBox.connect('allocation-changed', this._panelBoxChanged.bind(this));
|
||||
},
|
||||
|
||||
destroy: function () {
|
||||
destroy () {
|
||||
if (this._rightPanelBarrier) {
|
||||
this._rightPanelBarrier.destroy();
|
||||
this._rightPanelBarrier = null;
|
||||
@@ -45,12 +45,12 @@ const MultiMonitorsPanelBox = new Lang.Class({
|
||||
this.panelBox.destroy();
|
||||
},
|
||||
|
||||
updatePanel: function(monitor) {
|
||||
updatePanel(monitor) {
|
||||
this.panelBox.set_position(monitor.x, monitor.y);
|
||||
this.panelBox.set_size(monitor.width, -1);
|
||||
},
|
||||
|
||||
_panelBoxChanged: function(self, box, flags) {
|
||||
_panelBoxChanged(self, box, flags) {
|
||||
// global.log(box.get_x()+" "+box.get_y()+" "+box.get_height()+" "+box.get_width())
|
||||
|
||||
if (this._rightPanelBarrier) {
|
||||
@@ -69,7 +69,7 @@ const MultiMonitorsPanelBox = new Lang.Class({
|
||||
|
||||
var MultiMonitorsLayoutManager = new Lang.Class({
|
||||
Name: 'MultiMonitorsLayoutManager',
|
||||
_init: function () {
|
||||
_init () {
|
||||
this._currentVersion = Config.PACKAGE_VERSION.split('.');
|
||||
|
||||
this._settings = Convenience.getSettings();
|
||||
@@ -88,7 +88,7 @@ var MultiMonitorsLayoutManager = new Lang.Class({
|
||||
this._changedEnableHotCornersId = null;
|
||||
},
|
||||
|
||||
showPanel: function() {
|
||||
showPanel() {
|
||||
if (this._settings.get_boolean(SHOW_PANEL_ID)) {
|
||||
if (!this._monitorsChangedId) {
|
||||
this._monitorsChangedId = Main.layoutManager.connect('monitors-changed', this._monitorsChanged.bind(this));
|
||||
@@ -103,11 +103,11 @@ var MultiMonitorsLayoutManager = new Lang.Class({
|
||||
}
|
||||
|
||||
if (!this._layoutManager_updateHotCorners) {
|
||||
this._layoutManager_updateHotCorners = Main.layoutManager['_updateHotCorners'];
|
||||
this._layoutManager_updateHotCorners = Main.layoutManager._updateHotCorners;
|
||||
|
||||
let enable_hot_corners = (Main.sessionMode.currentMode == 'ubuntu' && this._currentVersion[0]==3 && this._currentVersion[1]==28);
|
||||
Main.layoutManager['_updateHotCorners'] = function() {
|
||||
this.hotCorners.forEach(function(corner) {
|
||||
Main.layoutManager._updateHotCorners = function() {
|
||||
this.hotCorners.forEach((corner) => {
|
||||
if (corner)
|
||||
corner.destroy();
|
||||
});
|
||||
@@ -150,7 +150,7 @@ var MultiMonitorsLayoutManager = new Lang.Class({
|
||||
}
|
||||
},
|
||||
|
||||
hidePanel: function() {
|
||||
hidePanel() {
|
||||
if (this._changedEnableHotCornersId) {
|
||||
global.settings.disconnect(this._changedEnableHotCornersId);
|
||||
this._changedEnableHotCornersId = null;
|
||||
@@ -186,7 +186,7 @@ var MultiMonitorsLayoutManager = new Lang.Class({
|
||||
}
|
||||
},
|
||||
|
||||
_monitorsChanged: function () {
|
||||
_monitorsChanged () {
|
||||
let monitorChange = Main.layoutManager.monitors.length - this._monitorIds.length -1;
|
||||
if (monitorChange<0) {
|
||||
for (let idx = 0; idx<-monitorChange; idx++) {
|
||||
@@ -223,7 +223,7 @@ var MultiMonitorsLayoutManager = new Lang.Class({
|
||||
}
|
||||
},
|
||||
|
||||
_pushPanel: function(i, monitor) {
|
||||
_pushPanel(i, monitor) {
|
||||
let mmPanelBox = new MultiMonitorsPanelBox(monitor);
|
||||
let panel = new MMPanel.MultiMonitorsPanel(i, mmPanelBox);
|
||||
|
||||
@@ -231,7 +231,7 @@ var MultiMonitorsLayoutManager = new Lang.Class({
|
||||
this.mmPanelBox.push(mmPanelBox);
|
||||
},
|
||||
|
||||
_popPanel: function() {
|
||||
_popPanel() {
|
||||
let panel = Main.mmPanel.pop();
|
||||
if (this.statusIndicatorsController) {
|
||||
this.statusIndicatorsController.transferBack(panel);
|
||||
@@ -240,7 +240,7 @@ var MultiMonitorsLayoutManager = new Lang.Class({
|
||||
mmPanelBox.destroy();
|
||||
},
|
||||
|
||||
_changeMainPanelAppMenuButton: function(appMenuButton) {
|
||||
_changeMainPanelAppMenuButton(appMenuButton) {
|
||||
let role = "appMenu";
|
||||
let panel = Main.panel;
|
||||
let indicator = panel.statusArea[role];
|
||||
@@ -256,7 +256,7 @@ var MultiMonitorsLayoutManager = new Lang.Class({
|
||||
panel._addToPanelBox(role, indicator, box.get_n_children()+1, box);
|
||||
},
|
||||
|
||||
_showAppMenu: function() {
|
||||
_showAppMenu() {
|
||||
if (this._settings.get_boolean(MMPanel.SHOW_APP_MENU_ID) && Main.mmPanel.length>0) {
|
||||
if (!this.mmappMenu) {
|
||||
this._changeMainPanelAppMenuButton(MMPanel.MultiMonitorsAppMenuButton);
|
||||
@@ -268,7 +268,7 @@ var MultiMonitorsLayoutManager = new Lang.Class({
|
||||
}
|
||||
},
|
||||
|
||||
_hideAppMenu: function() {
|
||||
_hideAppMenu() {
|
||||
if (this.mmappMenu) {
|
||||
this._changeMainPanelAppMenuButton(Panel.AppMenuButton);
|
||||
this.mmappMenu = false;
|
||||
|
||||
@@ -47,7 +47,7 @@ const MultiMonitorsWorkspaceThumbnail = new Lang.Class({
|
||||
Name: 'MultiMonitorsWorkspaceThumbnail',
|
||||
Extends: WorkspaceThumbnail.WorkspaceThumbnail,
|
||||
|
||||
_init : function(metaWorkspace, monitorIndex) {
|
||||
_init (metaWorkspace, monitorIndex) {
|
||||
this.metaWorkspace = metaWorkspace;
|
||||
this.monitorIndex = monitorIndex;
|
||||
|
||||
@@ -70,10 +70,10 @@ const MultiMonitorsWorkspaceThumbnail = new Lang.Class({
|
||||
let workArea = Main.layoutManager.getWorkAreaForMonitor(this.monitorIndex);
|
||||
this.setPorthole(workArea.x, workArea.y, workArea.width, workArea.height);
|
||||
|
||||
let windows = global.get_window_actors().filter(function(actor) {
|
||||
let windows = global.get_window_actors().filter((actor) => {
|
||||
let win = actor.meta_window;
|
||||
return win.located_on_workspace(metaWorkspace);
|
||||
}.bind(this));
|
||||
});
|
||||
|
||||
// Create clones for windows that should be visible in the Overview
|
||||
this._windows = [];
|
||||
@@ -111,7 +111,7 @@ const MultiMonitorsThumbnailsBox = new Lang.Class({
|
||||
Name: 'MultiMonitorsThumbnailsBox',
|
||||
Extends: WorkspaceThumbnail.ThumbnailsBox,
|
||||
|
||||
_init: function(monitorIndex) {
|
||||
_init(monitorIndex) {
|
||||
this._monitorIndex = monitorIndex;
|
||||
|
||||
this._currentVersion = Config.PACKAGE_VERSION.split('.');
|
||||
@@ -156,7 +156,7 @@ const MultiMonitorsThumbnailsBox = new Lang.Class({
|
||||
this._syncStackingId = 0;
|
||||
this._porthole = null;
|
||||
|
||||
this.actor.connect('button-press-event', function() { return Clutter.EVENT_STOP; });
|
||||
this.actor.connect('button-press-event', () => { return Clutter.EVENT_STOP; });
|
||||
this.actor.connect('button-release-event', this._onButtonRelease.bind(this));
|
||||
|
||||
this.actor.connect('touch-event', this._onTouchEvent.bind(this));
|
||||
@@ -176,11 +176,11 @@ const MultiMonitorsThumbnailsBox = new Lang.Class({
|
||||
this._updateSwitcherVisibility.bind(this));
|
||||
|
||||
if (this._currentVersion[0]==3 && this._currentVersion[1]>24) {
|
||||
this._monitorsChangedId = Main.layoutManager.connect('monitors-changed', function() {
|
||||
this._monitorsChangedId = Main.layoutManager.connect('monitors-changed', () => {
|
||||
this._destroyThumbnails();
|
||||
if (Main.overview.visible)
|
||||
this._createThumbnails();
|
||||
}.bind(this));
|
||||
});
|
||||
}
|
||||
|
||||
this._switchWorkspaceNotifyId = 0;
|
||||
@@ -189,7 +189,7 @@ const MultiMonitorsThumbnailsBox = new Lang.Class({
|
||||
this._workareasChangedId = 0;
|
||||
},
|
||||
|
||||
_onDestroy: function(actor) {
|
||||
_onDestroy(actor) {
|
||||
this._destroyThumbnails();
|
||||
|
||||
Main.overview.disconnect(this._showingId);
|
||||
@@ -213,7 +213,7 @@ const MultiMonitorsThumbnailsBox = new Lang.Class({
|
||||
this.actor._delegate = null;
|
||||
},
|
||||
|
||||
addThumbnails: function(start, count) {
|
||||
addThumbnails(start, count) {
|
||||
if (this._currentVersion[0]==3 && this._currentVersion[1]>24) {
|
||||
if (!this._ensurePorthole())
|
||||
return;
|
||||
@@ -258,7 +258,7 @@ const MultiMonitorsThumbnailsBox = new Lang.Class({
|
||||
},
|
||||
// The "porthole" is the portion of the screen that we show in the
|
||||
// workspaces
|
||||
_ensurePorthole: function() {
|
||||
_ensurePorthole() {
|
||||
if (!(Main.layoutManager.monitors.length>this._monitorIndex))
|
||||
return false;
|
||||
|
||||
@@ -267,7 +267,7 @@ const MultiMonitorsThumbnailsBox = new Lang.Class({
|
||||
|
||||
return true;
|
||||
},
|
||||
_ensurePorthole24: function() {
|
||||
_ensurePorthole24() {
|
||||
if (!this._porthole)
|
||||
this._porthole = Main.layoutManager.getWorkAreaForMonitor(this._monitorIndex);
|
||||
},
|
||||
@@ -277,7 +277,7 @@ const MultiMonitorsSlidingControl = new Lang.Class({
|
||||
Name: 'MultiMonitorsSlidingControl',
|
||||
Extends: OverviewControls.SlidingControl,
|
||||
|
||||
_init: function(params) {
|
||||
_init(params) {
|
||||
params = Params.parse(params, { slideDirection: OverviewControls.SlideDirection.LEFT });
|
||||
|
||||
this._visible = true;
|
||||
@@ -306,7 +306,7 @@ const MultiMonitorsSlidingControl = new Lang.Class({
|
||||
this.onAnimationEnd = null;
|
||||
},
|
||||
|
||||
_onDestroy: function(actor) {
|
||||
_onDestroy(actor) {
|
||||
Main.overview.disconnect(this._hidingId);
|
||||
|
||||
Main.overview.disconnect(this._itemDragBeginId);
|
||||
@@ -320,7 +320,7 @@ const MultiMonitorsSlidingControl = new Lang.Class({
|
||||
Tweener.removeTweens(actor);
|
||||
},
|
||||
|
||||
_updateTranslation: function() {
|
||||
_updateTranslation() {
|
||||
let translationStart = 0;
|
||||
let translationEnd = 0;
|
||||
let translation = this._getTranslation();
|
||||
@@ -340,7 +340,7 @@ const MultiMonitorsSlidingControl = new Lang.Class({
|
||||
Tweener.addTween(this.layout, { translationX: translationEnd,
|
||||
time: OverviewControls.SIDE_CONTROLS_ANIMATION_TIME,
|
||||
transition: 'easeOutQuad',
|
||||
onComplete: function() {
|
||||
onComplete() {
|
||||
if (this.onAnimationEnd) this.onAnimationEnd();
|
||||
},
|
||||
onCompleteScope: this});
|
||||
@@ -351,7 +351,7 @@ const MultiMonitorsThumbnailsSlider = new Lang.Class({
|
||||
Name: 'MultiMonitorsThumbnailsSlider',
|
||||
Extends: MultiMonitorsSlidingControl,
|
||||
|
||||
_init: function(thumbnailsBox) {
|
||||
_init(thumbnailsBox) {
|
||||
this.parent({ slideDirection: OverviewControls.SlideDirection.RIGHT });
|
||||
|
||||
this._currentVersion = Config.PACKAGE_VERSION.split('.');
|
||||
@@ -380,7 +380,7 @@ const MultiMonitorsThumbnailsSlider = new Lang.Class({
|
||||
this._thumbnailsBox.actor.bind_property('visible', this.actor, 'visible', GObject.BindingFlags.SYNC_CREATE);
|
||||
},
|
||||
|
||||
_onDestroy: function() {
|
||||
_onDestroy() {
|
||||
Main.layoutManager.disconnect(this._monitorsChangedId);
|
||||
if(this._currentVersion[0]==3 && this._currentVersion[1]<26) {
|
||||
global.window_manager.disconnect(this._switchWorkspaceId);
|
||||
@@ -401,7 +401,7 @@ const MultiMonitorsThumbnailsSlider = new Lang.Class({
|
||||
const MultiMonitorsControlsManager = new Lang.Class({
|
||||
Name: 'MultiMonitorsControlsManager',
|
||||
|
||||
_init: function(index) {
|
||||
_init(index) {
|
||||
this._monitorIndex = index;
|
||||
this._workspacesViews = null;
|
||||
|
||||
@@ -413,17 +413,17 @@ const MultiMonitorsControlsManager = new Lang.Class({
|
||||
this._thumbnailsBox = new MultiMonitorsThumbnailsBox(this._monitorIndex);
|
||||
this._thumbnailsSlider = new MultiMonitorsThumbnailsSlider(this._thumbnailsBox);
|
||||
|
||||
this._thumbnailsSlider.onAnimationBegin = function() {
|
||||
this._thumbnailsSlider.onAnimationBegin = () => {
|
||||
this._animationInProgress = true;
|
||||
}.bind(this);
|
||||
this._thumbnailsSlider.onAnimationEnd = function() {
|
||||
};
|
||||
this._thumbnailsSlider.onAnimationEnd = () => {
|
||||
this._animationInProgress = false;
|
||||
if(!this._workspacesViews)
|
||||
return;
|
||||
let geometry = this.getWorkspacesActualGeometry();
|
||||
// global.log("actualG+ i: "+this._monitorIndex+" x: "+geometry.x+" y: "+geometry.y+" width: "+geometry.width+" height: "+geometry.height);
|
||||
this._workspacesViews.setActualGeometry(geometry);
|
||||
}.bind(this);
|
||||
};
|
||||
|
||||
let reactiveFlag = false;
|
||||
|
||||
@@ -458,16 +458,16 @@ const MultiMonitorsControlsManager = new Lang.Class({
|
||||
this._pageEmptyId = Main.overview.viewSelector.connect('page-empty', this._onPageEmpty.bind(this));
|
||||
|
||||
this._clickAction = new Clutter.ClickAction()
|
||||
this._clickedId = this._clickAction.connect('clicked', function(action) {
|
||||
this._clickedId = this._clickAction.connect('clicked', (action) => {
|
||||
if (action.get_button() == 1 && this._workspacesViews &&
|
||||
this._workspacesViews.getActiveWorkspace().isEmpty())
|
||||
Main.overview.hide();
|
||||
}.bind(this));
|
||||
});
|
||||
|
||||
Main.mmOverview[this._monitorIndex].addAction(this._clickAction);
|
||||
},
|
||||
|
||||
inOverviewInit: function() {
|
||||
inOverviewInit() {
|
||||
if (Main.overview.visible) {
|
||||
this._thumbnailsBox._createThumbnails();
|
||||
let activePage = Main.overview.viewSelector.getActivePage();
|
||||
@@ -479,7 +479,7 @@ const MultiMonitorsControlsManager = new Lang.Class({
|
||||
}
|
||||
},
|
||||
|
||||
_onScrollEvent: function(actor, event) {
|
||||
_onScrollEvent(actor, event) {
|
||||
if (!this.actor.mapped)
|
||||
return Clutter.EVENT_PROPAGATE;
|
||||
let display;
|
||||
@@ -501,7 +501,7 @@ const MultiMonitorsControlsManager = new Lang.Class({
|
||||
return Clutter.EVENT_STOP;
|
||||
},
|
||||
|
||||
_onDestroy: function() {
|
||||
_onDestroy() {
|
||||
Main.overview.viewSelector.disconnect(this._pageChangedId);
|
||||
Main.overview.viewSelector.disconnect(this._pageEmptyId);
|
||||
this._settings.disconnect(this._thumbnailsOnLeftSideId);
|
||||
@@ -510,7 +510,7 @@ const MultiMonitorsControlsManager = new Lang.Class({
|
||||
Main.mmOverview[this._monitorIndex].removeAction(this._clickAction);
|
||||
},
|
||||
|
||||
_thumbnailsOnLeftSide: function() {
|
||||
_thumbnailsOnLeftSide() {
|
||||
if(this._settings.get_boolean(THUMBNAILS_ON_LEFT_SIDE_ID)){
|
||||
let first = this._group.get_first_child();
|
||||
if(first != this._thumbnailsSlider.actor){
|
||||
@@ -531,7 +531,7 @@ const MultiMonitorsControlsManager = new Lang.Class({
|
||||
}
|
||||
},
|
||||
|
||||
getWorkspacesGeometry: function() {
|
||||
getWorkspacesGeometry() {
|
||||
if (!(Main.layoutManager.monitors.length>this._monitorIndex)) {
|
||||
return { x: -1, y: -1, width: -1, height: -1 };
|
||||
}
|
||||
@@ -580,18 +580,18 @@ const MultiMonitorsControlsManager = new Lang.Class({
|
||||
return geometry;
|
||||
},
|
||||
|
||||
isAnimationInProgress: function() {
|
||||
isAnimationInProgress() {
|
||||
return this._animationInProgress;
|
||||
},
|
||||
|
||||
getWorkspacesFullGeometry: function() {
|
||||
getWorkspacesFullGeometry() {
|
||||
if (this._fullGeometry)
|
||||
return this._fullGeometry;
|
||||
else
|
||||
return Main.layoutManager.monitors[this._monitorIndex];
|
||||
},
|
||||
|
||||
getWorkspacesActualGeometry: function() {
|
||||
getWorkspacesActualGeometry() {
|
||||
let [x, y] = this._viewActor.get_transformed_position();
|
||||
let allocation = this._viewActor.allocation;
|
||||
let width = allocation.x2 - allocation.x1;
|
||||
@@ -599,14 +599,14 @@ const MultiMonitorsControlsManager = new Lang.Class({
|
||||
return { x: x, y: y, width: width, height: height };
|
||||
},
|
||||
|
||||
_updateWorkspacesGeometry: function() {
|
||||
_updateWorkspacesGeometry() {
|
||||
this._fullGeometry = this.getWorkspacesGeometry();
|
||||
if(!this._workspacesViews)
|
||||
return;
|
||||
this._workspacesViews.setFullGeometry(this._fullGeometry);
|
||||
},
|
||||
|
||||
_setVisibility: function() {
|
||||
_setVisibility() {
|
||||
// Ignore the case when we're leaving the overview, since
|
||||
// actors will be made visible again when entering the overview
|
||||
// next time, and animating them while doing so is just
|
||||
@@ -642,15 +642,15 @@ const MultiMonitorsControlsManager = new Lang.Class({
|
||||
});
|
||||
},
|
||||
|
||||
_onPageEmpty: function() {
|
||||
_onPageEmpty() {
|
||||
this._thumbnailsSlider.pageEmpty();
|
||||
},
|
||||
|
||||
show: function() {
|
||||
show() {
|
||||
this._workspacesViews = Main.overview.viewSelector._workspacesDisplay._workspacesViews[this._monitorIndex];
|
||||
},
|
||||
|
||||
hide: function() {
|
||||
hide() {
|
||||
if (this._workspacesViews && (!this._workspacesViews.actor.visible)) {
|
||||
this._workspacesViews.actor.opacity = 255;
|
||||
this._workspacesViews.actor.visible = true;
|
||||
@@ -662,7 +662,7 @@ const MultiMonitorsControlsManager = new Lang.Class({
|
||||
var MultiMonitorsOverview = new Lang.Class({
|
||||
Name: 'MultiMonitorsOverview',
|
||||
|
||||
_init: function(index) {
|
||||
_init(index) {
|
||||
this.monitorIndex = index;
|
||||
this._settings = Convenience.getSettings();
|
||||
|
||||
@@ -679,7 +679,7 @@ var MultiMonitorsOverview = new Lang.Class({
|
||||
this._hidingId = null;
|
||||
},
|
||||
|
||||
init: function() {
|
||||
init() {
|
||||
this._panelGhost = null;
|
||||
|
||||
if (Main.mmPanel) {
|
||||
@@ -703,17 +703,17 @@ var MultiMonitorsOverview = new Lang.Class({
|
||||
this._hidingId = Main.overview.connect('hiding', this._hide.bind(this));
|
||||
},
|
||||
|
||||
getWorkspacesFullGeometry: function() {
|
||||
getWorkspacesFullGeometry() {
|
||||
return this._controls.getWorkspacesFullGeometry();
|
||||
},
|
||||
|
||||
getWorkspacesActualGeometry: function() {
|
||||
getWorkspacesActualGeometry() {
|
||||
if (this._controls.isAnimationInProgress())
|
||||
return null;
|
||||
return this._controls.getWorkspacesActualGeometry();
|
||||
},
|
||||
|
||||
_onDestroy: function(actor) {
|
||||
_onDestroy(actor) {
|
||||
if(this._showingId)
|
||||
Main.overview.disconnect(this._showingId);
|
||||
if(this._hidingId)
|
||||
@@ -724,19 +724,19 @@ var MultiMonitorsOverview = new Lang.Class({
|
||||
this._overview._delegate = null;
|
||||
},
|
||||
|
||||
_show: function() {
|
||||
_show() {
|
||||
this._controls.show();
|
||||
},
|
||||
|
||||
_hide: function() {
|
||||
_hide() {
|
||||
this._controls.hide();
|
||||
},
|
||||
|
||||
destroy: function() {
|
||||
destroy() {
|
||||
this._overview.destroy();
|
||||
},
|
||||
|
||||
addAction: function(action) {
|
||||
addAction(action) {
|
||||
// if (this.isDummy)
|
||||
// return;
|
||||
|
||||
@@ -744,7 +744,7 @@ var MultiMonitorsOverview = new Lang.Class({
|
||||
// _overview >> _backgroundGroup
|
||||
},
|
||||
|
||||
removeAction: function(action) {
|
||||
removeAction(action) {
|
||||
if(action.get_actor())
|
||||
this._overview.remove_action(action);
|
||||
}
|
||||
@@ -756,12 +756,12 @@ var MultiMonitorsWorkspacesDisplay = new Lang.Class({
|
||||
Name: 'MultiMonitorsWorkspacesDisplay',
|
||||
Extends: WorkspacesView.WorkspacesDisplay,
|
||||
|
||||
_init: function() {
|
||||
_init() {
|
||||
this.parent();
|
||||
this._restackedNotifyId = 0;
|
||||
},
|
||||
|
||||
_workspacesOnlyOnPrimaryChanged: function() {
|
||||
_workspacesOnlyOnPrimaryChanged() {
|
||||
this._workspacesOnlyOnPrimary = this._settings.get_boolean('workspaces-only-on-primary');
|
||||
|
||||
if (!Main.overview.visible)
|
||||
@@ -773,7 +773,7 @@ var MultiMonitorsWorkspacesDisplay = new Lang.Class({
|
||||
this._updateWorkspacesViews();
|
||||
},
|
||||
|
||||
_updateWorkspacesFullGeometry: function() {
|
||||
_updateWorkspacesFullGeometry() {
|
||||
if (this._workspacesViews.length!=Main.layoutManager.monitors.length)
|
||||
return;
|
||||
|
||||
@@ -794,7 +794,7 @@ var MultiMonitorsWorkspacesDisplay = new Lang.Class({
|
||||
}
|
||||
},
|
||||
|
||||
_updateWorkspacesActualGeometry: function() {
|
||||
_updateWorkspacesActualGeometry() {
|
||||
if (this._workspacesViews.length!=Main.layoutManager.monitors.length)
|
||||
return;
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ const TRANSFER_INDICATORS_ID = 'transfer-indicators';
|
||||
var StatusIndicatorsController = new Lang.Class({
|
||||
Name: 'StatusIndicatorController',
|
||||
|
||||
_init: function() {
|
||||
_init() {
|
||||
this._transfered_indicators = []; //{iname:, box:, monitor:}
|
||||
this._settings = Convenience.getSettings();
|
||||
|
||||
@@ -62,7 +62,7 @@ var StatusIndicatorsController = new Lang.Class({
|
||||
this.transferIndicators.bind(this));
|
||||
},
|
||||
|
||||
destroy: function() {
|
||||
destroy() {
|
||||
this._settings.disconnect(this._transferIndicatorsId);
|
||||
ExtensionSystem.disconnect(this._extensionStateChangedId);
|
||||
Main.sessionMode.disconnect(this._updatedSessionId);
|
||||
@@ -70,20 +70,20 @@ var StatusIndicatorsController = new Lang.Class({
|
||||
this._transferBack(this._transfered_indicators);
|
||||
},
|
||||
|
||||
transferBack: function(panel) {
|
||||
let transfer_back = this._transfered_indicators.filter(function(element) {
|
||||
transferBack(panel) {
|
||||
let transfer_back = this._transfered_indicators.filter((element) => {
|
||||
return element.monitor==panel.monitorIndex;
|
||||
});
|
||||
|
||||
this._transferBack(transfer_back, panel);
|
||||
},
|
||||
|
||||
transferIndicators: function() {
|
||||
transferIndicators() {
|
||||
let boxs = ['_leftBox', '_centerBox', '_rightBox'];
|
||||
let transfers = this._settings.get_value(TRANSFER_INDICATORS_ID).deep_unpack();
|
||||
let show_app_menu = this._settings.get_value(SHOW_APP_MENU_ID);
|
||||
|
||||
let transfer_back = this._transfered_indicators.filter(function(element) {
|
||||
let transfer_back = this._transfered_indicators.filter((element) => {
|
||||
return !transfers.hasOwnProperty(element.iname);
|
||||
});
|
||||
|
||||
@@ -95,7 +95,7 @@ var StatusIndicatorsController = new Lang.Class({
|
||||
|
||||
let indicator = Main.panel.statusArea[iname];
|
||||
let panel = this._findPanel(monitor);
|
||||
boxs.forEach(function(box) {
|
||||
boxs.forEach((box) => {
|
||||
if(Main.panel[box].contains(indicator.container) && panel) {
|
||||
global.log('a '+box+ " > " + iname + " : "+ monitor);
|
||||
this._transfered_indicators.push({iname:iname, box:box, monitor:monitor});
|
||||
@@ -105,12 +105,12 @@ var StatusIndicatorsController = new Lang.Class({
|
||||
else
|
||||
panel[box].insert_child_at_index(indicator.container, 0);
|
||||
}
|
||||
}.bind(this));
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
_findPanel: function(monitor) {
|
||||
_findPanel(monitor) {
|
||||
for (let i = 0; i < Main.mmPanel.length; i++) {
|
||||
if (Main.mmPanel[i].monitorIndex == monitor) {
|
||||
return Main.mmPanel[i];
|
||||
@@ -119,8 +119,8 @@ var StatusIndicatorsController = new Lang.Class({
|
||||
return null;
|
||||
},
|
||||
|
||||
_transferBack: function(transfer_back, panel) {
|
||||
transfer_back.forEach(function(element) {
|
||||
_transferBack(transfer_back, panel) {
|
||||
transfer_back.forEach((element) => {
|
||||
this._transfered_indicators.splice(this._transfered_indicators.indexOf(element));
|
||||
if(Main.panel.statusArea[element.iname]) {
|
||||
let indicator = Main.panel.statusArea[element.iname];
|
||||
@@ -136,20 +136,20 @@ var StatusIndicatorsController = new Lang.Class({
|
||||
Main.panel[element.box].insert_child_at_index(indicator.container, 0);
|
||||
}
|
||||
}
|
||||
}.bind(this));
|
||||
});
|
||||
},
|
||||
|
||||
_extensionStateChanged: function() {
|
||||
_extensionStateChanged() {
|
||||
this._findAvailableIndicators();
|
||||
this.transferIndicators();
|
||||
},
|
||||
|
||||
_updateSessionIndicators: function() {
|
||||
_updateSessionIndicators() {
|
||||
let session_indicators = [];
|
||||
session_indicators.push('MultiMonitorsAddOn');
|
||||
let sessionPanel = Main.sessionMode.panel;
|
||||
for (let sessionBox in sessionPanel){
|
||||
sessionPanel[sessionBox].forEach(function(sesionIndicator){
|
||||
sessionPanel[sessionBox].forEach((sesionIndicator) => {
|
||||
session_indicators.push(sesionIndicator);
|
||||
});
|
||||
}
|
||||
@@ -160,7 +160,7 @@ var StatusIndicatorsController = new Lang.Class({
|
||||
this.transferIndicators();
|
||||
},
|
||||
|
||||
_findAvailableIndicators: function() {
|
||||
_findAvailableIndicators() {
|
||||
let available_indicators = [];
|
||||
let statusArea = Main.panel.statusArea;
|
||||
for(let indicator in statusArea) {
|
||||
@@ -180,7 +180,7 @@ var MultiMonitorsAppMenuButton = new Lang.Class({
|
||||
Name: 'MultiMonitorsAppMenuButton',
|
||||
Extends: Panel.AppMenuButton,
|
||||
|
||||
_init: function(panel) {
|
||||
_init(panel) {
|
||||
if (panel.monitorIndex==undefined)
|
||||
this._monitorIndex = Main.layoutManager.primaryIndex;
|
||||
else
|
||||
@@ -199,7 +199,7 @@ var MultiMonitorsAppMenuButton = new Lang.Class({
|
||||
this._windowLeftMonitor.bind(this));
|
||||
},
|
||||
|
||||
_windowEnteredMonitor : function(metaScreen, monitorIndex, metaWin) {
|
||||
_windowEnteredMonitor (metaScreen, monitorIndex, metaWin) {
|
||||
if (monitorIndex == this._monitorIndex) {
|
||||
switch(metaWin.get_window_type()){
|
||||
case Meta.WindowType.NORMAL:
|
||||
@@ -212,7 +212,7 @@ var MultiMonitorsAppMenuButton = new Lang.Class({
|
||||
}
|
||||
},
|
||||
|
||||
_windowLeftMonitor : function(metaScreen, monitorIndex, metaWin) {
|
||||
_windowLeftMonitor (metaScreen, monitorIndex, metaWin) {
|
||||
if (monitorIndex == this._monitorIndex) {
|
||||
switch(metaWin.get_window_type()){
|
||||
case Meta.WindowType.NORMAL:
|
||||
@@ -225,7 +225,7 @@ var MultiMonitorsAppMenuButton = new Lang.Class({
|
||||
}
|
||||
},
|
||||
|
||||
_findTargetApp: function() {
|
||||
_findTargetApp() {
|
||||
|
||||
if (this._actionOnWorkspaceGroupNotifyId) {
|
||||
this._targetAppGroup.disconnect(this._actionOnWorkspaceGroupNotifyId);
|
||||
@@ -301,7 +301,7 @@ var MultiMonitorsAppMenuButton = new Lang.Class({
|
||||
|
||||
return null;
|
||||
},
|
||||
destroy: function() {
|
||||
destroy() {
|
||||
if (this._actionGroupNotifyId) {
|
||||
this._targetApp.disconnect(this._actionGroupNotifyId);
|
||||
this._actionGroupNotifyId = 0;
|
||||
@@ -327,7 +327,7 @@ const MultiMonitorsActivitiesButton = new Lang.Class({
|
||||
_onKeyRelease: Panel.ActivitiesButton.prototype["_onKeyRelease"],
|
||||
_xdndToggleOverview: Panel.ActivitiesButton.prototype["_xdndToggleOverview"],
|
||||
|
||||
_init: function() {
|
||||
_init() {
|
||||
this.parent(0.0, null, true);
|
||||
this.actor.accessible_role = Atk.Role.TOGGLE_BUTTON;
|
||||
|
||||
@@ -344,21 +344,21 @@ const MultiMonitorsActivitiesButton = new Lang.Class({
|
||||
this.actor.connect('captured-event', this._onCapturedEvent.bind(this));
|
||||
this.actor.connect_after('key-release-event', this._onKeyRelease.bind(this));
|
||||
|
||||
this._showingId = Main.overview.connect('showing', function() {
|
||||
this._showingId = Main.overview.connect('showing', () => {
|
||||
this.actor.add_style_pseudo_class('overview');
|
||||
this.actor.add_accessible_state (Atk.StateType.CHECKED);
|
||||
}.bind(this));
|
||||
this._hidingId = Main.overview.connect('hiding', function() {
|
||||
});
|
||||
this._hidingId = Main.overview.connect('hiding', () => {
|
||||
this.actor.remove_style_pseudo_class('overview');
|
||||
this.actor.remove_accessible_state (Atk.StateType.CHECKED);
|
||||
}.bind(this));
|
||||
});
|
||||
|
||||
this.actor.connect('destroy', this._onDestroy.bind(this));
|
||||
|
||||
this._xdndTimeOut = 0;
|
||||
},
|
||||
|
||||
_onDestroy: function(actor) {
|
||||
_onDestroy(actor) {
|
||||
Main.overview.disconnect(this._showingId);
|
||||
Main.overview.disconnect(this._hidingId);
|
||||
}
|
||||
@@ -378,7 +378,7 @@ var MultiMonitorsPanel = new Lang.Class({
|
||||
Name: 'MultiMonitorsPanel',
|
||||
Extends: Panel.Panel,
|
||||
|
||||
_init : function(monitorIndex, mmPanelBox) {
|
||||
_init (monitorIndex, mmPanelBox) {
|
||||
this.monitorIndex = monitorIndex;
|
||||
|
||||
this._currentVersion = Config.PACKAGE_VERSION.split('.');
|
||||
@@ -420,18 +420,18 @@ var MultiMonitorsPanel = new Lang.Class({
|
||||
this.actor.connect('key-press-event', this._onKeyPress.bind(this));
|
||||
}
|
||||
|
||||
this._showingId = Main.overview.connect('showing', function () {
|
||||
this._showingId = Main.overview.connect('showing', () => {
|
||||
this.actor.add_style_pseudo_class('overview');
|
||||
if (this._currentVersion[0]==3 && this._currentVersion[1]>24) {
|
||||
this._updateSolidStyle();
|
||||
}
|
||||
}.bind(this));
|
||||
this._hidingId = Main.overview.connect('hiding', function () {
|
||||
});
|
||||
this._hidingId = Main.overview.connect('hiding', () => {
|
||||
this.actor.remove_style_pseudo_class('overview');
|
||||
if (this._currentVersion[0]==3 && this._currentVersion[1]>24) {
|
||||
this._updateSolidStyle();
|
||||
}
|
||||
}.bind(this));
|
||||
});
|
||||
|
||||
mmPanelBox.panelBox.add(this.actor);
|
||||
|
||||
@@ -477,7 +477,7 @@ var MultiMonitorsPanel = new Lang.Class({
|
||||
|
||||
},
|
||||
|
||||
_onDestroy: function(actor) {
|
||||
_onDestroy(actor) {
|
||||
|
||||
if (this._currentVersion[0]==3 && this._currentVersion[1]>26) {
|
||||
let display;
|
||||
@@ -491,7 +491,7 @@ var MultiMonitorsPanel = new Lang.Class({
|
||||
global.window_group.disconnect(this._actorRemovedId);
|
||||
global.window_manager.disconnect(this._switchWorkspaceId);
|
||||
|
||||
this._trackedWindows.forEach(function (value, key, map) {
|
||||
this._trackedWindows.forEach((value, key, map) => {
|
||||
value.forEach(id => {
|
||||
key.disconnect(id);
|
||||
});
|
||||
@@ -517,7 +517,7 @@ var MultiMonitorsPanel = new Lang.Class({
|
||||
this.actor._delegate = null;
|
||||
},
|
||||
|
||||
_showActivities: function() {
|
||||
_showActivities() {
|
||||
let name = 'activities';
|
||||
if(this._settings.get_boolean(SHOW_ACTIVITIES_ID)){
|
||||
if(this.statusArea[name])
|
||||
@@ -529,7 +529,7 @@ var MultiMonitorsPanel = new Lang.Class({
|
||||
}
|
||||
},
|
||||
|
||||
_showDateTime: function() {
|
||||
_showDateTime() {
|
||||
let name = 'dateMenu';
|
||||
if(this._settings.get_boolean(SHOW_DATE_TIME_ID)){
|
||||
if(this.statusArea[name])
|
||||
@@ -541,7 +541,7 @@ var MultiMonitorsPanel = new Lang.Class({
|
||||
}
|
||||
},
|
||||
|
||||
_showAppMenu: function() {
|
||||
_showAppMenu() {
|
||||
let name = 'appMenu';
|
||||
if(this._settings.get_boolean(SHOW_APP_MENU_ID)){
|
||||
if(!this.statusArea[name]){
|
||||
@@ -560,7 +560,7 @@ var MultiMonitorsPanel = new Lang.Class({
|
||||
}
|
||||
},
|
||||
|
||||
_getPreferredWidth: function(actor, forHeight, alloc) {
|
||||
_getPreferredWidth(actor, forHeight, alloc) {
|
||||
alloc.min_size = -1;
|
||||
if(Main.layoutManager.monitors.length>this.monitorIndex)
|
||||
alloc.natural_size = Main.layoutManager.monitors[this.monitorIndex].width;
|
||||
@@ -568,7 +568,7 @@ var MultiMonitorsPanel = new Lang.Class({
|
||||
alloc.natural_size = -1;
|
||||
},
|
||||
|
||||
_updateSolidStyle: function() {
|
||||
_updateSolidStyle() {
|
||||
if (this.actor.has_style_pseudo_class('overview') || !Main.sessionMode.hasWindows) {
|
||||
this._removeStyleClassName('solid');
|
||||
return;
|
||||
@@ -582,7 +582,7 @@ var MultiMonitorsPanel = new Lang.Class({
|
||||
display = global.screen || global.workspace_manager;
|
||||
let activeWorkspace = display.get_active_workspace();
|
||||
let monitorIndex = this.monitorIndex;
|
||||
let windows = activeWorkspace.list_windows().filter(function(metaWindow) {
|
||||
let windows = activeWorkspace.list_windows().filter((metaWindow) => {
|
||||
return metaWindow.get_monitor() == monitorIndex &&
|
||||
metaWindow.showing_on_its_workspace() &&
|
||||
metaWindow.get_window_type() != Meta.WindowType.DESKTOP;
|
||||
@@ -592,10 +592,10 @@ var MultiMonitorsPanel = new Lang.Class({
|
||||
let [, panelTop] = this.actor.get_transformed_position();
|
||||
let panelBottom = panelTop + this.actor.get_height();
|
||||
let scale = St.ThemeContext.get_for_stage(global.stage).scale_factor;
|
||||
let isNearEnough = windows.some(function(metaWindow) {
|
||||
let isNearEnough = windows.some((metaWindow) => {
|
||||
let verticalPosition = metaWindow.get_frame_rect().y;
|
||||
return verticalPosition < panelBottom + 5 * scale;
|
||||
}.bind(this));
|
||||
});
|
||||
|
||||
if (isNearEnough)
|
||||
this._addStyleClassName('solid');
|
||||
@@ -604,7 +604,7 @@ var MultiMonitorsPanel = new Lang.Class({
|
||||
},
|
||||
|
||||
|
||||
_hideIndicators: function() {
|
||||
_hideIndicators() {
|
||||
for (let role in MULTI_MONITOR_PANEL_ITEM_IMPLEMENTATIONS) {
|
||||
let indicator = this.statusArea[role];
|
||||
if (!indicator)
|
||||
@@ -617,7 +617,7 @@ var MultiMonitorsPanel = new Lang.Class({
|
||||
}
|
||||
},
|
||||
|
||||
_ensureIndicator: function(role) {
|
||||
_ensureIndicator(role) {
|
||||
let indicator = this.statusArea[role];
|
||||
if (!indicator) {
|
||||
let constructor = MULTI_MONITOR_PANEL_ITEM_IMPLEMENTATIONS[role];
|
||||
|
||||
@@ -50,7 +50,7 @@ const MultiMonitorsPrefsWidget = new GObject.Class({
|
||||
Name: 'MultiMonitorsPrefsWidget',
|
||||
Extends: Gtk.Grid,
|
||||
|
||||
_init: function(params) {
|
||||
_init(params) {
|
||||
this.parent(params);
|
||||
|
||||
this.set_orientation(Gtk.Orientation.VERTICAL);
|
||||
@@ -105,7 +105,7 @@ const MultiMonitorsPrefsWidget = new GObject.Class({
|
||||
|
||||
},
|
||||
|
||||
_updateIndicators: function() {
|
||||
_updateIndicators() {
|
||||
this._store.clear();
|
||||
|
||||
let transfers = this._settings.get_value(TRANSFER_INDICATORS_ID).deep_unpack();
|
||||
@@ -119,7 +119,7 @@ const MultiMonitorsPrefsWidget = new GObject.Class({
|
||||
}
|
||||
},
|
||||
|
||||
_addIndicator: function() {
|
||||
_addIndicator() {
|
||||
|
||||
let dialog = new Gtk.Dialog({ title: _("Select indicator"),
|
||||
transient_for: this.get_toplevel(), modal: true });
|
||||
@@ -146,10 +146,10 @@ const MultiMonitorsPrefsWidget = new GObject.Class({
|
||||
|
||||
dialog._treeView.append_column(appColumn);
|
||||
|
||||
let availableIndicators = function() {
|
||||
let availableIndicators = () => {
|
||||
let transfers = this._settings.get_value(TRANSFER_INDICATORS_ID).unpack();
|
||||
dialog._store.clear();
|
||||
this._settings.get_strv(AVAILABLE_INDICATORS_ID).forEach(function(indicator){
|
||||
this._settings.get_strv(AVAILABLE_INDICATORS_ID).forEach((indicator) => {
|
||||
if(!transfers.hasOwnProperty(indicator)){
|
||||
let iter = dialog._store.append();
|
||||
dialog._store.set(iter, [Columns.INDICATOR_NAME], [indicator]);
|
||||
@@ -158,9 +158,9 @@ const MultiMonitorsPrefsWidget = new GObject.Class({
|
||||
};
|
||||
|
||||
let availableIndicatorsId = this._settings.connect('changed::'+AVAILABLE_INDICATORS_ID,
|
||||
Lang.bind(this, availableIndicators));
|
||||
availableIndicators);
|
||||
let transferIndicatorsId = this._settings.connect('changed::'+TRANSFER_INDICATORS_ID,
|
||||
Lang.bind(this, availableIndicators));
|
||||
availableIndicators);
|
||||
|
||||
availableIndicators.apply(this);
|
||||
// grid.attach(dialog._treeView, 0, 0, 2, 1);
|
||||
@@ -173,20 +173,20 @@ const MultiMonitorsPrefsWidget = new GObject.Class({
|
||||
let spinButton = new Gtk.SpinButton({halign: Gtk.Align.END, adjustment: dialog._adjustment, numeric: 1});
|
||||
gHBox.add(spinButton);
|
||||
|
||||
let monitorsChanged = function() {
|
||||
let monitorsChanged = () => {
|
||||
let n_monitors = this._screen.get_n_monitors() -1;
|
||||
dialog._adjustment.set_upper(n_monitors)
|
||||
dialog._adjustment.set_value(n_monitors);
|
||||
};
|
||||
|
||||
let monitorsChangedId = this._screen.connect('monitors-changed', Lang.bind(this, monitorsChanged));
|
||||
let monitorsChangedId = this._screen.connect('monitors-changed', monitorsChanged);
|
||||
|
||||
monitorsChanged.apply(this);
|
||||
grid.add(gHBox);
|
||||
|
||||
dialog.get_content_area().add(grid);
|
||||
|
||||
dialog.connect('response', Lang.bind(this, function(dialog, id) {
|
||||
dialog.connect('response', (dialog, id) => {
|
||||
this._screen.disconnect(monitorsChangedId);
|
||||
this._settings.disconnect(availableIndicatorsId);
|
||||
this._settings.disconnect(transferIndicatorsId);
|
||||
@@ -207,12 +207,12 @@ const MultiMonitorsPrefsWidget = new GObject.Class({
|
||||
}
|
||||
|
||||
dialog.destroy();
|
||||
}));
|
||||
});
|
||||
|
||||
dialog.show_all();
|
||||
},
|
||||
|
||||
_removeIndicator: function() {
|
||||
_removeIndicator() {
|
||||
let [any, model, iter] = this._treeView.get_selection().get_selected();
|
||||
if (any) {
|
||||
let indicator = model.get_value(iter, Columns.INDICATOR_NAME);
|
||||
@@ -225,7 +225,7 @@ const MultiMonitorsPrefsWidget = new GObject.Class({
|
||||
}
|
||||
},
|
||||
|
||||
_addBooleanSwitch: function(label, schema_id) {
|
||||
_addBooleanSwitch(label, schema_id) {
|
||||
let gHBox = new Gtk.HBox({margin: 10, spacing: 20, hexpand: true});
|
||||
let gLabel = new Gtk.Label({label: _(label), halign: Gtk.Align.START});
|
||||
gHBox.add(gLabel);
|
||||
|
||||
Reference in New Issue
Block a user