mirror of
https://github.com/BreizhHardware/multi-monitors-add-on.git
synced 2026-01-18 16:47:26 +01:00
Issue #111: Initial update to Gnome 3.36
This commit is contained in:
@@ -9,7 +9,7 @@ in dynamic fashion, no restart needed.
|
||||
Versions
|
||||
========
|
||||
|
||||
* Branch [master](https://github.com/spin83/multi-monitors-add-on/tree/master) contains extension for GNOME 3.32 and 3.34
|
||||
* Branch [master](https://github.com/spin83/multi-monitors-add-on/tree/master) contains extension for GNOME 3.32, 3.34 and 3.36
|
||||
* Branch [gnome-3-24_3-30](https://github.com/spin83/multi-monitors-add-on/tree/gnome-3-24_3-30) contains extension for GNOME 3.24, 3.26, 3.28 and 3.30
|
||||
* Branch [gnome-3-20_3-22](https://github.com/spin83/multi-monitors-add-on/tree/gnome-3-20_3-22) contains extension for GNOME 3.20 and 3.22
|
||||
* Branch [gnome-3-16_3-18](https://github.com/spin83/multi-monitors-add-on/tree/gnome-3-16_3-18) contains extension for GNOME 3.16 and 3.18
|
||||
|
||||
@@ -119,17 +119,33 @@ const MultiMonitorsAddOn = new Lang.Class({
|
||||
if (workspacesDisplay._restackedNotifyId === undefined) {
|
||||
workspacesDisplay._restackedNotifyId = 0;
|
||||
}
|
||||
workspacesDisplay.hide();
|
||||
workspacesDisplay.actor._delegate = null;
|
||||
workspacesDisplay.actor.destroy();
|
||||
Main.overview.viewSelector._workspacesPage.hide();
|
||||
Main.overview.viewSelector._workspacesPage.destroy();
|
||||
workspacesDisplay.actor = null;
|
||||
|
||||
workspacesDisplay = new MMOverview.MultiMonitorsWorkspacesDisplay();
|
||||
Main.overview.viewSelector._workspacesDisplay = workspacesDisplay;
|
||||
Main.overview.viewSelector._workspacesPage = Main.overview.viewSelector._addPage(workspacesDisplay.actor,
|
||||
_("Windows"), 'focus-windows-symbolic');
|
||||
if (gnomeShellVersion()[1]<36) {
|
||||
workspacesDisplay.hide();
|
||||
workspacesDisplay.actor._delegate = null;
|
||||
workspacesDisplay.actor.destroy();
|
||||
Main.overview.viewSelector._workspacesPage.hide();
|
||||
Main.overview.viewSelector._workspacesPage.destroy();
|
||||
workspacesDisplay.actor = null;
|
||||
|
||||
workspacesDisplay = new MMOverview.MultiMonitorsWorkspacesDisplay34();
|
||||
Main.overview.viewSelector._workspacesDisplay = workspacesDisplay;
|
||||
Main.overview.viewSelector._workspacesPage = Main.overview.viewSelector._addPage(workspacesDisplay.actor,
|
||||
_("Windows"), 'focus-windows-symbolic');
|
||||
}
|
||||
else {
|
||||
workspacesDisplay.hide();
|
||||
workspacesDisplay.destroy();
|
||||
//workspacesDisplay._swipeTracker = null;
|
||||
Main.overview.viewSelector._workspacesDisplay = null;
|
||||
Main.overview.viewSelector._workspacesPage.hide();
|
||||
Main.overview.viewSelector._workspacesPage.destroy();
|
||||
|
||||
let workspaceAdjustment = Main.overview._overview._controls._workspaceAdjustment;
|
||||
workspacesDisplay = new MMOverview.MultiMonitorsWorkspacesDisplay(workspaceAdjustment);
|
||||
Main.overview.viewSelector._workspacesDisplay = workspacesDisplay;
|
||||
Main.overview.viewSelector._workspacesPage = Main.overview.viewSelector._addPage(workspacesDisplay,
|
||||
_("Windows"), 'focus-windows-symbolic');
|
||||
}
|
||||
if (Main.overview.visible) {
|
||||
Main.overview._controls._updateWorkspacesGeometry();
|
||||
Main.overview.viewSelector._workspacesPage.show();
|
||||
@@ -145,18 +161,35 @@ const MultiMonitorsAddOn = new Lang.Class({
|
||||
if (Main.mmOverview) {
|
||||
|
||||
if (!Main.overview.visible) {
|
||||
let workspacesDisplay = Main.overview.viewSelector._workspacesDisplay;
|
||||
workspacesDisplay.hide();
|
||||
workspacesDisplay.actor._delegate = null;
|
||||
workspacesDisplay.actor.destroy();
|
||||
Main.overview.viewSelector._workspacesPage.hide();
|
||||
Main.overview.viewSelector._workspacesPage.destroy();
|
||||
workspacesDisplay.actor = null;
|
||||
|
||||
workspacesDisplay = new WorkspacesView.WorkspacesDisplay();
|
||||
Main.overview.viewSelector._workspacesDisplay = workspacesDisplay;
|
||||
Main.overview.viewSelector._workspacesPage = Main.overview.viewSelector._addPage(workspacesDisplay.actor,
|
||||
_("Windows"), 'focus-windows-symbolic');
|
||||
if (gnomeShellVersion()[1]<36) {
|
||||
let workspacesDisplay = Main.overview.viewSelector._workspacesDisplay;
|
||||
workspacesDisplay.hide();
|
||||
workspacesDisplay.actor.destroy();
|
||||
//workspacesDisplay.actor._delegate = null;
|
||||
Main.overview.viewSelector._workspacesDisplay = null;
|
||||
Main.overview.viewSelector._workspacesPage.hide();
|
||||
Main.overview.viewSelector._workspacesPage.destroy();
|
||||
workspacesDisplay.actor = null;
|
||||
|
||||
workspacesDisplay = new WorkspacesView.WorkspacesDisplay34();
|
||||
Main.overview.viewSelector._workspacesDisplay = workspacesDisplay;
|
||||
Main.overview.viewSelector._workspacesPage = Main.overview.viewSelector._addPage(workspacesDisplay.actor,
|
||||
_("Windows"), 'focus-windows-symbolic');
|
||||
}
|
||||
else {
|
||||
let workspacesDisplay = Main.overview.viewSelector._workspacesDisplay;
|
||||
workspacesDisplay.hide();
|
||||
workspacesDisplay._swipeTracker = null;
|
||||
workspacesDisplay.destroy();
|
||||
Main.overview.viewSelector._workspacesPage.hide();
|
||||
Main.overview.viewSelector._workspacesPage.destroy();
|
||||
|
||||
let workspaceAdjustment = Main.overview._overview._controls._workspaceAdjustment;
|
||||
workspacesDisplay = new WorkspacesView.WorkspacesDisplay(workspaceAdjustment);
|
||||
Main.overview.viewSelector._workspacesDisplay = workspacesDisplay;
|
||||
Main.overview.viewSelector._workspacesPage = Main.overview.viewSelector._addPage(workspacesDisplay,
|
||||
_("Windows"), 'focus-windows-symbolic');
|
||||
}
|
||||
}
|
||||
|
||||
for (let i = 0; i < Main.mmOverview.length; i++) {
|
||||
@@ -240,9 +273,10 @@ let version = null;
|
||||
|
||||
function init(extensionMeta) {
|
||||
Convenience.initTranslations();
|
||||
let theme = imports.gi.Gtk.IconTheme.get_default();
|
||||
theme.append_search_path(extensionMeta.path + "/icons");
|
||||
|
||||
if (gnomeShellVersion()[1]<36) {
|
||||
let theme = imports.gi.Gtk.IconTheme.get_default();
|
||||
theme.append_search_path(extensionMeta.path + "/icons");
|
||||
}
|
||||
// fix bug in panel: Destroy function many time added to this same indicator.
|
||||
Main.panel._ensureIndicator = function(role) {
|
||||
let indicator = this.statusArea[role];
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
{
|
||||
"shell-version": ["3.32", "3.34"],
|
||||
"shell-version": ["3.32", "3.34", "3.36"],
|
||||
"uuid": "multi-monitors-add-on@spin83",
|
||||
"name": "Multi Monitors Add-On",
|
||||
"settings-schema": "org.gnome.shell.extensions.multi-monitors-add-on",
|
||||
"gettext-domain": "multi-monitors-add-on",
|
||||
"description": "Add multiple monitors overview and panel for gnome-shell.",
|
||||
"url": "https://github.com/spin83/multi-monitors-add-on.git",
|
||||
"version": 19.1
|
||||
"version": 19.2
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ along with this program; if not, visit https://www.gnu.org/licenses/.
|
||||
|
||||
const Signals = imports.signals;
|
||||
|
||||
const { St, Gio, Shell, Clutter, GnomeDesktop, GObject } = imports.gi;
|
||||
const { St, Gio, Shell, Clutter, GnomeDesktop, GObject, GLib } = imports.gi;
|
||||
|
||||
const Main = imports.ui.main;
|
||||
const PanelMenu = imports.ui.panelMenu;
|
||||
@@ -30,7 +30,43 @@ const CE = ExtensionUtils.getCurrentExtension();
|
||||
const MultiMonitors = CE.imports.extension;
|
||||
const Convenience = CE.imports.convenience;
|
||||
|
||||
const MultiMonitorsCalendar = class MultiMonitorsCalendar {
|
||||
var MultiMonitorsCalendar = (() => {
|
||||
let MultiMonitorsCalendar = class MultiMonitorsCalendar extends St.Widget {
|
||||
_init () {
|
||||
this._weekStart = Shell.util_get_week_start();
|
||||
this._settings = new Gio.Settings({ schema_id: 'org.gnome.desktop.calendar' });
|
||||
|
||||
this._settings.connect('changed::%s'.format(Calendar.SHOW_WEEKDATE_KEY), this._onSettingsChange.bind(this));
|
||||
this._useWeekdate = this._settings.get_boolean(Calendar.SHOW_WEEKDATE_KEY);
|
||||
|
||||
this._headerFormatWithoutYear = _('%OB');
|
||||
this._headerFormat = _('%OB %Y');
|
||||
|
||||
// Start off with the current date
|
||||
this._selectedDate = new Date();
|
||||
|
||||
this._shouldDateGrabFocus = false;
|
||||
|
||||
super._init({
|
||||
style_class: 'calendar',
|
||||
layout_manager: new Clutter.GridLayout(),
|
||||
reactive: true,
|
||||
});
|
||||
|
||||
this._buildHeader();
|
||||
}
|
||||
|
||||
_onDestroy() {
|
||||
this._settings.disconnect(this._showWeekdateKeyId);
|
||||
}
|
||||
};
|
||||
MultiMonitors.copyClass(Calendar.Calendar, MultiMonitorsCalendar);
|
||||
return GObject.registerClass({
|
||||
Signals: { 'selected-date-changed': { param_types: [GLib.DateTime.$gtype] } },
|
||||
}, MultiMonitorsCalendar);
|
||||
})();
|
||||
|
||||
const MultiMonitorsCalendar34 = class MultiMonitorsCalendar34 {
|
||||
constructor() {
|
||||
this._weekStart = Shell.util_get_week_start();
|
||||
this._settings = new Gio.Settings({ schema_id: 'org.gnome.desktop.calendar' });
|
||||
@@ -61,10 +97,47 @@ const MultiMonitorsCalendar = class MultiMonitorsCalendar {
|
||||
this._settings.disconnect(this._showWeekdateKeyId);
|
||||
}
|
||||
};
|
||||
Signals.addSignalMethods(MultiMonitorsCalendar.prototype);
|
||||
MultiMonitors.copyClass(Calendar.Calendar, MultiMonitorsCalendar);
|
||||
Signals.addSignalMethods(MultiMonitorsCalendar34.prototype);
|
||||
MultiMonitors.copyClass(Calendar.Calendar, MultiMonitorsCalendar34);
|
||||
|
||||
const MultiMonitorsEventsSection = class MultiMonitorsEventsSection extends MessageList.MessageListSection {
|
||||
var MultiMonitorsEventsSection = (() => {
|
||||
let MultiMonitorsEventsSection = class MultiMonitorsEventsSection extends MessageList.MessageListSection {
|
||||
_init() {
|
||||
super._init();
|
||||
|
||||
this._desktopSettings = new Gio.Settings({ schema_id: 'org.gnome.desktop.interface' });
|
||||
this._reloadEventsId = this._desktopSettings.connect('changed', this._reloadEvents.bind(this));
|
||||
this._eventSource = new Calendar.EmptyEventSource();
|
||||
|
||||
this._messageById = new Map();
|
||||
|
||||
this._title = new St.Button({ style_class: 'events-section-title',
|
||||
label: '',
|
||||
can_focus: true });
|
||||
this._title.child.x_align = Clutter.ActorAlign.START;
|
||||
this.insert_child_below(this._title, null);
|
||||
|
||||
this._title.connect('clicked', this._onTitleClicked.bind(this));
|
||||
this._title.connect('key-focus-in', this._onKeyFocusIn.bind(this));
|
||||
|
||||
this._defaultAppSystem = Shell.AppSystem.get_default();
|
||||
this._appInstalledChangedId = this._defaultAppSystem.connect('installed-changed',
|
||||
this._appInstalledChanged.bind(this));
|
||||
|
||||
this.connect('destroy', this._onDestroy.bind(this));
|
||||
this._appInstalledChanged();
|
||||
}
|
||||
|
||||
_onDestroy() {
|
||||
this._desktopSettings.disconnect(this._reloadEventsId);
|
||||
this._defaultAppSystem.disconnect(this._appInstalledChangedId);
|
||||
}
|
||||
};
|
||||
MultiMonitors.copyClass(Calendar.EventsSection, MultiMonitorsEventsSection);
|
||||
return GObject.registerClass(MultiMonitorsEventsSection);
|
||||
})();
|
||||
|
||||
const MultiMonitorsEventsSection34 = class MultiMonitorsEventsSection34 extends MessageList.MessageListSection {
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
@@ -96,9 +169,37 @@ const MultiMonitorsEventsSection = class MultiMonitorsEventsSection extends Mess
|
||||
this._defaultAppSystem.disconnect(this._appInstalledChangedId);
|
||||
}
|
||||
};
|
||||
MultiMonitors.copyClass(Calendar.EventsSection, MultiMonitorsEventsSection);
|
||||
MultiMonitors.copyClass(Calendar.EventsSection, MultiMonitorsEventsSection34);
|
||||
|
||||
const MultiMonitorsNotificationSection = class MultiMonitorsNotificationSectione extends MessageList.MessageListSection {
|
||||
var MultiMonitorsNotificationSection = (() => {
|
||||
let MultiMonitorsNotificationSection = class MultiMonitorsNotificationSection extends MessageList.MessageListSection {
|
||||
_init() {
|
||||
super._init();
|
||||
|
||||
this._sources = new Map();
|
||||
this._nUrgent = 0;
|
||||
|
||||
this._sourceAddedId = Main.messageTray.connect('source-added', this._sourceAdded.bind(this));
|
||||
Main.messageTray.getSources().forEach(source => {
|
||||
this._sourceAdded(Main.messageTray, source);
|
||||
});
|
||||
|
||||
this.connect('destroy', this._onDestroy.bind(this));
|
||||
}
|
||||
|
||||
_onDestroy() {
|
||||
Main.messageTray.disconnect(this._sourceAddedId);
|
||||
let source, obj;
|
||||
for ([source, obj] of this._sources.entries()) {
|
||||
this._onSourceDestroy(source, obj);
|
||||
}
|
||||
}
|
||||
};
|
||||
MultiMonitors.copyClass(Calendar.NotificationSection, MultiMonitorsNotificationSection);
|
||||
return GObject.registerClass(MultiMonitorsNotificationSection);
|
||||
})();
|
||||
|
||||
const MultiMonitorsNotificationSection34 = class MultiMonitorsNotificationSectione34 extends MessageList.MessageListSection {
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
@@ -122,9 +223,102 @@ const MultiMonitorsNotificationSection = class MultiMonitorsNotificationSectione
|
||||
}
|
||||
}
|
||||
};
|
||||
MultiMonitors.copyClass(Calendar.NotificationSection, MultiMonitorsNotificationSection);
|
||||
MultiMonitors.copyClass(Calendar.NotificationSection, MultiMonitorsNotificationSection34);
|
||||
|
||||
const MultiMonitorsCalendarMessageList = class MultiMonitorsCalendarMessageList {
|
||||
var MultiMonitorsCalendarMessageList = (() => {
|
||||
let MultiMonitorsCalendarMessageList = class MultiMonitorsCalendarMessageList extends St.Widget {
|
||||
_init() {
|
||||
super._init({
|
||||
style_class: 'message-list',
|
||||
layout_manager: new Clutter.BinLayout(),
|
||||
x_expand: true,
|
||||
y_expand: true,
|
||||
});
|
||||
|
||||
this._sessionModeUpdatedId = 0;
|
||||
|
||||
this._placeholder = new Calendar.Placeholder();
|
||||
this.add_actor(this._placeholder);
|
||||
|
||||
let box = new St.BoxLayout({ vertical: true,
|
||||
x_expand: true, y_expand: true });
|
||||
this.add_actor(box);
|
||||
|
||||
this._scrollView = new St.ScrollView({
|
||||
style_class: 'vfade',
|
||||
overlay_scrollbars: true,
|
||||
x_expand: true, y_expand: true,
|
||||
});
|
||||
this._scrollView.set_policy(St.PolicyType.NEVER, St.PolicyType.AUTOMATIC);
|
||||
box.add_actor(this._scrollView);
|
||||
|
||||
let hbox = new St.BoxLayout({ style_class: 'message-list-controls' });
|
||||
box.add_child(hbox);
|
||||
|
||||
hbox.add_child(new St.Label({
|
||||
text: _('Do Not Disturb'),
|
||||
y_align: Clutter.ActorAlign.CENTER,
|
||||
}));
|
||||
|
||||
this._dndSwitch = new Calendar.DoNotDisturbSwitch();
|
||||
this._dndButton = new St.Button({
|
||||
can_focus: true,
|
||||
child: this._dndSwitch,
|
||||
});
|
||||
this._dndButton.connect('clicked', () => this._dndSwitch.toggle());
|
||||
hbox.add_child(this._dndButton);
|
||||
|
||||
this._clearButton = new St.Button({
|
||||
style_class: 'message-list-clear-button button',
|
||||
label: _('Clear'),
|
||||
can_focus: true,
|
||||
x_expand: true,
|
||||
x_align: Clutter.ActorAlign.END,
|
||||
});
|
||||
this._clearButton.connect('clicked', () => {
|
||||
this._sectionList.get_children().forEach(s => s.clear());
|
||||
});
|
||||
hbox.add_actor(this._clearButton);
|
||||
|
||||
this._placeholder.bind_property('visible',
|
||||
this._clearButton, 'visible',
|
||||
GObject.BindingFlags.INVERT_BOOLEAN);
|
||||
|
||||
this._sectionList = new St.BoxLayout({ style_class: 'message-list-sections',
|
||||
vertical: true,
|
||||
x_expand: true,
|
||||
y_expand: true,
|
||||
y_align: Clutter.ActorAlign.START });
|
||||
this._sectionList.connect('actor-added', this._sync.bind(this));
|
||||
this._sectionList.connect('actor-removed', this._sync.bind(this));
|
||||
this._scrollView.add_actor(this._sectionList);
|
||||
|
||||
this._notificationSection = new MultiMonitorsNotificationSection();
|
||||
this._addSection(this._notificationSection);
|
||||
|
||||
this._eventsSection = new MultiMonitorsEventsSection();
|
||||
this._addSection(this._eventsSection);
|
||||
|
||||
this._sessionModeUpdatedId = Main.sessionMode.connect('updated', this._sync.bind(this));
|
||||
this.connect('destroy', this._onDestroy.bind(this));
|
||||
}
|
||||
|
||||
_onDestroy(actor) {
|
||||
this._destroyed = true;
|
||||
Main.sessionMode.disconnect(this._sessionModeUpdatedId);
|
||||
this._sessionModeUpdatedId = 0;
|
||||
}
|
||||
|
||||
_sync() {
|
||||
if (this._sessionModeUpdatedId === 0) return;
|
||||
Calendar.CalendarMessageList.prototype._sync.call(this);
|
||||
}
|
||||
};
|
||||
MultiMonitors.copyClass(Calendar.CalendarMessageList, MultiMonitorsCalendarMessageList);
|
||||
return GObject.registerClass(MultiMonitorsCalendarMessageList);
|
||||
})();
|
||||
|
||||
const MultiMonitorsCalendarMessageList34 = class MultiMonitorsCalendarMessageList34 {
|
||||
constructor() {
|
||||
this.actor = new St.Widget({ style_class: 'message-list',
|
||||
layout_manager: new Clutter.BinLayout(),
|
||||
@@ -163,9 +357,9 @@ const MultiMonitorsCalendarMessageList = class MultiMonitorsCalendarMessageList
|
||||
|
||||
this._sessionModeUpdatedId = Main.sessionMode.connect('updated', this._sync.bind(this));
|
||||
|
||||
this._notificationSection = new MultiMonitorsNotificationSection();
|
||||
this._notificationSection = new MultiMonitorsNotificationSection34();
|
||||
this._addSection(this._notificationSection);
|
||||
this._eventsSection = new MultiMonitorsEventsSection();
|
||||
this._eventsSection = new MultiMonitorsEventsSection34();
|
||||
this._addSection(this._eventsSection);
|
||||
|
||||
this.actor.connect('destroy', this._onDestroy.bind(this));
|
||||
@@ -182,30 +376,55 @@ const MultiMonitorsCalendarMessageList = class MultiMonitorsCalendarMessageList
|
||||
Calendar.CalendarMessageList.prototype._sync.call(this);
|
||||
}
|
||||
};
|
||||
MultiMonitors.copyClass(Calendar.CalendarMessageList, MultiMonitorsCalendarMessageList);
|
||||
MultiMonitors.copyClass(Calendar.CalendarMessageList, MultiMonitorsCalendarMessageList34);
|
||||
|
||||
var MultiMonitorsDateMenuButton = (() => {
|
||||
let MultiMonitorsDateMenuButton = class MultiMonitorsDateMenuButton extends PanelMenu.Button {
|
||||
_init() {
|
||||
let hbox;
|
||||
let vbox;
|
||||
|
||||
let menuAlignment = 0.5;
|
||||
if (Clutter.get_default_text_direction() == Clutter.TextDirection.RTL)
|
||||
menuAlignment = 1.0 - menuAlignment;
|
||||
super._init(menuAlignment);
|
||||
|
||||
this._clockDisplay = new St.Label({ y_align: Clutter.ActorAlign.CENTER });
|
||||
// this._indicator = new DateMenu.MessagesIndicator();
|
||||
|
||||
let box = new St.BoxLayout();
|
||||
// box.add_actor(new DateMenu.IndicatorPad(this._indicator.actor));
|
||||
box.add_actor(this._clockDisplay);
|
||||
// box.add_actor(this._indicator.actor);
|
||||
|
||||
let box;
|
||||
if (MultiMonitors.gnomeShellVersion()[1]<36) {
|
||||
let menuAlignment = 0.5;
|
||||
if (Clutter.get_default_text_direction() == Clutter.TextDirection.RTL)
|
||||
menuAlignment = 1.0 - menuAlignment;
|
||||
super._init(menuAlignment);
|
||||
|
||||
this._clockDisplay = new St.Label({ y_align: Clutter.ActorAlign.CENTER });
|
||||
// this._indicator = new DateMenu.MessagesIndicator();
|
||||
|
||||
box = new St.BoxLayout();
|
||||
// box.add_actor(new DateMenu.IndicatorPad(this._indicator.actor));
|
||||
box.add_actor(this._clockDisplay);
|
||||
// box.add_actor(this._indicator.actor);
|
||||
}
|
||||
else {
|
||||
super._init(0.5);
|
||||
|
||||
this._clockDisplay = new St.Label({ style_class: 'clock' });
|
||||
this._clockDisplay.clutter_text.y_align = Clutter.ActorAlign.CENTER;
|
||||
|
||||
this._indicator = new DateMenu.MessagesIndicator();
|
||||
|
||||
const indicatorPad = new St.Widget();
|
||||
this._indicator.bind_property('visible',
|
||||
indicatorPad, 'visible',
|
||||
GObject.BindingFlags.SYNC_CREATE);
|
||||
indicatorPad.add_constraint(new Clutter.BindConstraint({
|
||||
source: this._indicator,
|
||||
coordinate: Clutter.BindCoordinate.SIZE,
|
||||
}));
|
||||
|
||||
box = new St.BoxLayout({ style_class: 'clock-display-box' });
|
||||
box.add_actor(indicatorPad);
|
||||
box.add_actor(this._clockDisplay);
|
||||
box.add_actor(this._indicator);
|
||||
}
|
||||
|
||||
this.label_actor = this._clockDisplay;
|
||||
this.add_actor(box);
|
||||
this.add_style_class_name ('clock-display');
|
||||
this.add_style_class_name('clock-display');
|
||||
|
||||
let layout = new DateMenu.FreezableBinLayout();
|
||||
let bin = new St.Widget({ layout_manager: layout });
|
||||
@@ -217,12 +436,22 @@ var MultiMonitorsDateMenuButton = (() => {
|
||||
|
||||
hbox = new St.BoxLayout({ name: 'calendarArea' });
|
||||
bin.add_actor(hbox);
|
||||
this._calendar = new MultiMonitorsCalendar();
|
||||
this._calendar.connect('selected-date-changed',
|
||||
(calendar, date) => {
|
||||
layout.frozen = !DateMenu._isToday(date);
|
||||
this._messageList.setDate(date);
|
||||
});
|
||||
if (MultiMonitors.gnomeShellVersion()[1]<36) {
|
||||
this._calendar = new MultiMonitorsCalendar34();
|
||||
this._calendar.connect('selected-date-changed',
|
||||
(calendar, date) => {
|
||||
layout.frozen = !DateMenu._isToday(date);
|
||||
this._messageList.setDate(date);
|
||||
});
|
||||
}
|
||||
else {
|
||||
this._calendar = new MultiMonitorsCalendar();
|
||||
this._calendar.connect('selected-date-changed', (_calendar, datetime) => {
|
||||
let date = DateMenu._gDateTimeToDate(datetime);
|
||||
layout.frozen = !DateMenu._isToday(date);
|
||||
this._messageList.setDate(date);
|
||||
});
|
||||
}
|
||||
|
||||
this.menu.connect('open-state-changed', (menu, isOpen) => {
|
||||
// Whenever the menu is opened, select today
|
||||
@@ -234,21 +463,38 @@ var MultiMonitorsDateMenuButton = (() => {
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// Fill up the first column
|
||||
this._messageList = new MultiMonitorsCalendarMessageList();
|
||||
hbox.add(this._messageList.actor, { expand: true, y_fill: false, y_align: St.Align.START });
|
||||
let calendar_actor;
|
||||
if (MultiMonitors.gnomeShellVersion()[1]<36) {
|
||||
this._messageList = new MultiMonitorsCalendarMessageList34();
|
||||
hbox.add(this._messageList.actor, { expand: true, y_fill: false, y_align: St.Align.START });
|
||||
calendar_actor = this._calendar.actor;
|
||||
}
|
||||
else {
|
||||
this._messageList = new MultiMonitorsCalendarMessageList();
|
||||
hbox.add_child(this._messageList);
|
||||
calendar_actor = this._calendar;
|
||||
}
|
||||
|
||||
// Fill up the second column
|
||||
let boxLayout = new DateMenu.CalendarColumnLayout(this._calendar.actor);
|
||||
let boxLayout = new DateMenu.CalendarColumnLayout(calendar_actor);
|
||||
vbox = new St.Widget({ style_class: 'datemenu-calendar-column',
|
||||
layout_manager: boxLayout });
|
||||
boxLayout.hookup_style(vbox);
|
||||
hbox.add(vbox);
|
||||
|
||||
this._date = new DateMenu.TodayButton(this._calendar);
|
||||
vbox.add_actor(this._date.actor);
|
||||
|
||||
vbox.add_actor(this._calendar.actor);
|
||||
if (MultiMonitors.gnomeShellVersion()[1]<36) {
|
||||
vbox.add_actor(this._date.actor);
|
||||
|
||||
vbox.add_actor(this._calendar.actor);
|
||||
}
|
||||
else {
|
||||
vbox.add_actor(this._date);
|
||||
|
||||
vbox.add_actor(this._calendar);
|
||||
}
|
||||
|
||||
this._displaysSection = {};
|
||||
|
||||
|
||||
@@ -135,7 +135,7 @@ var MultiMonitorsWorkspaceThumbnail = (() => {
|
||||
|
||||
const MultiMonitorsThumbnailsBox = (() => {
|
||||
let MultiMonitorsThumbnailsBox = class MultiMonitorsThumbnailsBox extends St.Widget {
|
||||
_init(monitorIndex) {
|
||||
_init(monitorIndex, scrollAdjustment) {
|
||||
this._monitorIndex = monitorIndex;
|
||||
|
||||
if (MultiMonitors.gnomeShellVersion()[1]==32) {
|
||||
@@ -179,9 +179,11 @@ const MultiMonitorsThumbnailsBox = (() => {
|
||||
|
||||
this._thumbnails = [];
|
||||
|
||||
this.connect('button-press-event', () => Clutter.EVENT_STOP);
|
||||
this.connect('button-release-event', this._onButtonRelease.bind(this));
|
||||
this.connect('touch-event', this._onTouchEvent.bind(this));
|
||||
if (MultiMonitors.gnomeShellVersion()[1]<36) {
|
||||
this.connect('button-press-event', () => Clutter.EVENT_STOP);
|
||||
this.connect('button-release-event', this._onButtonRelease.bind(this));
|
||||
this.connect('touch-event', this._onTouchEvent.bind(this));
|
||||
}
|
||||
|
||||
this._showingId = Main.overview.connect('showing',
|
||||
this._createThumbnails.bind(this));
|
||||
@@ -215,9 +217,25 @@ const MultiMonitorsThumbnailsBox = (() => {
|
||||
this._updatePorthole.bind(this));
|
||||
|
||||
this._switchWorkspaceNotifyId = 0;
|
||||
this._nWorkspacesNotifyId = 0;
|
||||
this._syncStackingId = 0;
|
||||
this._workareasChangedId = 0;
|
||||
|
||||
if (MultiMonitors.gnomeShellVersion()[1]>=36)
|
||||
{
|
||||
this._scrollAdjustment = scrollAdjustment;
|
||||
|
||||
this._scrollAdjustment.connect('notify::value', adj => {
|
||||
let workspaceManager = global.workspace_manager;
|
||||
let activeIndex = workspaceManager.get_active_workspace_index();
|
||||
|
||||
this._animatingIndicator = adj.value !== activeIndex;
|
||||
|
||||
if (!this._animatingIndicator)
|
||||
this._queueUpdateStates();
|
||||
|
||||
this.queue_relayout();
|
||||
});
|
||||
}
|
||||
|
||||
this.connect('destroy', this._onDestroy.bind(this));
|
||||
}
|
||||
@@ -271,7 +289,10 @@ const MultiMonitorsThumbnailsBox = (() => {
|
||||
this._queueUpdateStates();
|
||||
|
||||
// The thumbnails indicator actually needs to be on top of the thumbnails
|
||||
this._indicator.raise_top();
|
||||
if (MultiMonitors.gnomeShellVersion()[1]<36)
|
||||
this._indicator.raise_top();
|
||||
else
|
||||
this.set_child_above_sibling(this._indicator, null);
|
||||
|
||||
// Clear the splice index, we got the message
|
||||
this._spliceIndex = -1;
|
||||
@@ -296,7 +317,52 @@ const MultiMonitorsThumbnailsBox = (() => {
|
||||
}}, MultiMonitorsThumbnailsBox);
|
||||
})();
|
||||
|
||||
const MultiMonitorsSlidingControl = class MultiMonitorsSlidingControl {
|
||||
var MultiMonitorsSlidingControl = (() => {
|
||||
let MultiMonitorsSlidingControl = class MultiMonitorsSlidingControl extends St.Widget {
|
||||
_init(params) {
|
||||
params = Params.parse(params, { slideDirection: OverviewControls.SlideDirection.LEFT });
|
||||
|
||||
this.layout = new OverviewControls.SlideLayout();
|
||||
this.layout.slideDirection = params.slideDirection;
|
||||
super._init({
|
||||
layout_manager: this.layout,
|
||||
style_class: 'overview-controls',
|
||||
clip_to_allocation: true,
|
||||
});
|
||||
|
||||
this._visible = true;
|
||||
this._inDrag = false;
|
||||
|
||||
this.connect('destroy', this._onDestroy.bind(this));
|
||||
|
||||
this._hidingId = Main.overview.connect('hiding', this._onOverviewHiding.bind(this));
|
||||
|
||||
this._itemDragBeginId = Main.overview.connect('item-drag-begin', this._onDragBegin.bind(this));
|
||||
this._itemDragEndId = Main.overview.connect('item-drag-end', this._onDragEnd.bind(this));
|
||||
this._itemDragCancelledId = Main.overview.connect('item-drag-cancelled', this._onDragEnd.bind(this));
|
||||
|
||||
this._windowDragBeginId = Main.overview.connect('window-drag-begin', this._onWindowDragBegin.bind(this));
|
||||
this._windowDragCancelledId = Main.overview.connect('window-drag-cancelled', this._onWindowDragEnd.bind(this));
|
||||
this._windowDragEndId = Main.overview.connect('window-drag-end', this._onWindowDragEnd.bind(this));
|
||||
}
|
||||
|
||||
_onDestroy() {
|
||||
Main.overview.disconnect(this._hidingId);
|
||||
|
||||
Main.overview.disconnect(this._itemDragBeginId);
|
||||
Main.overview.disconnect(this._itemDragEndId);
|
||||
Main.overview.disconnect(this._itemDragCancelledId);
|
||||
|
||||
Main.overview.disconnect(this._windowDragBeginId);
|
||||
Main.overview.disconnect(this._windowDragCancelledId);
|
||||
Main.overview.disconnect(this._windowDragEndId);
|
||||
}
|
||||
};
|
||||
MultiMonitors.copyClass(OverviewControls.SlidingControl, MultiMonitorsSlidingControl);
|
||||
return GObject.registerClass(MultiMonitorsSlidingControl);
|
||||
})();
|
||||
|
||||
const MultiMonitorsSlidingControl34 = class MultiMonitorsSlidingControl34 {
|
||||
constructor (params) {
|
||||
params = Params.parse(params, { slideDirection: OverviewControls.SlideDirection.LEFT });
|
||||
|
||||
@@ -338,9 +404,41 @@ const MultiMonitorsSlidingControl = class MultiMonitorsSlidingControl {
|
||||
Main.overview.disconnect(this._windowDragEndId);
|
||||
}
|
||||
};
|
||||
MultiMonitors.copyClass(OverviewControls.SlidingControl, MultiMonitorsSlidingControl);
|
||||
MultiMonitors.copyClass(OverviewControls.SlidingControl, MultiMonitorsSlidingControl34);
|
||||
|
||||
const MultiMonitorsThumbnailsSlider = class MultiMonitorsThumbnailsSlider extends MultiMonitorsSlidingControl {
|
||||
var MultiMonitorsThumbnailsSlider = (() => {
|
||||
let MultiMonitorsThumbnailsSlider = class MultiMonitorsThumbnailsSlider extends MultiMonitorsSlidingControl {
|
||||
_init(thumbnailsBox) {
|
||||
super._init({ slideDirection: OverviewControls.SlideDirection.RIGHT });
|
||||
|
||||
this._thumbnailsBox = thumbnailsBox;
|
||||
|
||||
this.request_mode = Clutter.RequestMode.WIDTH_FOR_HEIGHT;
|
||||
this.reactive = true;
|
||||
this.track_hover = true;
|
||||
this.add_actor(this._thumbnailsBox);
|
||||
|
||||
this._monitorsChangedId = Main.layoutManager.connect('monitors-changed', this._updateSlide.bind(this));
|
||||
this._activeWorkspaceChangedId = global.workspace_manager.connect('active-workspace-changed',
|
||||
this._updateSlide.bind(this));
|
||||
this._notifyNWorkspacesId = global.workspace_manager.connect('notify::n-workspaces',
|
||||
this._updateSlide.bind(this));
|
||||
this.connect('notify::hover', this._updateSlide.bind(this));
|
||||
this._thumbnailsBox.bind_property('visible', this, 'visible', GObject.BindingFlags.SYNC_CREATE);
|
||||
}
|
||||
|
||||
_onDestroy() {
|
||||
global.workspace_manager.disconnect(this._activeWorkspaceChangedId);
|
||||
global.workspace_manager.disconnect(this._notifyNWorkspacesId);
|
||||
Main.layoutManager.disconnect(this._monitorsChangedId);
|
||||
super._onDestroy();
|
||||
}
|
||||
};
|
||||
MultiMonitors.copyClass(OverviewControls.ThumbnailsSlider, MultiMonitorsThumbnailsSlider);
|
||||
return GObject.registerClass(MultiMonitorsThumbnailsSlider);
|
||||
})();
|
||||
|
||||
const MultiMonitorsThumbnailsSlider34 = class MultiMonitorsThumbnailsSlider34 extends MultiMonitorsSlidingControl34 {
|
||||
constructor(thumbnailsBox) {
|
||||
super({ slideDirection: OverviewControls.SlideDirection.RIGHT });
|
||||
|
||||
@@ -367,7 +465,7 @@ const MultiMonitorsThumbnailsSlider = class MultiMonitorsThumbnailsSlider extend
|
||||
super._onDestroy();
|
||||
}
|
||||
};
|
||||
MultiMonitors.copyClass(OverviewControls.ThumbnailsSlider, MultiMonitorsThumbnailsSlider);
|
||||
MultiMonitors.copyClass(OverviewControls.ThumbnailsSlider, MultiMonitorsThumbnailsSlider34);
|
||||
|
||||
const MultiMonitorsControlsManager = class MultiMonitorsControlsManager {
|
||||
constructor(index) {
|
||||
@@ -377,8 +475,20 @@ const MultiMonitorsControlsManager = class MultiMonitorsControlsManager {
|
||||
this._fullGeometry = null;
|
||||
this._animationInProgress = false;
|
||||
|
||||
this._thumbnailsBox = new MultiMonitorsThumbnailsBox(this._monitorIndex);
|
||||
this._thumbnailsSlider = new MultiMonitorsThumbnailsSlider(this._thumbnailsBox);
|
||||
if (MultiMonitors.gnomeShellVersion()[1]<36)
|
||||
this._thumbnailsBox = new MultiMonitorsThumbnailsBox(this._monitorIndex, null);
|
||||
else {
|
||||
let workspaceManager = global.workspace_manager;
|
||||
let activeWorkspaceIndex = workspaceManager.get_active_workspace_index();
|
||||
|
||||
this._workspaceAdjustment = Main.overview._overview._controls._workspaceAdjustment;
|
||||
this._thumbnailsBox = new MultiMonitorsThumbnailsBox(this._monitorIndex, this._workspaceAdjustment);
|
||||
}
|
||||
|
||||
if (MultiMonitors.gnomeShellVersion()[1]<36)
|
||||
this._thumbnailsSlider = new MultiMonitorsThumbnailsSlider34(this._thumbnailsBox);
|
||||
else
|
||||
this._thumbnailsSlider = new MultiMonitorsThumbnailsSlider(this._thumbnailsBox);
|
||||
|
||||
this._thumbnailsSlider.onAnimationBegin = () => {
|
||||
this._animationInProgress = true;
|
||||
@@ -403,12 +513,17 @@ const MultiMonitorsControlsManager = class MultiMonitorsControlsManager {
|
||||
x_expand: true, y_expand: true });
|
||||
this.actor.add_actor(this._group);
|
||||
|
||||
this._viewActor = new St.Widget({ clip_to_allocation: true });
|
||||
|
||||
this._group.add(this._viewActor, { x_fill: true,
|
||||
expand: true });
|
||||
|
||||
this._group.add_actor(this._thumbnailsSlider.actor);
|
||||
if (MultiMonitors.gnomeShellVersion()[1]<36) {
|
||||
this._viewActor = new St.Widget({ clip_to_allocation: true });
|
||||
this._group.add(this._viewActor, { x_fill: true,
|
||||
expand: true });
|
||||
this._group.add_actor(this._thumbnailsSlider.actor);
|
||||
}
|
||||
else {
|
||||
this._viewActor = new St.Widget({ x_expand: true, y_expand: true, clip_to_allocation: true });
|
||||
this._group.add_actor(this._viewActor);
|
||||
this._group.add_actor(this._thumbnailsSlider);
|
||||
}
|
||||
|
||||
layout.connect('allocation-changed', this._updateWorkspacesGeometry.bind(this));
|
||||
this.actor.connect('scroll-event', this._onScrollEvent.bind(this));
|
||||
@@ -443,6 +558,18 @@ const MultiMonitorsControlsManager = class MultiMonitorsControlsManager {
|
||||
this.show();
|
||||
}
|
||||
}
|
||||
|
||||
/*_updateAdjustment() {
|
||||
let workspaceManager = global.workspace_manager;
|
||||
let newNumWorkspaces = workspaceManager.n_workspaces;
|
||||
let activeIndex = workspaceManager.get_active_workspace_index();
|
||||
|
||||
this._workspaceAdjustment.upper = newNumWorkspaces;
|
||||
|
||||
// A workspace might have been inserted or removed before the active
|
||||
// one, causing the adjustment to go out of sync, so update the value
|
||||
this._workspaceAdjustment.value = activeIndex;
|
||||
}*/
|
||||
|
||||
_onScrollEvent(actor, event) {
|
||||
if (!this.actor.mapped)
|
||||
@@ -470,28 +597,33 @@ const MultiMonitorsControlsManager = class MultiMonitorsControlsManager {
|
||||
Main.overview.viewSelector.disconnect(this._pageChangedId);
|
||||
Main.overview.viewSelector.disconnect(this._pageEmptyId);
|
||||
this._settings.disconnect(this._thumbnailsOnLeftSideId);
|
||||
|
||||
this._clickAction.disconnect(this._clickedId);
|
||||
Main.mmOverview[this._monitorIndex].removeAction(this._clickAction);
|
||||
}
|
||||
|
||||
_thumbnailsOnLeftSide() {
|
||||
if(this._settings.get_boolean(THUMBNAILS_ON_LEFT_SIDE_ID)){
|
||||
let thumbnailsSlider;
|
||||
if (MultiMonitors.gnomeShellVersion()[1]<36)
|
||||
thumbnailsSlider = this._thumbnailsSlider.actor;
|
||||
else
|
||||
thumbnailsSlider = this._thumbnailsSlider;
|
||||
|
||||
if (this._settings.get_boolean(THUMBNAILS_ON_LEFT_SIDE_ID)) {
|
||||
let first = this._group.get_first_child();
|
||||
if(first != this._thumbnailsSlider.actor){
|
||||
if (first != thumbnailsSlider) {
|
||||
this._thumbnailsSlider.layout.slideDirection = OverviewControls.SlideDirection.LEFT;
|
||||
this._thumbnailsBox.remove_style_class_name('workspace-thumbnails');
|
||||
this._thumbnailsBox.set_style_class_name('workspace-thumbnails workspace-thumbnails-left');
|
||||
this._group.set_child_below_sibling(this._thumbnailsSlider.actor, first)
|
||||
this._group.set_child_below_sibling(thumbnailsSlider, first)
|
||||
}
|
||||
}
|
||||
else{
|
||||
else {
|
||||
let last = this._group.get_last_child();
|
||||
if(last != this._thumbnailsSlider.actor){
|
||||
if (last != thumbnailsSlider) {
|
||||
this._thumbnailsSlider.layout.slideDirection = OverviewControls.SlideDirection.RIGHT;
|
||||
this._thumbnailsBox.remove_style_class_name('workspace-thumbnails workspace-thumbnails-left');
|
||||
this._thumbnailsBox.set_style_class_name('workspace-thumbnails');
|
||||
this._group.set_child_above_sibling(this._thumbnailsSlider.actor, last);
|
||||
this._group.set_child_above_sibling(thumbnailsSlider, last);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -506,7 +638,11 @@ const MultiMonitorsControlsManager = class MultiMonitorsControlsManager {
|
||||
if(Main.mmOverview[this._monitorIndex]._panelGhost)
|
||||
panelGhost_height = Main.mmOverview[this._monitorIndex]._panelGhost.get_height();
|
||||
|
||||
let allocation = Main.overview._controls.actor.allocation;
|
||||
let allocation;
|
||||
if (MultiMonitors.gnomeShellVersion()[1]<36)
|
||||
allocation = Main.overview._controls.actor.allocation;
|
||||
else
|
||||
allocation = Main.overview._overview._controls.allocation;
|
||||
let primaryControl_height = allocation.y2 - allocation.y1;
|
||||
let bottom_spacer_height = Main.layoutManager.primaryMonitor.height - allocation.y2;
|
||||
|
||||
@@ -599,20 +735,29 @@ const MultiMonitorsControlsManager = class MultiMonitorsControlsManager {
|
||||
if (!this._workspacesViews)
|
||||
return;
|
||||
|
||||
this._workspacesViews.actor.visible = opacity != 0;
|
||||
if (MultiMonitors.gnomeShellVersion()[1]==32) {
|
||||
this._workspacesViews.actor.visible = opacity != 0;
|
||||
Tweener.addTween((this._workspacesViews.actor, this._viewActor),
|
||||
{ opacity: opacity,
|
||||
time: OverviewControls.SIDE_CONTROLS_ANIMATION_TIME,
|
||||
transition: 'easeOutQuad'
|
||||
});
|
||||
}
|
||||
else {
|
||||
else if (MultiMonitors.gnomeShellVersion()[1]==34) {
|
||||
this._workspacesViews.actor.visible = opacity != 0;
|
||||
this._workspacesViews.actor.ease({
|
||||
opacity: opacity,
|
||||
mode: Clutter.AnimationMode.EASE_OUT_QUAD,
|
||||
duration: OverviewControls.SIDE_CONTROLS_ANIMATION_TIME
|
||||
});
|
||||
}
|
||||
else {
|
||||
this._workspacesViews.visible = opacity != 0;
|
||||
this._workspacesViews.ease({
|
||||
opacity: opacity,
|
||||
mode: Clutter.AnimationMode.EASE_OUT_QUAD,
|
||||
duration: OverviewControls.SIDE_CONTROLS_ANIMATION_TIME
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -625,10 +770,16 @@ const MultiMonitorsControlsManager = class MultiMonitorsControlsManager {
|
||||
}
|
||||
|
||||
hide() {
|
||||
if (this._workspacesViews && (!this._workspacesViews.actor.visible)) {
|
||||
this._workspacesViews.actor.opacity = 255;
|
||||
this._workspacesViews.actor.visible = true;
|
||||
}
|
||||
if (MultiMonitors.gnomeShellVersion()[1]<36)
|
||||
if (this._workspacesViews && (!this._workspacesViews.actor.visible)) {
|
||||
this._workspacesViews.actor.opacity = 255;
|
||||
this._workspacesViews.actor.visible = true;
|
||||
}
|
||||
else
|
||||
if (this._workspacesViews && (!this._workspacesViews.visible)) {
|
||||
this._workspacesViews.opacity = 255;
|
||||
this._workspacesViews.visible = true;
|
||||
}
|
||||
this._workspacesViews = null;
|
||||
}
|
||||
};
|
||||
@@ -669,7 +820,13 @@ var MultiMonitorsOverview = class MultiMonitorsOverview {
|
||||
this._spacer = new St.Widget();
|
||||
this._overview.add_actor(this._spacer);
|
||||
|
||||
this._overview.add(this._controls.actor, { y_fill: true, expand: true });
|
||||
if (MultiMonitors.gnomeShellVersion()[1]<36) {
|
||||
this._overview.add(this._controls.actor, { y_fill: true, expand: true });
|
||||
}
|
||||
else {
|
||||
this._overview.add_actor(this._controls.actor);
|
||||
}
|
||||
|
||||
this._controls.inOverviewInit();
|
||||
|
||||
this._showingId = Main.overview.connect('showing', this._show.bind(this));
|
||||
@@ -719,8 +876,185 @@ var MultiMonitorsOverview = class MultiMonitorsOverview {
|
||||
}
|
||||
};
|
||||
|
||||
var MultiMonitorsWorkspacesDisplay = (() => {
|
||||
let MultiMonitorsWorkspacesDisplay = class MultiMonitorsWorkspacesDisplay extends St.Widget {
|
||||
_init(scrollAdjustment) {
|
||||
super._init({ clip_to_allocation: true });
|
||||
this.connect('notify::allocation', this._updateWorkspacesActualGeometry.bind(this));
|
||||
|
||||
let workspaceManager = global.workspace_manager;
|
||||
this._scrollAdjustment = scrollAdjustment;
|
||||
|
||||
this._switchWorkspaceId =
|
||||
global.window_manager.connect('switch-workspace',
|
||||
this._activeWorkspaceChanged.bind(this));
|
||||
|
||||
this._reorderWorkspacesdId =
|
||||
workspaceManager.connect('workspaces-reordered',
|
||||
this._workspacesReordered.bind(this));
|
||||
|
||||
let clickAction = new Clutter.ClickAction();
|
||||
clickAction.connect('clicked', action => {
|
||||
// Only switch to the workspace when there's no application
|
||||
// windows open. The problem is that it's too easy to miss
|
||||
// an app window and get the wrong one focused.
|
||||
let event = Clutter.get_current_event();
|
||||
let index = this._getMonitorIndexForEvent(event);
|
||||
if ((action.get_button() == 1 || action.get_button() == 0) &&
|
||||
this._workspacesViews[index].getActiveWorkspace().isEmpty())
|
||||
Main.overview.hide();
|
||||
});
|
||||
Main.overview.addAction(clickAction);
|
||||
this.bind_property('mapped', clickAction, 'enabled', GObject.BindingFlags.SYNC_CREATE);
|
||||
this._clickAction = clickAction;
|
||||
|
||||
this._swipeTracker = new SwipeTracker.SwipeTracker(
|
||||
Main.layoutManager.overviewGroup, Shell.ActionMode.OVERVIEW);
|
||||
this._swipeTrackerBeginId = this._swipeTracker.connect('begin', this._switchWorkspaceBegin.bind(this));
|
||||
this._swipeTrackerUpdateId = this._swipeTracker.connect('update', this._switchWorkspaceUpdate.bind(this));
|
||||
this._swipeTrackerEndId = this._swipeTracker.connect('end', this._switchWorkspaceEnd.bind(this));
|
||||
this.connect('notify::mapped', this._updateSwipeTracker.bind(this));
|
||||
|
||||
this._windowDragBeginId =
|
||||
Main.overview.connect('window-drag-begin',
|
||||
this._windowDragBegin.bind(this));
|
||||
this._windowDragEndId =
|
||||
Main.overview.connect('window-drag-begin',
|
||||
this._windowDragEnd.bind(this));
|
||||
|
||||
this._primaryIndex = Main.layoutManager.primaryIndex;
|
||||
this._workspacesViews = [];
|
||||
|
||||
this._settings = new Gio.Settings({ schema_id: MUTTER_SCHEMA });
|
||||
this._settings.connect('changed::workspaces-only-on-primary',
|
||||
this._workspacesOnlyOnPrimaryChanged.bind(this));
|
||||
this._workspacesOnlyOnPrimaryChanged();
|
||||
|
||||
this._notifyOpacityId = 0;
|
||||
this._restackedNotifyId = 0;
|
||||
this._scrollEventId = 0;
|
||||
this._keyPressEventId = 0;
|
||||
this._scrollTimeoutId = 0;
|
||||
|
||||
this._fullGeometry = null;
|
||||
this._inWindowDrag = false;
|
||||
|
||||
this._gestureActive = false; // touch(pad) gestures
|
||||
this._canScroll = true; // limiting scrolling speed
|
||||
|
||||
this.connect('destroy', this._onDestroy.bind(this));
|
||||
}
|
||||
|
||||
var MultiMonitorsWorkspacesDisplay = class MultiMonitorsWorkspacesDisplay extends WorkspacesView.WorkspacesDisplay {
|
||||
_onDestroyMM() {
|
||||
|
||||
}
|
||||
|
||||
_workspacesOnlyOnPrimaryChanged() {
|
||||
this._workspacesOnlyOnPrimary = this._settings.get_boolean('workspaces-only-on-primary');
|
||||
|
||||
if (!Main.overview.visible)
|
||||
return;
|
||||
|
||||
if (!this._fullGeometry)
|
||||
return;
|
||||
|
||||
this._updateWorkspacesViews();
|
||||
}
|
||||
|
||||
_switchWorkspaceBegin(tracker, monitor) {
|
||||
if (this._workspacesOnlyOnPrimary && monitor !== this._primaryIndex)
|
||||
return;
|
||||
|
||||
let workspaceManager = global.workspace_manager;
|
||||
let adjustment = this._scrollAdjustment;
|
||||
if (this._gestureActive)
|
||||
adjustment.remove_transition('value');
|
||||
|
||||
tracker.orientation = workspaceManager.layout_rows !== -1
|
||||
? Clutter.Orientation.HORIZONTAL
|
||||
: Clutter.Orientation.VERTICAL;
|
||||
|
||||
for (let i = 0; i < this._workspacesViews.length; i++)
|
||||
this._workspacesViews[i].startTouchGesture();
|
||||
|
||||
let monitors = Main.layoutManager.monitors;
|
||||
let geometry;
|
||||
if (monitor == this._primaryIndex) {
|
||||
geometry = this._fullGeometry;
|
||||
}
|
||||
else if (Main.mmOverview && Main.mmOverview[monitor]) {
|
||||
geometry = Main.mmOverview[monitor].getWorkspacesFullGeometry();
|
||||
}
|
||||
else {
|
||||
geometry = monitors[monitor];
|
||||
}
|
||||
let distance = global.workspace_manager.layout_rows === -1
|
||||
? geometry.height : geometry.width;
|
||||
|
||||
let progress = adjustment.value / adjustment.page_size;
|
||||
let points = Array.from(
|
||||
{ length: workspaceManager.n_workspaces }, (v, i) => i);
|
||||
|
||||
tracker.confirmSwipe(distance, points, progress, Math.round(progress));
|
||||
|
||||
this._gestureActive = true;
|
||||
}
|
||||
|
||||
_updateWorkspacesFullGeometry() {
|
||||
if (this._workspacesViews.length!=Main.layoutManager.monitors.length)
|
||||
return;
|
||||
|
||||
let monitors = Main.layoutManager.monitors;
|
||||
for (let i = 0; i < monitors.length; i++) {
|
||||
let geometry;
|
||||
if (i == this._primaryIndex) {
|
||||
geometry = this._fullGeometry;
|
||||
}
|
||||
else if (Main.mmOverview && Main.mmOverview[i]) {
|
||||
geometry = Main.mmOverview[i].getWorkspacesFullGeometry();
|
||||
}
|
||||
else {
|
||||
geometry = monitors[i];
|
||||
}
|
||||
// global.log("fulllG i: "+i+" x: "+geometry.x+" y: "+geometry.y+" width: "+geometry.width+" height: "+geometry.height);
|
||||
this._workspacesViews[i].setFullGeometry(geometry);
|
||||
}
|
||||
}
|
||||
|
||||
_updateWorkspacesActualGeometry() {
|
||||
if (this._workspacesViews.length!=Main.layoutManager.monitors.length)
|
||||
return;
|
||||
|
||||
let [x, y] = this.get_transformed_position();
|
||||
let allocation = this.allocation;
|
||||
let width = allocation.x2 - allocation.x1;
|
||||
let height = allocation.y2 - allocation.y1;
|
||||
let primaryGeometry = { x: x, y: y, width: width, height: height };
|
||||
|
||||
let monitors = Main.layoutManager.monitors;
|
||||
for (let i = 0; i < monitors.length; i++) {
|
||||
let geometry;
|
||||
if (i == this._primaryIndex) {
|
||||
geometry = primaryGeometry;
|
||||
}
|
||||
else if (Main.mmOverview && Main.mmOverview[i]) {
|
||||
geometry = Main.mmOverview[i].getWorkspacesActualGeometry();
|
||||
}
|
||||
else {
|
||||
geometry = monitors[i];
|
||||
}
|
||||
if (geometry) {
|
||||
// global.log("actualG i: "+i+" x: "+geometry.x+" y: "+geometry.y+" width: "+geometry.width+" height: "+geometry.height);
|
||||
this._workspacesViews[i].setActualGeometry(geometry);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
MultiMonitors.copyClass(WorkspacesView.WorkspacesDisplay, MultiMonitorsWorkspacesDisplay);
|
||||
return GObject.registerClass(MultiMonitorsWorkspacesDisplay);
|
||||
})();
|
||||
|
||||
var MultiMonitorsWorkspacesDisplay34 = class MultiMonitorsWorkspacesDisplay34 extends WorkspacesView.WorkspacesDisplay {
|
||||
_workspacesOnlyOnPrimaryChanged() {
|
||||
this._workspacesOnlyOnPrimary = this._settings.get_boolean('workspaces-only-on-primary');
|
||||
|
||||
|
||||
@@ -336,8 +336,10 @@ var MultiMonitorsActivitiesButton = (() => {
|
||||
|
||||
this.label_actor = this._label;
|
||||
|
||||
this.connect('captured-event', this._onCapturedEvent.bind(this));
|
||||
this.connect_after('key-release-event', this._onKeyRelease.bind(this));
|
||||
if (MultiMonitors.gnomeShellVersion()[1]<36) {
|
||||
this.connect('captured-event', this._onCapturedEvent.bind(this));
|
||||
this.connect_after('key-release-event', this._onKeyRelease.bind(this));
|
||||
}
|
||||
|
||||
this._showingId = Main.overview.connect('showing', () => {
|
||||
this.add_style_pseudo_class('overview');
|
||||
@@ -394,14 +396,21 @@ var MultiMonitorsPanel = (() => {
|
||||
this.add_child(this._rightBox);
|
||||
|
||||
this._leftCorner = new Panel.PanelCorner(St.Side.LEFT);
|
||||
this.add_child(this._leftCorner.actor);
|
||||
if (MultiMonitors.gnomeShellVersion()[1]<36)
|
||||
this.add_child(this._leftCorner.actor);
|
||||
else
|
||||
this.add_child(this._leftCorner);
|
||||
|
||||
this._rightCorner = new Panel.PanelCorner(St.Side.RIGHT);
|
||||
this.add_child(this._rightCorner.actor);
|
||||
|
||||
this.connect('button-press-event', this._onButtonPress.bind(this));
|
||||
this.connect('touch-event', this._onButtonPress.bind(this));
|
||||
this.connect('key-press-event', this._onKeyPress.bind(this));
|
||||
if (MultiMonitors.gnomeShellVersion()[1]<36) {
|
||||
this.add_child(this._rightCorner.actor);
|
||||
|
||||
this.connect('button-press-event', this._onButtonPress.bind(this));
|
||||
this.connect('touch-event', this._onButtonPress.bind(this));
|
||||
this.connect('key-press-event', this._onKeyPress.bind(this));
|
||||
}
|
||||
else
|
||||
this.add_child(this._rightCorner);
|
||||
|
||||
this._showingId = Main.overview.connect('showing', () => {
|
||||
this.add_style_pseudo_class('overview');
|
||||
|
||||
Reference in New Issue
Block a user