2011-09-28 13:16:26 +00:00
|
|
|
|
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
|
2019-01-31 14:07:06 +00:00
|
|
|
|
/* exported WindowManager */
|
2008-11-21 14:02:09 +00:00
|
|
|
|
|
2019-02-09 03:21:36 +00:00
|
|
|
|
const { Clutter, Gio, GLib, GObject, Meta, Shell, St } = imports.gi;
|
2008-11-21 14:02:09 +00:00
|
|
|
|
|
2009-04-13 14:55:41 +00:00
|
|
|
|
const AltTab = imports.ui.altTab;
|
2019-01-29 10:48:06 +00:00
|
|
|
|
const AppFavorites = imports.ui.appFavorites;
|
2017-07-15 04:03:55 +00:00
|
|
|
|
const Dialog = imports.ui.dialog;
|
2010-02-12 22:52:15 +00:00
|
|
|
|
const WorkspaceSwitcherPopup = imports.ui.workspaceSwitcherPopup;
|
2017-07-14 01:15:17 +00:00
|
|
|
|
const InhibitShortcutsDialog = imports.ui.inhibitShortcutsDialog;
|
2008-11-21 14:02:09 +00:00
|
|
|
|
const Main = imports.ui.main;
|
2013-08-17 15:42:39 +00:00
|
|
|
|
const ModalDialog = imports.ui.modalDialog;
|
2014-03-13 22:51:10 +00:00
|
|
|
|
const WindowMenu = imports.ui.windowMenu;
|
2016-06-22 17:57:12 +00:00
|
|
|
|
const PadOsd = imports.ui.padOsd;
|
2017-02-26 22:48:25 +00:00
|
|
|
|
const EdgeDragAction = imports.ui.edgeDragAction;
|
2017-01-19 18:52:18 +00:00
|
|
|
|
const CloseDialog = imports.ui.closeDialog;
|
2017-06-08 14:49:20 +00:00
|
|
|
|
const SwitchMonitor = imports.ui.switchMonitor;
|
2019-08-15 11:29:53 +00:00
|
|
|
|
const IBusManager = imports.misc.ibusManager;
|
2019-07-02 17:28:47 +00:00
|
|
|
|
const WorkspaceAnimation = imports.ui.workspaceAnimation;
|
2008-11-21 14:02:09 +00:00
|
|
|
|
|
2018-09-06 00:55:20 +00:00
|
|
|
|
const { loadInterfaceXML } = imports.misc.fileUtils;
|
|
|
|
|
|
2018-06-18 14:38:46 +00:00
|
|
|
|
var SHELL_KEYBINDINGS_SCHEMA = 'org.gnome.shell.keybindings';
|
2019-08-01 23:13:10 +00:00
|
|
|
|
var MINIMIZE_WINDOW_ANIMATION_TIME = 200;
|
|
|
|
|
var SHOW_WINDOW_ANIMATION_TIME = 150;
|
|
|
|
|
var DIALOG_SHOW_WINDOW_ANIMATION_TIME = 100;
|
|
|
|
|
var DESTROY_WINDOW_ANIMATION_TIME = 150;
|
|
|
|
|
var DIALOG_DESTROY_WINDOW_ANIMATION_TIME = 100;
|
|
|
|
|
var WINDOW_ANIMATION_TIME = 250;
|
2021-01-29 19:22:52 +00:00
|
|
|
|
var SCROLL_TIMEOUT_TIME = 150;
|
2017-07-18 17:47:27 +00:00
|
|
|
|
var DIM_BRIGHTNESS = -0.3;
|
2019-08-01 23:13:10 +00:00
|
|
|
|
var DIM_TIME = 500;
|
|
|
|
|
var UNDIM_TIME = 250;
|
2019-08-20 00:20:08 +00:00
|
|
|
|
var APP_MOTION_THRESHOLD = 30;
|
2017-07-18 17:47:27 +00:00
|
|
|
|
|
|
|
|
|
var ONE_SECOND = 1000; // in ms
|
2013-08-17 15:42:39 +00:00
|
|
|
|
|
2021-02-16 18:37:38 +00:00
|
|
|
|
var MIN_NUM_WORKSPACES = 2;
|
|
|
|
|
|
2016-12-28 12:03:53 +00:00
|
|
|
|
const GSD_WACOM_BUS_NAME = 'org.gnome.SettingsDaemon.Wacom';
|
|
|
|
|
const GSD_WACOM_OBJECT_PATH = '/org/gnome/SettingsDaemon/Wacom';
|
|
|
|
|
|
2018-09-06 00:55:20 +00:00
|
|
|
|
const GsdWacomIface = loadInterfaceXML('org.gnome.SettingsDaemon.Wacom');
|
2016-12-28 12:03:53 +00:00
|
|
|
|
const GsdWacomProxy = Gio.DBusProxy.makeProxyWrapper(GsdWacomIface);
|
|
|
|
|
|
2019-08-28 19:56:53 +00:00
|
|
|
|
const WINDOW_DIMMER_EFFECT_NAME = "gnome-shell-window-dimmer";
|
|
|
|
|
|
2019-12-13 18:07:16 +00:00
|
|
|
|
Gio._promisify(Shell,
|
|
|
|
|
'util_start_systemd_unit', 'util_start_systemd_unit_finish');
|
|
|
|
|
Gio._promisify(Shell,
|
|
|
|
|
'util_stop_systemd_unit', 'util_stop_systemd_unit_finish');
|
|
|
|
|
|
2019-05-23 20:45:44 +00:00
|
|
|
|
var DisplayChangeDialog = GObject.registerClass(
|
|
|
|
|
class DisplayChangeDialog extends ModalDialog.ModalDialog {
|
|
|
|
|
_init(wm) {
|
2019-12-08 12:10:16 +00:00
|
|
|
|
super._init();
|
2013-08-17 15:42:39 +00:00
|
|
|
|
|
|
|
|
|
this._wm = wm;
|
|
|
|
|
|
2016-06-18 00:14:02 +00:00
|
|
|
|
this._countDown = Meta.MonitorManager.get_display_configuration_timeout();
|
2013-08-17 15:42:39 +00:00
|
|
|
|
|
2020-01-21 09:24:50 +00:00
|
|
|
|
// Translators: This string should be shorter than 30 characters
|
|
|
|
|
let title = _('Keep these display settings?');
|
2020-01-13 13:04:40 +00:00
|
|
|
|
let description = this._formatCountDown();
|
2013-08-17 15:42:39 +00:00
|
|
|
|
|
2019-12-08 12:10:16 +00:00
|
|
|
|
this._content = new Dialog.MessageDialogContent({ title, description });
|
2019-10-21 18:44:00 +00:00
|
|
|
|
this.contentLayout.add_child(this._content);
|
2013-08-17 15:42:39 +00:00
|
|
|
|
|
2019-05-15 19:32:29 +00:00
|
|
|
|
/* Translators: this and the following message should be limited in length,
|
2013-08-17 15:42:39 +00:00
|
|
|
|
to avoid ellipsizing the labels.
|
|
|
|
|
*/
|
|
|
|
|
this._cancelButton = this.addButton({ label: _("Revert Settings"),
|
2017-12-02 00:27:35 +00:00
|
|
|
|
action: this._onFailure.bind(this),
|
2019-11-05 19:37:28 +00:00
|
|
|
|
key: Clutter.KEY_Escape });
|
2019-01-29 01:27:05 +00:00
|
|
|
|
this._okButton = this.addButton({ label: _("Keep Changes"),
|
2017-12-02 00:27:35 +00:00
|
|
|
|
action: this._onSuccess.bind(this),
|
2015-07-29 11:45:11 +00:00
|
|
|
|
default: true });
|
2013-08-17 15:42:39 +00:00
|
|
|
|
|
2019-08-19 18:50:33 +00:00
|
|
|
|
this._timeoutId = GLib.timeout_add(GLib.PRIORITY_DEFAULT, ONE_SECOND, this._tick.bind(this));
|
2014-04-10 17:26:52 +00:00
|
|
|
|
GLib.Source.set_name_by_id(this._timeoutId, '[gnome-shell] this._tick');
|
2017-10-31 01:19:44 +00:00
|
|
|
|
}
|
2013-08-17 15:42:39 +00:00
|
|
|
|
|
2017-10-31 00:03:21 +00:00
|
|
|
|
close(timestamp) {
|
2013-08-17 15:42:39 +00:00
|
|
|
|
if (this._timeoutId > 0) {
|
2019-08-19 18:50:33 +00:00
|
|
|
|
GLib.source_remove(this._timeoutId);
|
2013-08-17 15:42:39 +00:00
|
|
|
|
this._timeoutId = 0;
|
|
|
|
|
}
|
|
|
|
|
|
2017-10-31 01:19:44 +00:00
|
|
|
|
super.close(timestamp);
|
|
|
|
|
}
|
2013-08-17 15:42:39 +00:00
|
|
|
|
|
2017-10-31 00:03:21 +00:00
|
|
|
|
_formatCountDown() {
|
2020-04-16 22:49:24 +00:00
|
|
|
|
const fmt = ngettext(
|
|
|
|
|
'Settings changes will revert in %d second',
|
|
|
|
|
'Settings changes will revert in %d seconds',
|
|
|
|
|
this._countDown);
|
2013-08-17 15:42:39 +00:00
|
|
|
|
return fmt.format(this._countDown);
|
2017-10-31 01:19:44 +00:00
|
|
|
|
}
|
2013-08-17 15:42:39 +00:00
|
|
|
|
|
2017-10-31 00:03:21 +00:00
|
|
|
|
_tick() {
|
2013-08-17 15:42:39 +00:00
|
|
|
|
this._countDown--;
|
|
|
|
|
|
|
|
|
|
if (this._countDown == 0) {
|
|
|
|
|
/* mutter already takes care of failing at timeout */
|
|
|
|
|
this._timeoutId = 0;
|
|
|
|
|
this.close();
|
2013-11-29 00:45:39 +00:00
|
|
|
|
return GLib.SOURCE_REMOVE;
|
2013-08-17 15:42:39 +00:00
|
|
|
|
}
|
|
|
|
|
|
2020-01-13 13:04:40 +00:00
|
|
|
|
this._content.description = this._formatCountDown();
|
2013-11-29 00:45:39 +00:00
|
|
|
|
return GLib.SOURCE_CONTINUE;
|
2017-10-31 01:19:44 +00:00
|
|
|
|
}
|
2013-08-17 15:42:39 +00:00
|
|
|
|
|
2017-10-31 00:03:21 +00:00
|
|
|
|
_onFailure() {
|
2013-08-17 15:42:39 +00:00
|
|
|
|
this._wm.complete_display_change(false);
|
|
|
|
|
this.close();
|
2017-10-31 01:19:44 +00:00
|
|
|
|
}
|
2013-08-17 15:42:39 +00:00
|
|
|
|
|
2017-10-31 00:03:21 +00:00
|
|
|
|
_onSuccess() {
|
2013-08-17 15:42:39 +00:00
|
|
|
|
this._wm.complete_display_change(true);
|
|
|
|
|
this.close();
|
2017-10-31 01:19:44 +00:00
|
|
|
|
}
|
2019-05-23 20:45:44 +00:00
|
|
|
|
});
|
2010-09-11 01:30:50 +00:00
|
|
|
|
|
2019-08-28 19:56:53 +00:00
|
|
|
|
var WindowDimmer = GObject.registerClass(
|
|
|
|
|
class WindowDimmer extends Clutter.BrightnessContrastEffect {
|
|
|
|
|
_init() {
|
|
|
|
|
super._init({
|
|
|
|
|
name: WINDOW_DIMMER_EFFECT_NAME,
|
2019-08-20 21:43:54 +00:00
|
|
|
|
enabled: false,
|
2018-07-22 01:31:54 +00:00
|
|
|
|
});
|
2012-08-30 19:32:44 +00:00
|
|
|
|
this._enabled = true;
|
2017-10-31 01:19:44 +00:00
|
|
|
|
}
|
2012-08-30 19:32:44 +00:00
|
|
|
|
|
2017-10-31 00:03:21 +00:00
|
|
|
|
_syncEnabled() {
|
2020-02-14 15:10:34 +00:00
|
|
|
|
let transitionName = '@effects.%s.brightness'.format(this.name);
|
|
|
|
|
let animating = this.actor.get_transition(transitionName) != null;
|
2019-08-28 19:56:53 +00:00
|
|
|
|
let dimmed = this.brightness.red != 127;
|
|
|
|
|
this.enabled = this._enabled && (animating || dimmed);
|
2017-10-31 01:19:44 +00:00
|
|
|
|
}
|
2010-09-11 01:30:50 +00:00
|
|
|
|
|
2017-10-31 00:03:21 +00:00
|
|
|
|
setEnabled(enabled) {
|
2012-08-30 19:32:44 +00:00
|
|
|
|
this._enabled = enabled;
|
|
|
|
|
this._syncEnabled();
|
2017-10-31 01:19:44 +00:00
|
|
|
|
}
|
2010-09-11 01:30:50 +00:00
|
|
|
|
|
2018-07-22 01:31:54 +00:00
|
|
|
|
setDimmed(dimmed, animate) {
|
2019-07-25 00:06:05 +00:00
|
|
|
|
let val = 127 * (1 + (dimmed ? 1 : 0) * DIM_BRIGHTNESS);
|
|
|
|
|
let color = Clutter.Color.new(val, val, val, 255);
|
|
|
|
|
|
2020-02-14 15:10:34 +00:00
|
|
|
|
let transitionName = '@effects.%s.brightness'.format(this.name);
|
|
|
|
|
this.actor.ease_property(transitionName, color, {
|
2019-07-25 00:06:05 +00:00
|
|
|
|
mode: Clutter.AnimationMode.LINEAR,
|
|
|
|
|
duration: (dimmed ? DIM_TIME : UNDIM_TIME) * (animate ? 1 : 0),
|
2019-08-20 21:43:54 +00:00
|
|
|
|
onComplete: () => this._syncEnabled(),
|
2019-07-25 00:06:05 +00:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
this._syncEnabled();
|
2012-07-13 17:57:36 +00:00
|
|
|
|
}
|
2019-08-28 19:56:53 +00:00
|
|
|
|
});
|
2010-09-11 01:30:50 +00:00
|
|
|
|
|
2011-09-20 18:21:45 +00:00
|
|
|
|
function getWindowDimmer(actor) {
|
2012-08-30 19:32:44 +00:00
|
|
|
|
let enabled = Meta.prefs_get_attach_modal_dialogs();
|
2019-08-28 19:56:53 +00:00
|
|
|
|
let effect = actor.get_effect(WINDOW_DIMMER_EFFECT_NAME);
|
|
|
|
|
|
|
|
|
|
if (effect) {
|
|
|
|
|
effect.setEnabled(enabled);
|
|
|
|
|
} else if (enabled) {
|
|
|
|
|
effect = new WindowDimmer();
|
|
|
|
|
actor.add_effect(effect);
|
2012-08-30 19:32:44 +00:00
|
|
|
|
}
|
2019-08-28 19:56:53 +00:00
|
|
|
|
return effect;
|
2010-09-11 01:30:50 +00:00
|
|
|
|
}
|
2008-11-21 21:34:10 +00:00
|
|
|
|
|
2012-12-23 03:10:27 +00:00
|
|
|
|
/*
|
|
|
|
|
* When the last window closed on a workspace is a dialog or splash
|
|
|
|
|
* screen, we assume that it might be an initial window shown before
|
|
|
|
|
* the main window of an application, and give the app a grace period
|
|
|
|
|
* where it can map another window before we remove the workspace.
|
|
|
|
|
*/
|
2017-07-18 17:47:27 +00:00
|
|
|
|
var LAST_WINDOW_GRACE_TIME = 1000;
|
2012-12-23 03:10:27 +00:00
|
|
|
|
|
2017-10-31 01:19:44 +00:00
|
|
|
|
var WorkspaceTracker = class {
|
|
|
|
|
constructor(wm) {
|
2012-12-23 03:10:27 +00:00
|
|
|
|
this._wm = wm;
|
|
|
|
|
|
|
|
|
|
this._workspaces = [];
|
|
|
|
|
this._checkWorkspacesId = 0;
|
|
|
|
|
|
2015-03-27 13:34:28 +00:00
|
|
|
|
this._pauseWorkspaceCheck = false;
|
|
|
|
|
|
2012-12-23 03:10:27 +00:00
|
|
|
|
let tracker = Shell.WindowTracker.get_default();
|
2017-12-02 00:27:35 +00:00
|
|
|
|
tracker.connect('startup-sequence-changed', this._queueCheckWorkspaces.bind(this));
|
2012-12-23 03:10:27 +00:00
|
|
|
|
|
2018-01-03 07:55:38 +00:00
|
|
|
|
let workspaceManager = global.workspace_manager;
|
|
|
|
|
workspaceManager.connect('notify::n-workspaces',
|
|
|
|
|
this._nWorkspacesChanged.bind(this));
|
2019-10-08 18:27:34 +00:00
|
|
|
|
workspaceManager.connect('workspaces-reordered', () => {
|
|
|
|
|
this._workspaces.sort((a, b) => a.index() - b.index());
|
|
|
|
|
});
|
2018-01-03 07:55:38 +00:00
|
|
|
|
global.window_manager.connect('switch-workspace',
|
|
|
|
|
this._queueCheckWorkspaces.bind(this));
|
|
|
|
|
|
|
|
|
|
global.display.connect('window-entered-monitor',
|
|
|
|
|
this._windowEnteredMonitor.bind(this));
|
|
|
|
|
global.display.connect('window-left-monitor',
|
|
|
|
|
this._windowLeftMonitor.bind(this));
|
2012-12-23 03:10:27 +00:00
|
|
|
|
|
2017-08-16 19:15:48 +00:00
|
|
|
|
this._workspaceSettings = new Gio.Settings({ schema_id: 'org.gnome.mutter' });
|
2017-12-02 00:27:35 +00:00
|
|
|
|
this._workspaceSettings.connect('changed::dynamic-workspaces', this._queueCheckWorkspaces.bind(this));
|
2012-12-23 03:10:27 +00:00
|
|
|
|
|
|
|
|
|
this._nWorkspacesChanged();
|
2017-10-31 01:19:44 +00:00
|
|
|
|
}
|
2012-12-23 03:10:27 +00:00
|
|
|
|
|
2017-10-31 00:03:21 +00:00
|
|
|
|
blockUpdates() {
|
2015-03-27 13:34:28 +00:00
|
|
|
|
this._pauseWorkspaceCheck = true;
|
2017-10-31 01:19:44 +00:00
|
|
|
|
}
|
2015-03-27 13:34:28 +00:00
|
|
|
|
|
2017-10-31 00:03:21 +00:00
|
|
|
|
unblockUpdates() {
|
2015-03-27 13:34:28 +00:00
|
|
|
|
this._pauseWorkspaceCheck = false;
|
2017-10-31 01:19:44 +00:00
|
|
|
|
}
|
2015-03-27 13:34:28 +00:00
|
|
|
|
|
2017-10-31 00:03:21 +00:00
|
|
|
|
_checkWorkspaces() {
|
2018-01-03 07:55:38 +00:00
|
|
|
|
let workspaceManager = global.workspace_manager;
|
2012-12-23 03:10:27 +00:00
|
|
|
|
let i;
|
|
|
|
|
let emptyWorkspaces = [];
|
|
|
|
|
|
|
|
|
|
if (!Meta.prefs_get_dynamic_workspaces()) {
|
|
|
|
|
this._checkWorkspacesId = 0;
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2015-03-27 13:34:28 +00:00
|
|
|
|
// Update workspaces only if Dynamic Workspace Management has not been paused by some other function
|
|
|
|
|
if (this._pauseWorkspaceCheck)
|
|
|
|
|
return true;
|
|
|
|
|
|
2012-12-23 03:10:27 +00:00
|
|
|
|
for (i = 0; i < this._workspaces.length; i++) {
|
|
|
|
|
let lastRemoved = this._workspaces[i]._lastRemovedWindow;
|
|
|
|
|
if ((lastRemoved &&
|
|
|
|
|
(lastRemoved.get_window_type() == Meta.WindowType.SPLASHSCREEN ||
|
|
|
|
|
lastRemoved.get_window_type() == Meta.WindowType.DIALOG ||
|
|
|
|
|
lastRemoved.get_window_type() == Meta.WindowType.MODAL_DIALOG)) ||
|
|
|
|
|
this._workspaces[i]._keepAliveId)
|
|
|
|
|
emptyWorkspaces[i] = false;
|
|
|
|
|
else
|
|
|
|
|
emptyWorkspaces[i] = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let sequences = Shell.WindowTracker.get_default().get_startup_sequences();
|
|
|
|
|
for (i = 0; i < sequences.length; i++) {
|
|
|
|
|
let index = sequences[i].get_workspace();
|
2018-01-03 07:55:38 +00:00
|
|
|
|
if (index >= 0 && index <= workspaceManager.n_workspaces)
|
2012-12-23 03:10:27 +00:00
|
|
|
|
emptyWorkspaces[index] = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let windows = global.get_window_actors();
|
|
|
|
|
for (i = 0; i < windows.length; i++) {
|
2013-11-05 02:24:27 +00:00
|
|
|
|
let actor = windows[i];
|
|
|
|
|
let win = actor.get_meta_window();
|
2012-12-23 03:10:27 +00:00
|
|
|
|
|
2013-11-05 02:24:27 +00:00
|
|
|
|
if (win.is_on_all_workspaces())
|
2012-12-23 03:10:27 +00:00
|
|
|
|
continue;
|
|
|
|
|
|
2013-11-05 02:24:27 +00:00
|
|
|
|
let workspaceIndex = win.get_workspace().index();
|
2012-12-23 03:10:27 +00:00
|
|
|
|
emptyWorkspaces[workspaceIndex] = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// If we don't have an empty workspace at the end, add one
|
2019-01-29 01:27:05 +00:00
|
|
|
|
if (!emptyWorkspaces[emptyWorkspaces.length - 1]) {
|
2018-01-03 07:55:38 +00:00
|
|
|
|
workspaceManager.append_new_workspace(false, global.get_current_time());
|
2018-09-05 13:27:02 +00:00
|
|
|
|
emptyWorkspaces.push(true);
|
2012-12-23 03:10:27 +00:00
|
|
|
|
}
|
|
|
|
|
|
2021-02-16 18:37:38 +00:00
|
|
|
|
// Enforce minimum number of workspaces
|
|
|
|
|
while (emptyWorkspaces.length < MIN_NUM_WORKSPACES) {
|
|
|
|
|
workspaceManager.append_new_workspace(false, global.get_current_time());
|
|
|
|
|
emptyWorkspaces.push(true);
|
|
|
|
|
}
|
|
|
|
|
|
2018-09-05 13:27:02 +00:00
|
|
|
|
let lastIndex = emptyWorkspaces.length - 1;
|
|
|
|
|
let lastEmptyIndex = emptyWorkspaces.lastIndexOf(false) + 1;
|
2018-01-03 07:55:38 +00:00
|
|
|
|
let activeWorkspaceIndex = workspaceManager.get_active_workspace_index();
|
2013-09-30 17:59:09 +00:00
|
|
|
|
emptyWorkspaces[activeWorkspaceIndex] = false;
|
2012-12-23 03:10:27 +00:00
|
|
|
|
|
2018-09-05 13:27:02 +00:00
|
|
|
|
// Delete empty workspaces except for the last one; do it from the end
|
|
|
|
|
// to avoid index changes
|
|
|
|
|
for (i = lastIndex; i >= 0; i--) {
|
2021-02-16 18:37:38 +00:00
|
|
|
|
if (workspaceManager.n_workspaces === MIN_NUM_WORKSPACES)
|
|
|
|
|
break;
|
2018-09-05 13:27:02 +00:00
|
|
|
|
if (emptyWorkspaces[i] && i != lastEmptyIndex)
|
2018-01-03 07:55:38 +00:00
|
|
|
|
workspaceManager.remove_workspace(this._workspaces[i], global.get_current_time());
|
2012-12-23 03:10:27 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this._checkWorkspacesId = 0;
|
|
|
|
|
return false;
|
2017-10-31 01:19:44 +00:00
|
|
|
|
}
|
2012-12-23 03:10:27 +00:00
|
|
|
|
|
2017-10-31 00:03:21 +00:00
|
|
|
|
keepWorkspaceAlive(workspace, duration) {
|
2012-12-23 03:10:27 +00:00
|
|
|
|
if (workspace._keepAliveId)
|
2019-08-19 18:50:33 +00:00
|
|
|
|
GLib.source_remove(workspace._keepAliveId);
|
2012-12-23 03:10:27 +00:00
|
|
|
|
|
2019-08-19 18:50:33 +00:00
|
|
|
|
workspace._keepAliveId = GLib.timeout_add(GLib.PRIORITY_DEFAULT, duration, () => {
|
2012-12-23 03:10:27 +00:00
|
|
|
|
workspace._keepAliveId = 0;
|
|
|
|
|
this._queueCheckWorkspaces();
|
2013-11-29 00:45:39 +00:00
|
|
|
|
return GLib.SOURCE_REMOVE;
|
2017-10-31 00:38:18 +00:00
|
|
|
|
});
|
2014-04-10 17:26:52 +00:00
|
|
|
|
GLib.Source.set_name_by_id(workspace._keepAliveId, '[gnome-shell] this._queueCheckWorkspaces');
|
2017-10-31 01:19:44 +00:00
|
|
|
|
}
|
2012-12-23 03:10:27 +00:00
|
|
|
|
|
2017-10-31 00:03:21 +00:00
|
|
|
|
_windowRemoved(workspace, window) {
|
2012-12-23 03:10:27 +00:00
|
|
|
|
workspace._lastRemovedWindow = window;
|
|
|
|
|
this._queueCheckWorkspaces();
|
2019-08-19 18:50:33 +00:00
|
|
|
|
let id = GLib.timeout_add(GLib.PRIORITY_DEFAULT, LAST_WINDOW_GRACE_TIME, () => {
|
2012-12-23 03:10:27 +00:00
|
|
|
|
if (workspace._lastRemovedWindow == window) {
|
|
|
|
|
workspace._lastRemovedWindow = null;
|
|
|
|
|
this._queueCheckWorkspaces();
|
|
|
|
|
}
|
2013-11-29 00:45:39 +00:00
|
|
|
|
return GLib.SOURCE_REMOVE;
|
2017-10-31 00:38:18 +00:00
|
|
|
|
});
|
2014-04-10 17:26:52 +00:00
|
|
|
|
GLib.Source.set_name_by_id(id, '[gnome-shell] this._queueCheckWorkspaces');
|
2017-10-31 01:19:44 +00:00
|
|
|
|
}
|
2012-12-23 03:10:27 +00:00
|
|
|
|
|
2019-01-31 14:08:10 +00:00
|
|
|
|
_windowLeftMonitor(metaDisplay, monitorIndex, _metaWin) {
|
2012-12-23 03:10:27 +00:00
|
|
|
|
// If the window left the primary monitor, that
|
|
|
|
|
// might make that workspace empty
|
|
|
|
|
if (monitorIndex == Main.layoutManager.primaryIndex)
|
|
|
|
|
this._queueCheckWorkspaces();
|
2017-10-31 01:19:44 +00:00
|
|
|
|
}
|
2012-12-23 03:10:27 +00:00
|
|
|
|
|
2019-01-31 14:08:10 +00:00
|
|
|
|
_windowEnteredMonitor(metaDisplay, monitorIndex, _metaWin) {
|
2012-12-23 03:10:27 +00:00
|
|
|
|
// If the window entered the primary monitor, that
|
|
|
|
|
// might make that workspace non-empty
|
|
|
|
|
if (monitorIndex == Main.layoutManager.primaryIndex)
|
|
|
|
|
this._queueCheckWorkspaces();
|
2017-10-31 01:19:44 +00:00
|
|
|
|
}
|
2012-12-23 03:10:27 +00:00
|
|
|
|
|
2017-10-31 00:03:21 +00:00
|
|
|
|
_queueCheckWorkspaces() {
|
2012-12-23 03:10:27 +00:00
|
|
|
|
if (this._checkWorkspacesId == 0)
|
2017-12-02 00:27:35 +00:00
|
|
|
|
this._checkWorkspacesId = Meta.later_add(Meta.LaterType.BEFORE_REDRAW, this._checkWorkspaces.bind(this));
|
2017-10-31 01:19:44 +00:00
|
|
|
|
}
|
2012-12-23 03:10:27 +00:00
|
|
|
|
|
2017-10-31 00:03:21 +00:00
|
|
|
|
_nWorkspacesChanged() {
|
2018-01-03 07:55:38 +00:00
|
|
|
|
let workspaceManager = global.workspace_manager;
|
2012-12-23 03:10:27 +00:00
|
|
|
|
let oldNumWorkspaces = this._workspaces.length;
|
2018-01-03 07:55:38 +00:00
|
|
|
|
let newNumWorkspaces = workspaceManager.n_workspaces;
|
2012-12-23 03:10:27 +00:00
|
|
|
|
|
|
|
|
|
if (oldNumWorkspaces == newNumWorkspaces)
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
if (newNumWorkspaces > oldNumWorkspaces) {
|
|
|
|
|
let w;
|
|
|
|
|
|
|
|
|
|
// Assume workspaces are only added at the end
|
|
|
|
|
for (w = oldNumWorkspaces; w < newNumWorkspaces; w++)
|
2018-01-03 07:55:38 +00:00
|
|
|
|
this._workspaces[w] = workspaceManager.get_workspace_by_index(w);
|
2012-12-23 03:10:27 +00:00
|
|
|
|
|
|
|
|
|
for (w = oldNumWorkspaces; w < newNumWorkspaces; w++) {
|
|
|
|
|
let workspace = this._workspaces[w];
|
2017-12-02 00:27:35 +00:00
|
|
|
|
workspace._windowAddedId = workspace.connect('window-added', this._queueCheckWorkspaces.bind(this));
|
|
|
|
|
workspace._windowRemovedId = workspace.connect('window-removed', this._windowRemoved.bind(this));
|
2012-12-23 03:10:27 +00:00
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
// Assume workspaces are only removed sequentially
|
|
|
|
|
// (e.g. 2,3,4 - not 2,4,7)
|
|
|
|
|
let removedIndex;
|
|
|
|
|
let removedNum = oldNumWorkspaces - newNumWorkspaces;
|
|
|
|
|
for (let w = 0; w < oldNumWorkspaces; w++) {
|
2018-01-03 07:55:38 +00:00
|
|
|
|
let workspace = workspaceManager.get_workspace_by_index(w);
|
2012-12-23 03:10:27 +00:00
|
|
|
|
if (this._workspaces[w] != workspace) {
|
|
|
|
|
removedIndex = w;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let lostWorkspaces = this._workspaces.splice(removedIndex, removedNum);
|
2017-10-31 00:38:18 +00:00
|
|
|
|
lostWorkspaces.forEach(workspace => {
|
2012-12-23 03:10:27 +00:00
|
|
|
|
workspace.disconnect(workspace._windowAddedId);
|
|
|
|
|
workspace.disconnect(workspace._windowRemovedId);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this._queueCheckWorkspaces();
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2017-10-31 01:19:44 +00:00
|
|
|
|
};
|
2012-12-23 03:10:27 +00:00
|
|
|
|
|
2019-07-16 09:24:13 +00:00
|
|
|
|
var TilePreview = GObject.registerClass(
|
|
|
|
|
class TilePreview extends St.Widget {
|
|
|
|
|
_init() {
|
|
|
|
|
super._init();
|
|
|
|
|
global.window_group.add_actor(this);
|
2013-09-01 22:26:12 +00:00
|
|
|
|
|
2013-09-02 00:17:58 +00:00
|
|
|
|
this._reset();
|
2013-09-01 22:26:12 +00:00
|
|
|
|
this._showing = false;
|
2017-10-31 01:19:44 +00:00
|
|
|
|
}
|
2013-09-01 22:26:12 +00:00
|
|
|
|
|
2019-08-28 20:06:14 +00:00
|
|
|
|
open(window, tileRect, monitorIndex) {
|
2013-09-01 22:26:12 +00:00
|
|
|
|
let windowActor = window.get_compositor_private();
|
|
|
|
|
if (!windowActor)
|
|
|
|
|
return;
|
|
|
|
|
|
2019-07-16 09:24:13 +00:00
|
|
|
|
global.window_group.set_child_below_sibling(this, windowActor);
|
2013-09-01 22:26:12 +00:00
|
|
|
|
|
2013-09-02 00:17:58 +00:00
|
|
|
|
if (this._rect && this._rect.equal(tileRect))
|
|
|
|
|
return;
|
|
|
|
|
|
2019-08-19 19:38:51 +00:00
|
|
|
|
let changeMonitor = this._monitorIndex == -1 ||
|
|
|
|
|
this._monitorIndex != monitorIndex;
|
2013-09-02 00:17:58 +00:00
|
|
|
|
|
|
|
|
|
this._monitorIndex = monitorIndex;
|
|
|
|
|
this._rect = tileRect;
|
2013-09-01 22:26:12 +00:00
|
|
|
|
|
2013-09-02 00:17:58 +00:00
|
|
|
|
let monitor = Main.layoutManager.monitors[monitorIndex];
|
|
|
|
|
|
|
|
|
|
this._updateStyle(monitor);
|
|
|
|
|
|
|
|
|
|
if (!this._showing || changeMonitor) {
|
|
|
|
|
let monitorRect = new Meta.Rectangle({ x: monitor.x,
|
|
|
|
|
y: monitor.y,
|
|
|
|
|
width: monitor.width,
|
|
|
|
|
height: monitor.height });
|
2014-09-18 21:02:45 +00:00
|
|
|
|
let [, rect] = window.get_frame_rect().intersect(monitorRect);
|
2019-07-16 09:24:13 +00:00
|
|
|
|
this.set_size(rect.width, rect.height);
|
|
|
|
|
this.set_position(rect.x, rect.y);
|
|
|
|
|
this.opacity = 0;
|
2013-09-02 00:17:58 +00:00
|
|
|
|
}
|
2013-09-01 22:26:12 +00:00
|
|
|
|
|
|
|
|
|
this._showing = true;
|
2019-07-16 09:24:13 +00:00
|
|
|
|
this.show();
|
|
|
|
|
this.ease({
|
2018-07-20 19:46:19 +00:00
|
|
|
|
x: tileRect.x,
|
|
|
|
|
y: tileRect.y,
|
|
|
|
|
width: tileRect.width,
|
|
|
|
|
height: tileRect.height,
|
|
|
|
|
opacity: 255,
|
|
|
|
|
duration: WINDOW_ANIMATION_TIME,
|
2019-08-20 21:43:54 +00:00
|
|
|
|
mode: Clutter.AnimationMode.EASE_OUT_QUAD,
|
2018-07-20 19:46:19 +00:00
|
|
|
|
});
|
2017-10-31 01:19:44 +00:00
|
|
|
|
}
|
2013-09-01 22:26:12 +00:00
|
|
|
|
|
2019-08-28 20:06:14 +00:00
|
|
|
|
close() {
|
2013-09-01 22:26:12 +00:00
|
|
|
|
if (!this._showing)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
this._showing = false;
|
2019-07-16 09:24:13 +00:00
|
|
|
|
this.ease({
|
2018-07-20 19:46:19 +00:00
|
|
|
|
opacity: 0,
|
|
|
|
|
duration: WINDOW_ANIMATION_TIME,
|
|
|
|
|
mode: Clutter.AnimationMode.EASE_OUT_QUAD,
|
2019-08-20 21:43:54 +00:00
|
|
|
|
onComplete: () => this._reset(),
|
2018-07-20 19:46:19 +00:00
|
|
|
|
});
|
2017-10-31 01:19:44 +00:00
|
|
|
|
}
|
2013-09-01 22:26:12 +00:00
|
|
|
|
|
2017-10-31 00:03:21 +00:00
|
|
|
|
_reset() {
|
2019-07-16 09:24:13 +00:00
|
|
|
|
this.hide();
|
2013-09-02 00:17:58 +00:00
|
|
|
|
this._rect = null;
|
|
|
|
|
this._monitorIndex = -1;
|
2017-10-31 01:19:44 +00:00
|
|
|
|
}
|
2013-09-01 22:26:12 +00:00
|
|
|
|
|
2017-10-31 00:03:21 +00:00
|
|
|
|
_updateStyle(monitor) {
|
2013-09-01 22:26:12 +00:00
|
|
|
|
let styles = ['tile-preview'];
|
2013-09-02 00:17:58 +00:00
|
|
|
|
if (this._monitorIndex == Main.layoutManager.primaryIndex)
|
2013-09-01 22:26:12 +00:00
|
|
|
|
styles.push('on-primary');
|
2013-09-02 00:17:58 +00:00
|
|
|
|
if (this._rect.x == monitor.x)
|
2013-09-01 22:26:12 +00:00
|
|
|
|
styles.push('tile-preview-left');
|
2013-09-02 00:17:58 +00:00
|
|
|
|
if (this._rect.x + this._rect.width == monitor.x + monitor.width)
|
2013-09-01 22:26:12 +00:00
|
|
|
|
styles.push('tile-preview-right');
|
|
|
|
|
|
2019-07-16 09:24:13 +00:00
|
|
|
|
this.style_class = styles.join(' ');
|
2013-09-01 22:26:12 +00:00
|
|
|
|
}
|
2019-07-16 09:24:13 +00:00
|
|
|
|
});
|
2015-07-22 19:19:18 +00:00
|
|
|
|
|
2017-10-31 01:23:39 +00:00
|
|
|
|
var AppSwitchAction = GObject.registerClass({
|
2017-02-14 17:24:50 +00:00
|
|
|
|
Signals: { 'activated': {} },
|
2017-10-31 01:23:39 +00:00
|
|
|
|
}, class AppSwitchAction extends Clutter.GestureAction {
|
2017-10-31 00:03:21 +00:00
|
|
|
|
_init() {
|
2017-10-31 01:23:39 +00:00
|
|
|
|
super._init();
|
2014-06-27 20:45:58 +00:00
|
|
|
|
this.set_n_touch_points(3);
|
|
|
|
|
|
2017-10-31 00:38:18 +00:00
|
|
|
|
global.display.connect('grab-op-begin', () => {
|
2014-06-27 20:45:58 +00:00
|
|
|
|
this.cancel();
|
2017-10-31 00:38:18 +00:00
|
|
|
|
});
|
2017-10-31 01:23:39 +00:00
|
|
|
|
}
|
2014-06-27 20:45:58 +00:00
|
|
|
|
|
2019-01-31 14:08:10 +00:00
|
|
|
|
vfunc_gesture_prepare(_actor) {
|
2014-12-11 14:35:40 +00:00
|
|
|
|
if (Main.actionMode != Shell.ActionMode.NORMAL) {
|
2014-09-05 20:44:19 +00:00
|
|
|
|
this.cancel();
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2014-06-27 20:45:58 +00:00
|
|
|
|
return this.get_n_current_points() <= 4;
|
2017-10-31 01:23:39 +00:00
|
|
|
|
}
|
2014-06-27 20:45:58 +00:00
|
|
|
|
|
2019-01-31 14:08:10 +00:00
|
|
|
|
vfunc_gesture_begin(_actor) {
|
2014-06-27 20:45:58 +00:00
|
|
|
|
// in milliseconds
|
|
|
|
|
const LONG_PRESS_TIMEOUT = 250;
|
|
|
|
|
|
|
|
|
|
let nPoints = this.get_n_current_points();
|
2019-08-19 17:55:49 +00:00
|
|
|
|
let event = this.get_last_event(nPoints - 1);
|
2014-06-27 20:45:58 +00:00
|
|
|
|
|
2019-08-20 00:51:42 +00:00
|
|
|
|
if (nPoints == 3) {
|
2014-06-27 20:45:58 +00:00
|
|
|
|
this._longPressStartTime = event.get_time();
|
2019-08-20 00:51:42 +00:00
|
|
|
|
} else if (nPoints == 4) {
|
2014-06-27 20:45:58 +00:00
|
|
|
|
// Check whether the 4th finger press happens after a 3-finger long press,
|
|
|
|
|
// this only needs to be checked on the first 4th finger press
|
|
|
|
|
if (this._longPressStartTime != null &&
|
2019-01-29 21:02:57 +00:00
|
|
|
|
event.get_time() < this._longPressStartTime + LONG_PRESS_TIMEOUT) {
|
2014-06-27 20:45:58 +00:00
|
|
|
|
this.cancel();
|
2019-01-29 21:02:57 +00:00
|
|
|
|
} else {
|
2014-06-27 20:45:58 +00:00
|
|
|
|
this._longPressStartTime = null;
|
|
|
|
|
this.emit('activated');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return this.get_n_current_points() <= 4;
|
2017-10-31 01:23:39 +00:00
|
|
|
|
}
|
2014-06-27 20:45:58 +00:00
|
|
|
|
|
2019-01-31 14:08:10 +00:00
|
|
|
|
vfunc_gesture_progress(_actor) {
|
2014-06-27 20:45:58 +00:00
|
|
|
|
if (this.get_n_current_points() == 3) {
|
|
|
|
|
for (let i = 0; i < this.get_n_current_points(); i++) {
|
2018-07-13 21:32:33 +00:00
|
|
|
|
let [startX, startY] = this.get_press_coords(i);
|
|
|
|
|
let [x, y] = this.get_motion_coords(i);
|
2014-06-27 20:45:58 +00:00
|
|
|
|
|
2019-08-20 00:20:08 +00:00
|
|
|
|
if (Math.abs(x - startX) > APP_MOTION_THRESHOLD ||
|
|
|
|
|
Math.abs(y - startY) > APP_MOTION_THRESHOLD)
|
2014-06-27 20:45:58 +00:00
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
2019-07-16 09:24:13 +00:00
|
|
|
|
var ResizePopup = GObject.registerClass(
|
|
|
|
|
class ResizePopup extends St.Widget {
|
|
|
|
|
_init() {
|
|
|
|
|
super._init({ layout_manager: new Clutter.BinLayout() });
|
2014-12-30 01:30:38 +00:00
|
|
|
|
this._label = new St.Label({ style_class: 'resize-popup',
|
|
|
|
|
x_align: Clutter.ActorAlign.CENTER,
|
|
|
|
|
y_align: Clutter.ActorAlign.CENTER,
|
|
|
|
|
x_expand: true, y_expand: true });
|
2019-07-16 09:24:13 +00:00
|
|
|
|
this.add_child(this._label);
|
|
|
|
|
Main.uiGroup.add_actor(this);
|
2017-10-31 01:19:44 +00:00
|
|
|
|
}
|
2014-12-30 01:30:38 +00:00
|
|
|
|
|
2017-10-31 00:03:21 +00:00
|
|
|
|
set(rect, displayW, displayH) {
|
2014-12-30 01:30:38 +00:00
|
|
|
|
/* Translators: This represents the size of a window. The first number is
|
|
|
|
|
* the width of the window and the second is the height. */
|
2016-09-29 22:00:13 +00:00
|
|
|
|
let text = _("%d × %d").format(displayW, displayH);
|
2014-12-30 01:30:38 +00:00
|
|
|
|
this._label.set_text(text);
|
|
|
|
|
|
2019-07-16 09:24:13 +00:00
|
|
|
|
this.set_position(rect.x, rect.y);
|
|
|
|
|
this.set_size(rect.width, rect.height);
|
2017-10-31 01:19:44 +00:00
|
|
|
|
}
|
2019-07-16 09:24:13 +00:00
|
|
|
|
});
|
2008-11-21 14:02:09 +00:00
|
|
|
|
|
2017-10-31 01:19:44 +00:00
|
|
|
|
var WindowManager = class {
|
|
|
|
|
constructor() {
|
2010-03-16 02:06:58 +00:00
|
|
|
|
this._shellwm = global.window_manager;
|
2008-11-21 21:34:10 +00:00
|
|
|
|
|
2019-11-08 17:00:05 +00:00
|
|
|
|
this._minimizing = new Set();
|
|
|
|
|
this._unminimizing = new Set();
|
|
|
|
|
this._mapping = new Set();
|
|
|
|
|
this._resizing = new Set();
|
2019-11-08 17:22:40 +00:00
|
|
|
|
this._resizePending = new Set();
|
2019-11-08 17:00:05 +00:00
|
|
|
|
this._destroying = new Set();
|
2008-11-21 21:34:10 +00:00
|
|
|
|
|
2010-09-12 09:39:52 +00:00
|
|
|
|
this._dimmedWindows = [];
|
|
|
|
|
|
2019-11-08 17:00:05 +00:00
|
|
|
|
this._skippedActors = new Set();
|
2016-09-15 15:41:52 +00:00
|
|
|
|
|
2012-08-11 00:53:38 +00:00
|
|
|
|
this._allowedKeybindings = {};
|
|
|
|
|
|
2015-03-27 13:34:28 +00:00
|
|
|
|
this._isWorkspacePrepended = false;
|
2021-01-29 19:22:52 +00:00
|
|
|
|
this._canScroll = true; // limiting scrolling speed
|
2015-03-27 13:34:28 +00:00
|
|
|
|
|
2017-10-31 00:38:18 +00:00
|
|
|
|
this._shellwm.connect('kill-window-effects', (shellwm, actor) => {
|
2010-06-16 21:28:57 +00:00
|
|
|
|
this._minimizeWindowDone(shellwm, actor);
|
|
|
|
|
this._mapWindowDone(shellwm, actor);
|
|
|
|
|
this._destroyWindowDone(shellwm, actor);
|
2013-09-01 20:03:59 +00:00
|
|
|
|
this._sizeChangeWindowDone(shellwm, actor);
|
2017-10-31 00:38:18 +00:00
|
|
|
|
});
|
2010-06-16 21:28:57 +00:00
|
|
|
|
|
2017-12-02 00:27:35 +00:00
|
|
|
|
this._shellwm.connect('switch-workspace', this._switchWorkspace.bind(this));
|
|
|
|
|
this._shellwm.connect('show-tile-preview', this._showTilePreview.bind(this));
|
|
|
|
|
this._shellwm.connect('hide-tile-preview', this._hideTilePreview.bind(this));
|
|
|
|
|
this._shellwm.connect('show-window-menu', this._showWindowMenu.bind(this));
|
|
|
|
|
this._shellwm.connect('minimize', this._minimizeWindow.bind(this));
|
|
|
|
|
this._shellwm.connect('unminimize', this._unminimizeWindow.bind(this));
|
|
|
|
|
this._shellwm.connect('size-change', this._sizeChangeWindow.bind(this));
|
|
|
|
|
this._shellwm.connect('size-changed', this._sizeChangedWindow.bind(this));
|
|
|
|
|
this._shellwm.connect('map', this._mapWindow.bind(this));
|
|
|
|
|
this._shellwm.connect('destroy', this._destroyWindow.bind(this));
|
|
|
|
|
this._shellwm.connect('filter-keybinding', this._filterKeybinding.bind(this));
|
|
|
|
|
this._shellwm.connect('confirm-display-change', this._confirmDisplayChange.bind(this));
|
|
|
|
|
this._shellwm.connect('create-close-dialog', this._createCloseDialog.bind(this));
|
|
|
|
|
this._shellwm.connect('create-inhibit-shortcuts-dialog', this._createInhibitShortcutsDialog.bind(this));
|
2010-02-12 22:52:15 +00:00
|
|
|
|
|
|
|
|
|
this._workspaceSwitcherPopup = null;
|
2013-09-01 22:26:12 +00:00
|
|
|
|
this._tilePreview = null;
|
|
|
|
|
|
2015-02-19 19:39:26 +00:00
|
|
|
|
this.allowKeybinding('switch-to-session-1', Shell.ActionMode.ALL);
|
|
|
|
|
this.allowKeybinding('switch-to-session-2', Shell.ActionMode.ALL);
|
|
|
|
|
this.allowKeybinding('switch-to-session-3', Shell.ActionMode.ALL);
|
|
|
|
|
this.allowKeybinding('switch-to-session-4', Shell.ActionMode.ALL);
|
|
|
|
|
this.allowKeybinding('switch-to-session-5', Shell.ActionMode.ALL);
|
|
|
|
|
this.allowKeybinding('switch-to-session-6', Shell.ActionMode.ALL);
|
|
|
|
|
this.allowKeybinding('switch-to-session-7', Shell.ActionMode.ALL);
|
2015-02-19 19:39:26 +00:00
|
|
|
|
this.allowKeybinding('switch-to-session-8', Shell.ActionMode.ALL);
|
|
|
|
|
this.allowKeybinding('switch-to-session-9', Shell.ActionMode.ALL);
|
|
|
|
|
this.allowKeybinding('switch-to-session-10', Shell.ActionMode.ALL);
|
|
|
|
|
this.allowKeybinding('switch-to-session-11', Shell.ActionMode.ALL);
|
|
|
|
|
this.allowKeybinding('switch-to-session-12', Shell.ActionMode.ALL);
|
2015-02-19 19:39:26 +00:00
|
|
|
|
|
2012-08-11 04:34:53 +00:00
|
|
|
|
this.setCustomKeybindingHandler('switch-to-workspace-left',
|
2014-12-11 14:35:40 +00:00
|
|
|
|
Shell.ActionMode.NORMAL |
|
|
|
|
|
Shell.ActionMode.OVERVIEW,
|
2017-12-02 00:27:35 +00:00
|
|
|
|
this._showWorkspaceSwitcher.bind(this));
|
2012-08-11 04:34:53 +00:00
|
|
|
|
this.setCustomKeybindingHandler('switch-to-workspace-right',
|
2014-12-11 14:35:40 +00:00
|
|
|
|
Shell.ActionMode.NORMAL |
|
|
|
|
|
Shell.ActionMode.OVERVIEW,
|
2017-12-02 00:27:35 +00:00
|
|
|
|
this._showWorkspaceSwitcher.bind(this));
|
2012-08-11 04:34:53 +00:00
|
|
|
|
this.setCustomKeybindingHandler('switch-to-workspace-up',
|
2014-12-11 14:35:40 +00:00
|
|
|
|
Shell.ActionMode.NORMAL |
|
|
|
|
|
Shell.ActionMode.OVERVIEW,
|
2017-12-02 00:27:35 +00:00
|
|
|
|
this._showWorkspaceSwitcher.bind(this));
|
2012-08-11 04:34:53 +00:00
|
|
|
|
this.setCustomKeybindingHandler('switch-to-workspace-down',
|
2014-12-11 14:35:40 +00:00
|
|
|
|
Shell.ActionMode.NORMAL |
|
|
|
|
|
Shell.ActionMode.OVERVIEW,
|
2017-12-02 00:27:35 +00:00
|
|
|
|
this._showWorkspaceSwitcher.bind(this));
|
2013-05-18 17:55:05 +00:00
|
|
|
|
this.setCustomKeybindingHandler('switch-to-workspace-last',
|
2014-12-11 14:35:40 +00:00
|
|
|
|
Shell.ActionMode.NORMAL |
|
|
|
|
|
Shell.ActionMode.OVERVIEW,
|
2017-12-02 00:27:35 +00:00
|
|
|
|
this._showWorkspaceSwitcher.bind(this));
|
2012-08-11 04:34:53 +00:00
|
|
|
|
this.setCustomKeybindingHandler('move-to-workspace-left',
|
2014-12-11 14:35:40 +00:00
|
|
|
|
Shell.ActionMode.NORMAL |
|
|
|
|
|
Shell.ActionMode.OVERVIEW,
|
2017-12-02 00:27:35 +00:00
|
|
|
|
this._showWorkspaceSwitcher.bind(this));
|
2012-08-11 04:34:53 +00:00
|
|
|
|
this.setCustomKeybindingHandler('move-to-workspace-right',
|
2014-12-11 14:35:40 +00:00
|
|
|
|
Shell.ActionMode.NORMAL |
|
|
|
|
|
Shell.ActionMode.OVERVIEW,
|
2017-12-02 00:27:35 +00:00
|
|
|
|
this._showWorkspaceSwitcher.bind(this));
|
2012-08-11 04:34:53 +00:00
|
|
|
|
this.setCustomKeybindingHandler('move-to-workspace-up',
|
2014-12-11 14:35:40 +00:00
|
|
|
|
Shell.ActionMode.NORMAL |
|
|
|
|
|
Shell.ActionMode.OVERVIEW,
|
2017-12-02 00:27:35 +00:00
|
|
|
|
this._showWorkspaceSwitcher.bind(this));
|
2012-08-11 04:34:53 +00:00
|
|
|
|
this.setCustomKeybindingHandler('move-to-workspace-down',
|
2014-12-11 14:35:40 +00:00
|
|
|
|
Shell.ActionMode.NORMAL |
|
|
|
|
|
Shell.ActionMode.OVERVIEW,
|
2017-12-02 00:27:35 +00:00
|
|
|
|
this._showWorkspaceSwitcher.bind(this));
|
2013-05-17 14:54:23 +00:00
|
|
|
|
this.setCustomKeybindingHandler('switch-to-workspace-1',
|
2014-12-11 14:35:40 +00:00
|
|
|
|
Shell.ActionMode.NORMAL |
|
|
|
|
|
Shell.ActionMode.OVERVIEW,
|
2017-12-02 00:27:35 +00:00
|
|
|
|
this._showWorkspaceSwitcher.bind(this));
|
2013-05-17 14:54:23 +00:00
|
|
|
|
this.setCustomKeybindingHandler('switch-to-workspace-2',
|
2014-12-11 14:35:40 +00:00
|
|
|
|
Shell.ActionMode.NORMAL |
|
|
|
|
|
Shell.ActionMode.OVERVIEW,
|
2017-12-02 00:27:35 +00:00
|
|
|
|
this._showWorkspaceSwitcher.bind(this));
|
2013-05-17 14:54:23 +00:00
|
|
|
|
this.setCustomKeybindingHandler('switch-to-workspace-3',
|
2014-12-11 14:35:40 +00:00
|
|
|
|
Shell.ActionMode.NORMAL |
|
|
|
|
|
Shell.ActionMode.OVERVIEW,
|
2017-12-02 00:27:35 +00:00
|
|
|
|
this._showWorkspaceSwitcher.bind(this));
|
2013-05-17 14:54:23 +00:00
|
|
|
|
this.setCustomKeybindingHandler('switch-to-workspace-4',
|
2014-12-11 14:35:40 +00:00
|
|
|
|
Shell.ActionMode.NORMAL |
|
|
|
|
|
Shell.ActionMode.OVERVIEW,
|
2017-12-02 00:27:35 +00:00
|
|
|
|
this._showWorkspaceSwitcher.bind(this));
|
2013-05-17 14:54:23 +00:00
|
|
|
|
this.setCustomKeybindingHandler('switch-to-workspace-5',
|
2014-12-11 14:35:40 +00:00
|
|
|
|
Shell.ActionMode.NORMAL |
|
|
|
|
|
Shell.ActionMode.OVERVIEW,
|
2017-12-02 00:27:35 +00:00
|
|
|
|
this._showWorkspaceSwitcher.bind(this));
|
2013-05-17 14:54:23 +00:00
|
|
|
|
this.setCustomKeybindingHandler('switch-to-workspace-6',
|
2014-12-11 14:35:40 +00:00
|
|
|
|
Shell.ActionMode.NORMAL |
|
|
|
|
|
Shell.ActionMode.OVERVIEW,
|
2017-12-02 00:27:35 +00:00
|
|
|
|
this._showWorkspaceSwitcher.bind(this));
|
2013-05-17 14:54:23 +00:00
|
|
|
|
this.setCustomKeybindingHandler('switch-to-workspace-7',
|
2014-12-11 14:35:40 +00:00
|
|
|
|
Shell.ActionMode.NORMAL |
|
|
|
|
|
Shell.ActionMode.OVERVIEW,
|
2017-12-02 00:27:35 +00:00
|
|
|
|
this._showWorkspaceSwitcher.bind(this));
|
2013-05-17 14:54:23 +00:00
|
|
|
|
this.setCustomKeybindingHandler('switch-to-workspace-8',
|
2014-12-11 14:35:40 +00:00
|
|
|
|
Shell.ActionMode.NORMAL |
|
|
|
|
|
Shell.ActionMode.OVERVIEW,
|
2017-12-02 00:27:35 +00:00
|
|
|
|
this._showWorkspaceSwitcher.bind(this));
|
2013-05-17 14:54:23 +00:00
|
|
|
|
this.setCustomKeybindingHandler('switch-to-workspace-9',
|
2014-12-11 14:35:40 +00:00
|
|
|
|
Shell.ActionMode.NORMAL |
|
|
|
|
|
Shell.ActionMode.OVERVIEW,
|
2017-12-02 00:27:35 +00:00
|
|
|
|
this._showWorkspaceSwitcher.bind(this));
|
2013-05-17 14:54:23 +00:00
|
|
|
|
this.setCustomKeybindingHandler('switch-to-workspace-10',
|
2014-12-11 14:35:40 +00:00
|
|
|
|
Shell.ActionMode.NORMAL |
|
|
|
|
|
Shell.ActionMode.OVERVIEW,
|
2017-12-02 00:27:35 +00:00
|
|
|
|
this._showWorkspaceSwitcher.bind(this));
|
2013-05-17 14:54:23 +00:00
|
|
|
|
this.setCustomKeybindingHandler('switch-to-workspace-11',
|
2014-12-11 14:35:40 +00:00
|
|
|
|
Shell.ActionMode.NORMAL |
|
|
|
|
|
Shell.ActionMode.OVERVIEW,
|
2017-12-02 00:27:35 +00:00
|
|
|
|
this._showWorkspaceSwitcher.bind(this));
|
2013-05-17 14:54:23 +00:00
|
|
|
|
this.setCustomKeybindingHandler('switch-to-workspace-12',
|
2014-12-11 14:35:40 +00:00
|
|
|
|
Shell.ActionMode.NORMAL |
|
|
|
|
|
Shell.ActionMode.OVERVIEW,
|
2017-12-02 00:27:35 +00:00
|
|
|
|
this._showWorkspaceSwitcher.bind(this));
|
2013-05-17 14:54:23 +00:00
|
|
|
|
this.setCustomKeybindingHandler('move-to-workspace-1',
|
2014-12-11 14:35:40 +00:00
|
|
|
|
Shell.ActionMode.NORMAL,
|
2017-12-02 00:27:35 +00:00
|
|
|
|
this._showWorkspaceSwitcher.bind(this));
|
2013-05-17 14:54:23 +00:00
|
|
|
|
this.setCustomKeybindingHandler('move-to-workspace-2',
|
2014-12-11 14:35:40 +00:00
|
|
|
|
Shell.ActionMode.NORMAL,
|
2017-12-02 00:27:35 +00:00
|
|
|
|
this._showWorkspaceSwitcher.bind(this));
|
2013-05-17 14:54:23 +00:00
|
|
|
|
this.setCustomKeybindingHandler('move-to-workspace-3',
|
2014-12-11 14:35:40 +00:00
|
|
|
|
Shell.ActionMode.NORMAL,
|
2017-12-02 00:27:35 +00:00
|
|
|
|
this._showWorkspaceSwitcher.bind(this));
|
2013-05-17 14:54:23 +00:00
|
|
|
|
this.setCustomKeybindingHandler('move-to-workspace-4',
|
2014-12-11 14:35:40 +00:00
|
|
|
|
Shell.ActionMode.NORMAL,
|
2017-12-02 00:27:35 +00:00
|
|
|
|
this._showWorkspaceSwitcher.bind(this));
|
2013-05-17 14:54:23 +00:00
|
|
|
|
this.setCustomKeybindingHandler('move-to-workspace-5',
|
2014-12-11 14:35:40 +00:00
|
|
|
|
Shell.ActionMode.NORMAL,
|
2017-12-02 00:27:35 +00:00
|
|
|
|
this._showWorkspaceSwitcher.bind(this));
|
2013-05-17 14:54:23 +00:00
|
|
|
|
this.setCustomKeybindingHandler('move-to-workspace-6',
|
2014-12-11 14:35:40 +00:00
|
|
|
|
Shell.ActionMode.NORMAL,
|
2017-12-02 00:27:35 +00:00
|
|
|
|
this._showWorkspaceSwitcher.bind(this));
|
2013-05-17 14:54:23 +00:00
|
|
|
|
this.setCustomKeybindingHandler('move-to-workspace-7',
|
2014-12-11 14:35:40 +00:00
|
|
|
|
Shell.ActionMode.NORMAL,
|
2017-12-02 00:27:35 +00:00
|
|
|
|
this._showWorkspaceSwitcher.bind(this));
|
2013-05-17 14:54:23 +00:00
|
|
|
|
this.setCustomKeybindingHandler('move-to-workspace-8',
|
2014-12-11 14:35:40 +00:00
|
|
|
|
Shell.ActionMode.NORMAL,
|
2017-12-02 00:27:35 +00:00
|
|
|
|
this._showWorkspaceSwitcher.bind(this));
|
2013-05-17 14:54:23 +00:00
|
|
|
|
this.setCustomKeybindingHandler('move-to-workspace-9',
|
2014-12-11 14:35:40 +00:00
|
|
|
|
Shell.ActionMode.NORMAL,
|
2017-12-02 00:27:35 +00:00
|
|
|
|
this._showWorkspaceSwitcher.bind(this));
|
2013-05-17 14:54:23 +00:00
|
|
|
|
this.setCustomKeybindingHandler('move-to-workspace-10',
|
2014-12-11 14:35:40 +00:00
|
|
|
|
Shell.ActionMode.NORMAL,
|
2017-12-02 00:27:35 +00:00
|
|
|
|
this._showWorkspaceSwitcher.bind(this));
|
2013-05-17 14:54:23 +00:00
|
|
|
|
this.setCustomKeybindingHandler('move-to-workspace-11',
|
2014-12-11 14:35:40 +00:00
|
|
|
|
Shell.ActionMode.NORMAL,
|
2017-12-02 00:27:35 +00:00
|
|
|
|
this._showWorkspaceSwitcher.bind(this));
|
2013-05-17 14:54:23 +00:00
|
|
|
|
this.setCustomKeybindingHandler('move-to-workspace-12',
|
2014-12-11 14:35:40 +00:00
|
|
|
|
Shell.ActionMode.NORMAL,
|
2017-12-02 00:27:35 +00:00
|
|
|
|
this._showWorkspaceSwitcher.bind(this));
|
2013-05-18 17:55:05 +00:00
|
|
|
|
this.setCustomKeybindingHandler('move-to-workspace-last',
|
2014-12-11 14:35:40 +00:00
|
|
|
|
Shell.ActionMode.NORMAL,
|
2017-12-02 00:27:35 +00:00
|
|
|
|
this._showWorkspaceSwitcher.bind(this));
|
2012-11-23 00:18:06 +00:00
|
|
|
|
this.setCustomKeybindingHandler('switch-applications',
|
2014-12-11 14:35:40 +00:00
|
|
|
|
Shell.ActionMode.NORMAL,
|
2017-12-02 00:27:35 +00:00
|
|
|
|
this._startSwitcher.bind(this));
|
2012-08-11 04:34:53 +00:00
|
|
|
|
this.setCustomKeybindingHandler('switch-group',
|
2014-12-11 14:35:40 +00:00
|
|
|
|
Shell.ActionMode.NORMAL,
|
2017-12-02 00:27:35 +00:00
|
|
|
|
this._startSwitcher.bind(this));
|
2012-11-23 00:18:06 +00:00
|
|
|
|
this.setCustomKeybindingHandler('switch-applications-backward',
|
2014-12-11 14:35:40 +00:00
|
|
|
|
Shell.ActionMode.NORMAL,
|
2017-12-02 00:27:35 +00:00
|
|
|
|
this._startSwitcher.bind(this));
|
2012-08-11 04:34:53 +00:00
|
|
|
|
this.setCustomKeybindingHandler('switch-group-backward',
|
2014-12-11 14:35:40 +00:00
|
|
|
|
Shell.ActionMode.NORMAL,
|
2017-12-02 00:27:35 +00:00
|
|
|
|
this._startSwitcher.bind(this));
|
2012-11-23 02:20:10 +00:00
|
|
|
|
this.setCustomKeybindingHandler('switch-windows',
|
2014-12-11 14:35:40 +00:00
|
|
|
|
Shell.ActionMode.NORMAL,
|
2017-12-02 00:27:35 +00:00
|
|
|
|
this._startSwitcher.bind(this));
|
2012-11-23 02:20:10 +00:00
|
|
|
|
this.setCustomKeybindingHandler('switch-windows-backward',
|
2014-12-11 14:35:40 +00:00
|
|
|
|
Shell.ActionMode.NORMAL,
|
2017-12-02 00:27:35 +00:00
|
|
|
|
this._startSwitcher.bind(this));
|
2016-05-19 12:41:24 +00:00
|
|
|
|
this.setCustomKeybindingHandler('cycle-windows',
|
|
|
|
|
Shell.ActionMode.NORMAL,
|
2017-12-02 00:27:35 +00:00
|
|
|
|
this._startSwitcher.bind(this));
|
2016-05-19 12:41:24 +00:00
|
|
|
|
this.setCustomKeybindingHandler('cycle-windows-backward',
|
|
|
|
|
Shell.ActionMode.NORMAL,
|
2017-12-02 00:27:35 +00:00
|
|
|
|
this._startSwitcher.bind(this));
|
2016-05-19 12:41:24 +00:00
|
|
|
|
this.setCustomKeybindingHandler('cycle-group',
|
|
|
|
|
Shell.ActionMode.NORMAL,
|
2017-12-02 00:27:35 +00:00
|
|
|
|
this._startSwitcher.bind(this));
|
2016-05-19 12:41:24 +00:00
|
|
|
|
this.setCustomKeybindingHandler('cycle-group-backward',
|
|
|
|
|
Shell.ActionMode.NORMAL,
|
2017-12-02 00:27:35 +00:00
|
|
|
|
this._startSwitcher.bind(this));
|
2012-08-11 04:34:53 +00:00
|
|
|
|
this.setCustomKeybindingHandler('switch-panels',
|
2014-12-11 14:35:40 +00:00
|
|
|
|
Shell.ActionMode.NORMAL |
|
|
|
|
|
Shell.ActionMode.OVERVIEW |
|
|
|
|
|
Shell.ActionMode.LOCK_SCREEN |
|
|
|
|
|
Shell.ActionMode.UNLOCK_SCREEN |
|
|
|
|
|
Shell.ActionMode.LOGIN_SCREEN,
|
2017-12-02 00:27:35 +00:00
|
|
|
|
this._startA11ySwitcher.bind(this));
|
2012-12-03 10:07:28 +00:00
|
|
|
|
this.setCustomKeybindingHandler('switch-panels-backward',
|
2014-12-11 14:35:40 +00:00
|
|
|
|
Shell.ActionMode.NORMAL |
|
|
|
|
|
Shell.ActionMode.OVERVIEW |
|
|
|
|
|
Shell.ActionMode.LOCK_SCREEN |
|
|
|
|
|
Shell.ActionMode.UNLOCK_SCREEN |
|
|
|
|
|
Shell.ActionMode.LOGIN_SCREEN,
|
2017-12-02 00:27:35 +00:00
|
|
|
|
this._startA11ySwitcher.bind(this));
|
2017-06-08 14:49:20 +00:00
|
|
|
|
this.setCustomKeybindingHandler('switch-monitor',
|
|
|
|
|
Shell.ActionMode.NORMAL |
|
|
|
|
|
Shell.ActionMode.OVERVIEW,
|
2017-12-02 00:27:35 +00:00
|
|
|
|
this._startSwitcher.bind(this));
|
2012-08-11 04:34:53 +00:00
|
|
|
|
|
|
|
|
|
this.addKeybinding('open-application-menu',
|
2014-06-24 19:17:09 +00:00
|
|
|
|
new Gio.Settings({ schema_id: SHELL_KEYBINDINGS_SCHEMA }),
|
2018-06-22 12:23:31 +00:00
|
|
|
|
Meta.KeyBindingFlags.IGNORE_AUTOREPEAT,
|
2014-12-11 14:35:40 +00:00
|
|
|
|
Shell.ActionMode.NORMAL |
|
2015-02-26 00:00:41 +00:00
|
|
|
|
Shell.ActionMode.POPUP,
|
2017-12-02 00:27:35 +00:00
|
|
|
|
this._toggleAppMenu.bind(this));
|
2010-09-12 09:39:52 +00:00
|
|
|
|
|
2015-02-18 01:52:07 +00:00
|
|
|
|
this.addKeybinding('toggle-message-tray',
|
|
|
|
|
new Gio.Settings({ schema_id: SHELL_KEYBINDINGS_SCHEMA }),
|
2018-06-22 12:23:31 +00:00
|
|
|
|
Meta.KeyBindingFlags.IGNORE_AUTOREPEAT,
|
2015-02-18 01:52:07 +00:00
|
|
|
|
Shell.ActionMode.NORMAL |
|
2015-03-06 17:02:57 +00:00
|
|
|
|
Shell.ActionMode.OVERVIEW |
|
2015-02-26 00:00:41 +00:00
|
|
|
|
Shell.ActionMode.POPUP,
|
2017-12-02 00:27:35 +00:00
|
|
|
|
this._toggleCalendar.bind(this));
|
2015-02-18 01:52:07 +00:00
|
|
|
|
|
2019-01-29 10:48:06 +00:00
|
|
|
|
this.addKeybinding('switch-to-application-1',
|
|
|
|
|
new Gio.Settings({ schema_id: SHELL_KEYBINDINGS_SCHEMA }),
|
|
|
|
|
Meta.KeyBindingFlags.IGNORE_AUTOREPEAT,
|
|
|
|
|
Shell.ActionMode.NORMAL |
|
|
|
|
|
Shell.ActionMode.OVERVIEW,
|
|
|
|
|
this._switchToApplication.bind(this));
|
|
|
|
|
|
|
|
|
|
this.addKeybinding('switch-to-application-2',
|
|
|
|
|
new Gio.Settings({ schema_id: SHELL_KEYBINDINGS_SCHEMA }),
|
|
|
|
|
Meta.KeyBindingFlags.IGNORE_AUTOREPEAT,
|
|
|
|
|
Shell.ActionMode.NORMAL |
|
|
|
|
|
Shell.ActionMode.OVERVIEW,
|
|
|
|
|
this._switchToApplication.bind(this));
|
|
|
|
|
|
|
|
|
|
this.addKeybinding('switch-to-application-3',
|
|
|
|
|
new Gio.Settings({ schema_id: SHELL_KEYBINDINGS_SCHEMA }),
|
|
|
|
|
Meta.KeyBindingFlags.IGNORE_AUTOREPEAT,
|
|
|
|
|
Shell.ActionMode.NORMAL |
|
|
|
|
|
Shell.ActionMode.OVERVIEW,
|
|
|
|
|
this._switchToApplication.bind(this));
|
|
|
|
|
|
|
|
|
|
this.addKeybinding('switch-to-application-4',
|
|
|
|
|
new Gio.Settings({ schema_id: SHELL_KEYBINDINGS_SCHEMA }),
|
|
|
|
|
Meta.KeyBindingFlags.IGNORE_AUTOREPEAT,
|
|
|
|
|
Shell.ActionMode.NORMAL |
|
|
|
|
|
Shell.ActionMode.OVERVIEW,
|
|
|
|
|
this._switchToApplication.bind(this));
|
|
|
|
|
|
|
|
|
|
this.addKeybinding('switch-to-application-5',
|
|
|
|
|
new Gio.Settings({ schema_id: SHELL_KEYBINDINGS_SCHEMA }),
|
|
|
|
|
Meta.KeyBindingFlags.IGNORE_AUTOREPEAT,
|
|
|
|
|
Shell.ActionMode.NORMAL |
|
|
|
|
|
Shell.ActionMode.OVERVIEW,
|
|
|
|
|
this._switchToApplication.bind(this));
|
|
|
|
|
|
|
|
|
|
this.addKeybinding('switch-to-application-6',
|
|
|
|
|
new Gio.Settings({ schema_id: SHELL_KEYBINDINGS_SCHEMA }),
|
|
|
|
|
Meta.KeyBindingFlags.IGNORE_AUTOREPEAT,
|
|
|
|
|
Shell.ActionMode.NORMAL |
|
|
|
|
|
Shell.ActionMode.OVERVIEW,
|
|
|
|
|
this._switchToApplication.bind(this));
|
|
|
|
|
|
|
|
|
|
this.addKeybinding('switch-to-application-7',
|
|
|
|
|
new Gio.Settings({ schema_id: SHELL_KEYBINDINGS_SCHEMA }),
|
|
|
|
|
Meta.KeyBindingFlags.IGNORE_AUTOREPEAT,
|
|
|
|
|
Shell.ActionMode.NORMAL |
|
|
|
|
|
Shell.ActionMode.OVERVIEW,
|
|
|
|
|
this._switchToApplication.bind(this));
|
|
|
|
|
|
|
|
|
|
this.addKeybinding('switch-to-application-8',
|
|
|
|
|
new Gio.Settings({ schema_id: SHELL_KEYBINDINGS_SCHEMA }),
|
|
|
|
|
Meta.KeyBindingFlags.IGNORE_AUTOREPEAT,
|
|
|
|
|
Shell.ActionMode.NORMAL |
|
|
|
|
|
Shell.ActionMode.OVERVIEW,
|
|
|
|
|
this._switchToApplication.bind(this));
|
|
|
|
|
|
|
|
|
|
this.addKeybinding('switch-to-application-9',
|
|
|
|
|
new Gio.Settings({ schema_id: SHELL_KEYBINDINGS_SCHEMA }),
|
|
|
|
|
Meta.KeyBindingFlags.IGNORE_AUTOREPEAT,
|
|
|
|
|
Shell.ActionMode.NORMAL |
|
|
|
|
|
Shell.ActionMode.OVERVIEW,
|
|
|
|
|
this._switchToApplication.bind(this));
|
|
|
|
|
|
2021-01-29 19:33:23 +00:00
|
|
|
|
global.stage.connect('scroll-event', (stage, event) => {
|
2021-03-08 18:59:23 +00:00
|
|
|
|
const allowedModes = Shell.ActionMode.NORMAL;
|
|
|
|
|
if ((allowedModes & Main.actionMode) === 0)
|
|
|
|
|
return Clutter.EVENT_PROPAGATE;
|
|
|
|
|
|
2021-01-29 19:33:23 +00:00
|
|
|
|
if (this._workspaceAnimation.canHandleScrollEvent(event))
|
|
|
|
|
return Clutter.EVENT_PROPAGATE;
|
|
|
|
|
|
|
|
|
|
if ((event.get_state() & global.display.compositor_modifiers) === 0)
|
|
|
|
|
return Clutter.EVENT_PROPAGATE;
|
|
|
|
|
|
|
|
|
|
return this.handleWorkspaceScroll(event);
|
|
|
|
|
});
|
|
|
|
|
|
2017-12-02 00:27:35 +00:00
|
|
|
|
global.display.connect('show-resize-popup', this._showResizePopup.bind(this));
|
|
|
|
|
global.display.connect('show-pad-osd', this._showPadOsd.bind(this));
|
2017-10-31 00:38:18 +00:00
|
|
|
|
global.display.connect('show-osd', (display, monitorIndex, iconName, label) => {
|
2016-12-28 11:14:32 +00:00
|
|
|
|
let icon = Gio.Icon.new_for_string(iconName);
|
|
|
|
|
Main.osdWindowManager.show(monitorIndex, icon, label, null);
|
2017-10-31 00:38:18 +00:00
|
|
|
|
});
|
2014-12-30 01:30:38 +00:00
|
|
|
|
|
2016-12-28 12:03:53 +00:00
|
|
|
|
this._gsdWacomProxy = new GsdWacomProxy(Gio.DBus.session, GSD_WACOM_BUS_NAME,
|
|
|
|
|
GSD_WACOM_OBJECT_PATH,
|
2017-10-31 00:38:18 +00:00
|
|
|
|
(proxy, error) => {
|
2019-08-20 00:51:42 +00:00
|
|
|
|
if (error)
|
2016-12-28 12:03:53 +00:00
|
|
|
|
log(error.message);
|
2017-10-31 00:38:18 +00:00
|
|
|
|
});
|
2016-12-28 12:03:53 +00:00
|
|
|
|
|
2020-03-06 14:34:00 +00:00
|
|
|
|
global.display.connect('pad-mode-switch', (display, pad, _group, _mode) => {
|
2016-12-28 12:03:53 +00:00
|
|
|
|
let labels = [];
|
|
|
|
|
|
2019-08-19 17:55:49 +00:00
|
|
|
|
// FIXME: Fix num buttons
|
2016-12-28 12:03:53 +00:00
|
|
|
|
for (let i = 0; i < 50; i++) {
|
|
|
|
|
let str = display.get_pad_action_label(pad, Meta.PadActionType.BUTTON, i);
|
2020-08-12 18:59:01 +00:00
|
|
|
|
labels.push(str ?? '');
|
2016-12-28 12:03:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
2020-03-06 14:34:00 +00:00
|
|
|
|
if (this._gsdWacomProxy)
|
2016-12-28 12:03:53 +00:00
|
|
|
|
this._gsdWacomProxy.SetOLEDLabelsRemote(pad.get_device_node(), labels);
|
2017-10-31 00:38:18 +00:00
|
|
|
|
});
|
2016-12-28 12:03:53 +00:00
|
|
|
|
|
2019-11-14 22:56:42 +00:00
|
|
|
|
global.display.connect('init-xserver', (display, task) => {
|
2019-08-15 11:29:53 +00:00
|
|
|
|
IBusManager.getIBusManager().restartDaemon(['--xim']);
|
2019-11-14 22:56:42 +00:00
|
|
|
|
|
2021-06-15 06:50:56 +00:00
|
|
|
|
this._startX11Services(task);
|
2020-05-07 09:15:46 +00:00
|
|
|
|
|
2019-11-14 22:56:42 +00:00
|
|
|
|
return true;
|
2019-08-15 11:29:53 +00:00
|
|
|
|
});
|
2020-02-29 22:42:29 +00:00
|
|
|
|
global.display.connect('x11-display-closing', () => {
|
2020-03-10 12:23:17 +00:00
|
|
|
|
if (!Meta.is_wayland_compositor())
|
|
|
|
|
return;
|
2019-12-13 18:07:16 +00:00
|
|
|
|
|
|
|
|
|
this._stopX11Services(null);
|
|
|
|
|
|
2019-08-15 11:29:53 +00:00
|
|
|
|
IBusManager.getIBusManager().restartDaemon();
|
|
|
|
|
});
|
|
|
|
|
|
2017-10-31 00:38:18 +00:00
|
|
|
|
Main.overview.connect('showing', () => {
|
2014-01-19 15:12:15 +00:00
|
|
|
|
for (let i = 0; i < this._dimmedWindows.length; i++)
|
|
|
|
|
this._undimWindow(this._dimmedWindows[i]);
|
2017-10-31 00:38:18 +00:00
|
|
|
|
});
|
|
|
|
|
Main.overview.connect('hiding', () => {
|
2014-01-19 15:12:15 +00:00
|
|
|
|
for (let i = 0; i < this._dimmedWindows.length; i++)
|
|
|
|
|
this._dimWindow(this._dimmedWindows[i]);
|
2017-10-31 00:38:18 +00:00
|
|
|
|
});
|
2014-01-19 15:12:15 +00:00
|
|
|
|
|
2014-03-13 22:51:10 +00:00
|
|
|
|
this._windowMenuManager = new WindowMenu.WindowMenuManager();
|
|
|
|
|
|
2013-06-16 04:21:21 +00:00
|
|
|
|
if (Main.sessionMode.hasWorkspaces)
|
|
|
|
|
this._workspaceTracker = new WorkspaceTracker(this);
|
2012-12-23 03:10:48 +00:00
|
|
|
|
|
2019-06-26 16:06:28 +00:00
|
|
|
|
let appSwitchAction = new AppSwitchAction();
|
|
|
|
|
appSwitchAction.connect('activated', this._switchApp.bind(this));
|
|
|
|
|
global.stage.add_action(appSwitchAction);
|
2017-02-26 22:48:25 +00:00
|
|
|
|
|
2017-09-25 13:26:14 +00:00
|
|
|
|
let mode = Shell.ActionMode.ALL & ~Shell.ActionMode.LOCK_SCREEN;
|
2019-06-26 16:06:28 +00:00
|
|
|
|
let topDragAction = new EdgeDragAction.EdgeDragAction(St.Side.TOP, mode);
|
|
|
|
|
topDragAction.connect('activated', () => {
|
2018-06-07 15:52:18 +00:00
|
|
|
|
let currentWindow = global.display.focus_window;
|
|
|
|
|
if (currentWindow)
|
|
|
|
|
currentWindow.unmake_fullscreen();
|
|
|
|
|
});
|
2019-02-09 22:40:02 +00:00
|
|
|
|
|
|
|
|
|
let updateUnfullscreenGesture = () => {
|
|
|
|
|
let currentWindow = global.display.focus_window;
|
2019-06-26 16:06:28 +00:00
|
|
|
|
topDragAction.enabled = currentWindow && currentWindow.is_fullscreen();
|
2019-01-29 01:18:52 +00:00
|
|
|
|
};
|
2019-02-09 22:40:02 +00:00
|
|
|
|
|
|
|
|
|
global.display.connect('notify::focus-window', updateUnfullscreenGesture);
|
|
|
|
|
global.display.connect('in-fullscreen-changed', updateUnfullscreenGesture);
|
|
|
|
|
|
2019-06-26 16:06:28 +00:00
|
|
|
|
global.stage.add_action(topDragAction);
|
2019-07-02 17:28:47 +00:00
|
|
|
|
|
|
|
|
|
this._workspaceAnimation =
|
|
|
|
|
new WorkspaceAnimation.WorkspaceAnimationController();
|
2020-01-21 13:09:56 +00:00
|
|
|
|
|
|
|
|
|
this._shellwm.connect('kill-switch-workspace', () => {
|
|
|
|
|
this._workspaceAnimation.cancelSwitchAnimation();
|
|
|
|
|
this._switchWorkspaceDone();
|
|
|
|
|
});
|
2017-10-31 01:19:44 +00:00
|
|
|
|
}
|
2016-06-22 17:57:12 +00:00
|
|
|
|
|
2021-06-15 06:50:56 +00:00
|
|
|
|
async _startX11Services(task) {
|
2021-05-06 13:28:33 +00:00
|
|
|
|
let status = true;
|
2019-12-13 18:07:16 +00:00
|
|
|
|
try {
|
|
|
|
|
await Shell.util_start_systemd_unit(
|
2021-06-15 06:50:56 +00:00
|
|
|
|
'gnome-session-x11-services-ready.target', 'fail', null);
|
2019-12-13 18:07:16 +00:00
|
|
|
|
} catch (e) {
|
|
|
|
|
// Ignore NOT_SUPPORTED error, which indicates we are not systemd
|
|
|
|
|
// managed and gnome-session will have taken care of everything
|
|
|
|
|
// already.
|
|
|
|
|
// Note that we do log cancellation from here.
|
2021-05-18 12:04:05 +00:00
|
|
|
|
if (!e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.NOT_SUPPORTED)) {
|
2019-12-13 18:07:16 +00:00
|
|
|
|
log('Error starting X11 services: %s'.format(e.message));
|
2021-05-18 12:04:05 +00:00
|
|
|
|
status = false;
|
|
|
|
|
}
|
2019-12-13 18:07:16 +00:00
|
|
|
|
} finally {
|
2021-05-06 13:28:33 +00:00
|
|
|
|
task.return_boolean(status);
|
2019-12-13 18:07:16 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async _stopX11Services(cancellable) {
|
|
|
|
|
try {
|
|
|
|
|
await Shell.util_stop_systemd_unit(
|
|
|
|
|
'gnome-session-x11-services.target', 'fail', cancellable);
|
|
|
|
|
} catch (e) {
|
|
|
|
|
// Ignore NOT_SUPPORTED error, which indicates we are not systemd
|
|
|
|
|
// managed and gnome-session will have taken care of everything
|
|
|
|
|
// already.
|
|
|
|
|
// Note that we do log cancellation from here.
|
|
|
|
|
if (!e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.NOT_SUPPORTED))
|
|
|
|
|
log('Error stopping X11 services: %s'.format(e.message));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-10-31 00:03:21 +00:00
|
|
|
|
_showPadOsd(display, device, settings, imagePath, editionMode, monitorIndex) {
|
2016-06-22 17:57:12 +00:00
|
|
|
|
this._currentPadOsd = new PadOsd.PadOsd(device, settings, imagePath, editionMode, monitorIndex);
|
2019-08-19 20:20:35 +00:00
|
|
|
|
this._currentPadOsd.connect('closed', () => (this._currentPadOsd = null));
|
2015-07-01 13:51:15 +00:00
|
|
|
|
|
2019-07-16 09:24:13 +00:00
|
|
|
|
return this._currentPadOsd;
|
2017-10-31 01:19:44 +00:00
|
|
|
|
}
|
2015-07-01 13:51:15 +00:00
|
|
|
|
|
2017-10-31 00:03:21 +00:00
|
|
|
|
_lookupIndex(windows, metaWindow) {
|
2014-06-27 20:45:58 +00:00
|
|
|
|
for (let i = 0; i < windows.length; i++) {
|
2019-08-20 00:51:42 +00:00
|
|
|
|
if (windows[i].metaWindow == metaWindow)
|
2014-06-27 20:45:58 +00:00
|
|
|
|
return i;
|
|
|
|
|
}
|
|
|
|
|
return -1;
|
2017-10-31 01:19:44 +00:00
|
|
|
|
}
|
2014-06-27 20:45:58 +00:00
|
|
|
|
|
2017-10-31 00:03:21 +00:00
|
|
|
|
_switchApp() {
|
2017-10-31 00:38:18 +00:00
|
|
|
|
let windows = global.get_window_actors().filter(actor => {
|
2014-06-27 20:45:58 +00:00
|
|
|
|
let win = actor.metaWindow;
|
2018-01-03 07:55:38 +00:00
|
|
|
|
let workspaceManager = global.workspace_manager;
|
|
|
|
|
let activeWorkspace = workspaceManager.get_active_workspace();
|
2019-08-19 19:38:51 +00:00
|
|
|
|
return !win.is_override_redirect() &&
|
|
|
|
|
win.located_on_workspace(activeWorkspace);
|
2017-10-31 00:38:18 +00:00
|
|
|
|
});
|
2014-06-27 20:45:58 +00:00
|
|
|
|
|
|
|
|
|
if (windows.length == 0)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
let focusWindow = global.display.focus_window;
|
|
|
|
|
let nextWindow;
|
|
|
|
|
|
2019-01-29 21:02:57 +00:00
|
|
|
|
if (focusWindow == null) {
|
2014-06-27 20:45:58 +00:00
|
|
|
|
nextWindow = windows[0].metaWindow;
|
2019-01-29 21:02:57 +00:00
|
|
|
|
} else {
|
2019-08-19 17:55:49 +00:00
|
|
|
|
let index = this._lookupIndex(windows, focusWindow) + 1;
|
2014-06-27 20:45:58 +00:00
|
|
|
|
|
|
|
|
|
if (index >= windows.length)
|
|
|
|
|
index = 0;
|
|
|
|
|
|
|
|
|
|
nextWindow = windows[index].metaWindow;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Main.activateWindow(nextWindow);
|
2017-10-31 01:19:44 +00:00
|
|
|
|
}
|
2010-03-16 02:06:58 +00:00
|
|
|
|
|
2017-10-31 00:03:21 +00:00
|
|
|
|
insertWorkspace(pos) {
|
2018-01-03 07:55:38 +00:00
|
|
|
|
let workspaceManager = global.workspace_manager;
|
|
|
|
|
|
2015-01-15 22:03:24 +00:00
|
|
|
|
if (!Meta.prefs_get_dynamic_workspaces())
|
|
|
|
|
return;
|
|
|
|
|
|
2019-10-08 18:42:20 +00:00
|
|
|
|
workspaceManager.append_new_workspace(false, global.get_current_time());
|
|
|
|
|
|
|
|
|
|
let windows = global.get_window_actors().map(a => a.meta_window);
|
|
|
|
|
|
|
|
|
|
// To create a new workspace, we slide all the windows on workspaces
|
|
|
|
|
// below us to the next workspace, leaving a blank workspace for us
|
|
|
|
|
// to recycle.
|
|
|
|
|
windows.forEach(window => {
|
|
|
|
|
// If the window is attached to an ancestor, we don't need/want
|
|
|
|
|
// to move it
|
|
|
|
|
if (window.get_transient_for() != null)
|
|
|
|
|
return;
|
|
|
|
|
// Same for OR windows
|
|
|
|
|
if (window.is_override_redirect())
|
|
|
|
|
return;
|
|
|
|
|
// Sticky windows don't need moving, in fact moving would
|
|
|
|
|
// unstick them
|
|
|
|
|
if (window.on_all_workspaces)
|
|
|
|
|
return;
|
|
|
|
|
// Windows on workspaces below pos don't need moving
|
|
|
|
|
let index = window.get_workspace().index();
|
|
|
|
|
if (index < pos)
|
|
|
|
|
return;
|
|
|
|
|
window.change_workspace_by_index(index + 1, true);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// If the new workspace was inserted before the active workspace,
|
|
|
|
|
// activate the workspace to which its windows went
|
|
|
|
|
let activeIndex = workspaceManager.get_active_workspace_index();
|
|
|
|
|
if (activeIndex >= pos) {
|
|
|
|
|
let newWs = workspaceManager.get_workspace_by_index(activeIndex + 1);
|
|
|
|
|
this._blockAnimations = true;
|
|
|
|
|
newWs.activate(global.get_current_time());
|
|
|
|
|
this._blockAnimations = false;
|
|
|
|
|
}
|
2017-10-31 01:19:44 +00:00
|
|
|
|
}
|
2015-01-15 22:03:24 +00:00
|
|
|
|
|
2017-10-31 00:03:21 +00:00
|
|
|
|
keepWorkspaceAlive(workspace, duration) {
|
2013-06-16 04:21:21 +00:00
|
|
|
|
if (!this._workspaceTracker)
|
|
|
|
|
return;
|
|
|
|
|
|
2013-06-16 04:12:22 +00:00
|
|
|
|
this._workspaceTracker.keepWorkspaceAlive(workspace, duration);
|
2017-10-31 01:19:44 +00:00
|
|
|
|
}
|
2013-06-16 04:12:22 +00:00
|
|
|
|
|
2017-10-31 00:03:21 +00:00
|
|
|
|
skipNextEffect(actor) {
|
2019-11-08 17:00:05 +00:00
|
|
|
|
this._skippedActors.add(actor);
|
2017-10-31 01:19:44 +00:00
|
|
|
|
}
|
2016-09-15 15:41:52 +00:00
|
|
|
|
|
2017-10-31 00:03:21 +00:00
|
|
|
|
setCustomKeybindingHandler(name, modes, handler) {
|
2012-08-11 00:53:38 +00:00
|
|
|
|
if (Meta.keybindings_set_custom_handler(name, handler))
|
|
|
|
|
this.allowKeybinding(name, modes);
|
2017-10-31 01:19:44 +00:00
|
|
|
|
}
|
2012-08-11 00:53:38 +00:00
|
|
|
|
|
2017-10-31 00:03:21 +00:00
|
|
|
|
addKeybinding(name, settings, flags, modes, handler) {
|
2012-12-12 08:40:49 +00:00
|
|
|
|
let action = global.display.add_keybinding(name, settings, flags, handler);
|
|
|
|
|
if (action != Meta.KeyBindingAction.NONE)
|
2012-08-11 00:53:38 +00:00
|
|
|
|
this.allowKeybinding(name, modes);
|
2012-12-12 08:40:49 +00:00
|
|
|
|
return action;
|
2017-10-31 01:19:44 +00:00
|
|
|
|
}
|
2012-08-11 00:53:38 +00:00
|
|
|
|
|
2017-10-31 00:03:21 +00:00
|
|
|
|
removeKeybinding(name) {
|
2012-08-11 00:53:38 +00:00
|
|
|
|
if (global.display.remove_keybinding(name))
|
2014-12-11 14:35:40 +00:00
|
|
|
|
this.allowKeybinding(name, Shell.ActionMode.NONE);
|
2017-10-31 01:19:44 +00:00
|
|
|
|
}
|
2012-08-11 00:53:38 +00:00
|
|
|
|
|
2017-10-31 00:03:21 +00:00
|
|
|
|
allowKeybinding(name, modes) {
|
2012-08-11 00:53:38 +00:00
|
|
|
|
this._allowedKeybindings[name] = modes;
|
2017-10-31 01:19:44 +00:00
|
|
|
|
}
|
2012-08-11 00:53:38 +00:00
|
|
|
|
|
2017-10-31 00:03:21 +00:00
|
|
|
|
_shouldAnimate() {
|
2020-09-16 07:03:47 +00:00
|
|
|
|
const overviewOpen = Main.overview.visible && !Main.overview.closing;
|
|
|
|
|
return !(overviewOpen || this._workspaceAnimation.gestureActive);
|
2017-10-31 01:19:44 +00:00
|
|
|
|
}
|
2012-07-14 00:43:07 +00:00
|
|
|
|
|
2017-10-31 00:03:21 +00:00
|
|
|
|
_shouldAnimateActor(actor, types) {
|
2019-11-08 17:00:05 +00:00
|
|
|
|
if (this._skippedActors.delete(actor))
|
2016-09-15 15:41:52 +00:00
|
|
|
|
return false;
|
|
|
|
|
|
2012-07-14 00:43:07 +00:00
|
|
|
|
if (!this._shouldAnimate())
|
2009-02-03 18:25:34 +00:00
|
|
|
|
return false;
|
2014-07-07 15:18:07 +00:00
|
|
|
|
|
2017-01-25 16:42:49 +00:00
|
|
|
|
if (!actor.get_texture())
|
|
|
|
|
return false;
|
|
|
|
|
|
2014-07-07 15:18:07 +00:00
|
|
|
|
let type = actor.meta_window.get_window_type();
|
2018-07-14 20:56:22 +00:00
|
|
|
|
return types.includes(type);
|
2017-10-31 01:19:44 +00:00
|
|
|
|
}
|
2008-12-29 04:44:03 +00:00
|
|
|
|
|
2017-10-31 00:03:21 +00:00
|
|
|
|
_minimizeWindow(shellwm, actor) {
|
2014-07-07 15:18:07 +00:00
|
|
|
|
let types = [Meta.WindowType.NORMAL,
|
|
|
|
|
Meta.WindowType.MODAL_DIALOG,
|
|
|
|
|
Meta.WindowType.DIALOG];
|
|
|
|
|
if (!this._shouldAnimateActor(actor, types)) {
|
2009-09-15 17:09:51 +00:00
|
|
|
|
shellwm.completed_minimize(actor);
|
2008-12-29 04:44:03 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
actor.set_scale(1.0, 1.0);
|
|
|
|
|
|
2019-11-08 17:00:05 +00:00
|
|
|
|
this._minimizing.add(actor);
|
2010-02-05 12:50:11 +00:00
|
|
|
|
|
2013-02-18 18:26:13 +00:00
|
|
|
|
if (actor.meta_window.is_monitor_sized()) {
|
2018-07-20 19:46:19 +00:00
|
|
|
|
actor.ease({
|
|
|
|
|
opacity: 0,
|
|
|
|
|
duration: MINIMIZE_WINDOW_ANIMATION_TIME,
|
|
|
|
|
mode: Clutter.AnimationMode.EASE_OUT_QUAD,
|
2019-12-21 14:16:47 +00:00
|
|
|
|
onStopped: () => this._minimizeWindowDone(shellwm, actor),
|
2018-07-20 19:46:19 +00:00
|
|
|
|
});
|
2013-02-18 18:26:13 +00:00
|
|
|
|
} else {
|
|
|
|
|
let xDest, yDest, xScale, yScale;
|
|
|
|
|
let [success, geom] = actor.meta_window.get_icon_geometry();
|
|
|
|
|
if (success) {
|
|
|
|
|
xDest = geom.x;
|
|
|
|
|
yDest = geom.y;
|
|
|
|
|
xScale = geom.width / actor.width;
|
|
|
|
|
yScale = geom.height / actor.height;
|
|
|
|
|
} else {
|
|
|
|
|
let monitor = Main.layoutManager.monitors[actor.meta_window.get_monitor()];
|
2018-04-18 06:27:34 +00:00
|
|
|
|
if (!monitor) {
|
|
|
|
|
this._minimizeWindowDone();
|
|
|
|
|
return;
|
|
|
|
|
}
|
2013-02-18 18:26:13 +00:00
|
|
|
|
xDest = monitor.x;
|
|
|
|
|
yDest = monitor.y;
|
|
|
|
|
if (Clutter.get_default_text_direction() == Clutter.TextDirection.RTL)
|
|
|
|
|
xDest += monitor.width;
|
|
|
|
|
xScale = 0;
|
|
|
|
|
yScale = 0;
|
|
|
|
|
}
|
|
|
|
|
|
2018-07-20 19:46:19 +00:00
|
|
|
|
actor.ease({
|
|
|
|
|
scale_x: xScale,
|
|
|
|
|
scale_y: yScale,
|
|
|
|
|
x: xDest,
|
|
|
|
|
y: yDest,
|
|
|
|
|
duration: MINIMIZE_WINDOW_ANIMATION_TIME,
|
|
|
|
|
mode: Clutter.AnimationMode.EASE_IN_EXPO,
|
2019-08-20 21:43:54 +00:00
|
|
|
|
onStopped: () => this._minimizeWindowDone(shellwm, actor),
|
2018-07-20 19:46:19 +00:00
|
|
|
|
});
|
2013-02-18 18:26:13 +00:00
|
|
|
|
}
|
2017-10-31 01:19:44 +00:00
|
|
|
|
}
|
2008-12-29 04:44:03 +00:00
|
|
|
|
|
2017-10-31 00:03:21 +00:00
|
|
|
|
_minimizeWindowDone(shellwm, actor) {
|
2019-11-08 17:00:05 +00:00
|
|
|
|
if (this._minimizing.delete(actor)) {
|
2018-07-20 19:46:19 +00:00
|
|
|
|
actor.remove_all_transitions();
|
2008-12-29 04:44:03 +00:00
|
|
|
|
actor.set_scale(1.0, 1.0);
|
2013-02-18 18:26:13 +00:00
|
|
|
|
actor.set_opacity(255);
|
2014-07-07 15:18:07 +00:00
|
|
|
|
actor.set_pivot_point(0, 0);
|
2009-02-06 00:57:54 +00:00
|
|
|
|
|
2009-09-15 17:09:51 +00:00
|
|
|
|
shellwm.completed_minimize(actor);
|
2009-02-06 00:57:54 +00:00
|
|
|
|
}
|
2017-10-31 01:19:44 +00:00
|
|
|
|
}
|
2008-12-29 04:44:03 +00:00
|
|
|
|
|
2017-10-31 00:03:21 +00:00
|
|
|
|
_unminimizeWindow(shellwm, actor) {
|
2015-02-27 11:13:26 +00:00
|
|
|
|
let types = [Meta.WindowType.NORMAL,
|
|
|
|
|
Meta.WindowType.MODAL_DIALOG,
|
|
|
|
|
Meta.WindowType.DIALOG];
|
|
|
|
|
if (!this._shouldAnimateActor(actor, types)) {
|
|
|
|
|
shellwm.completed_unminimize(actor);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2019-11-08 17:00:05 +00:00
|
|
|
|
this._unminimizing.add(actor);
|
2015-02-27 11:13:26 +00:00
|
|
|
|
|
|
|
|
|
if (actor.meta_window.is_monitor_sized()) {
|
|
|
|
|
actor.opacity = 0;
|
|
|
|
|
actor.set_scale(1.0, 1.0);
|
2018-07-20 19:46:19 +00:00
|
|
|
|
actor.ease({
|
|
|
|
|
opacity: 255,
|
|
|
|
|
duration: MINIMIZE_WINDOW_ANIMATION_TIME,
|
|
|
|
|
mode: Clutter.AnimationMode.EASE_OUT_QUAD,
|
2019-08-20 21:43:54 +00:00
|
|
|
|
onStopped: () => this._unminimizeWindowDone(shellwm, actor),
|
2018-07-20 19:46:19 +00:00
|
|
|
|
});
|
2015-02-27 11:13:26 +00:00
|
|
|
|
} else {
|
|
|
|
|
let [success, geom] = actor.meta_window.get_icon_geometry();
|
|
|
|
|
if (success) {
|
|
|
|
|
actor.set_position(geom.x, geom.y);
|
|
|
|
|
actor.set_scale(geom.width / actor.width,
|
|
|
|
|
geom.height / actor.height);
|
|
|
|
|
} else {
|
|
|
|
|
let monitor = Main.layoutManager.monitors[actor.meta_window.get_monitor()];
|
2018-04-18 06:27:34 +00:00
|
|
|
|
if (!monitor) {
|
|
|
|
|
actor.show();
|
|
|
|
|
this._unminimizeWindowDone();
|
|
|
|
|
return;
|
|
|
|
|
}
|
2015-02-27 11:13:26 +00:00
|
|
|
|
actor.set_position(monitor.x, monitor.y);
|
|
|
|
|
if (Clutter.get_default_text_direction() == Clutter.TextDirection.RTL)
|
|
|
|
|
actor.x += monitor.width;
|
|
|
|
|
actor.set_scale(0, 0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let rect = actor.meta_window.get_frame_rect();
|
|
|
|
|
let [xDest, yDest] = [rect.x, rect.y];
|
|
|
|
|
|
|
|
|
|
actor.show();
|
2018-07-20 19:46:19 +00:00
|
|
|
|
actor.ease({
|
|
|
|
|
scale_x: 1,
|
|
|
|
|
scale_y: 1,
|
|
|
|
|
x: xDest,
|
|
|
|
|
y: yDest,
|
|
|
|
|
duration: MINIMIZE_WINDOW_ANIMATION_TIME,
|
|
|
|
|
mode: Clutter.AnimationMode.EASE_IN_EXPO,
|
2019-08-20 21:43:54 +00:00
|
|
|
|
onStopped: () => this._unminimizeWindowDone(shellwm, actor),
|
2018-07-20 19:46:19 +00:00
|
|
|
|
});
|
2015-02-27 11:13:26 +00:00
|
|
|
|
}
|
2017-10-31 01:19:44 +00:00
|
|
|
|
}
|
2015-02-27 11:13:26 +00:00
|
|
|
|
|
2017-10-31 00:03:21 +00:00
|
|
|
|
_unminimizeWindowDone(shellwm, actor) {
|
2019-11-08 17:00:05 +00:00
|
|
|
|
if (this._unminimizing.delete(actor)) {
|
2018-07-20 19:46:19 +00:00
|
|
|
|
actor.remove_all_transitions();
|
2015-02-27 11:13:26 +00:00
|
|
|
|
actor.set_scale(1.0, 1.0);
|
|
|
|
|
actor.set_opacity(255);
|
|
|
|
|
actor.set_pivot_point(0, 0);
|
|
|
|
|
|
|
|
|
|
shellwm.completed_unminimize(actor);
|
|
|
|
|
}
|
2017-10-31 01:19:44 +00:00
|
|
|
|
}
|
2015-02-27 11:13:26 +00:00
|
|
|
|
|
2019-01-31 14:08:10 +00:00
|
|
|
|
_sizeChangeWindow(shellwm, actor, whichChange, oldFrameRect, _oldBufferRect) {
|
2020-05-12 10:22:52 +00:00
|
|
|
|
const types = [Meta.WindowType.NORMAL];
|
|
|
|
|
const shouldAnimate =
|
|
|
|
|
this._shouldAnimateActor(actor, types) &&
|
|
|
|
|
oldFrameRect.width > 0 &&
|
|
|
|
|
oldFrameRect.height > 0;
|
2013-09-01 20:03:59 +00:00
|
|
|
|
|
2020-05-12 10:22:52 +00:00
|
|
|
|
if (shouldAnimate)
|
2017-05-20 17:34:51 +00:00
|
|
|
|
this._prepareAnimationInfo(shellwm, actor, oldFrameRect, whichChange);
|
2013-09-01 20:03:59 +00:00
|
|
|
|
else
|
|
|
|
|
shellwm.completed_size_change(actor);
|
2017-10-31 01:19:44 +00:00
|
|
|
|
}
|
2013-09-01 20:03:59 +00:00
|
|
|
|
|
2019-01-31 14:08:10 +00:00
|
|
|
|
_prepareAnimationInfo(shellwm, actor, oldFrameRect, _change) {
|
2013-09-01 20:03:59 +00:00
|
|
|
|
// Position a clone of the window on top of the old position,
|
|
|
|
|
// while actor updates are frozen.
|
|
|
|
|
let actorContent = Shell.util_get_content_for_window_actor(actor, oldFrameRect);
|
|
|
|
|
let actorClone = new St.Widget({ content: actorContent });
|
2020-02-26 03:53:40 +00:00
|
|
|
|
actorClone.set_offscreen_redirect(Clutter.OffscreenRedirect.ALWAYS);
|
2013-09-01 20:03:59 +00:00
|
|
|
|
actorClone.set_position(oldFrameRect.x, oldFrameRect.y);
|
|
|
|
|
actorClone.set_size(oldFrameRect.width, oldFrameRect.height);
|
|
|
|
|
|
2020-05-12 11:50:05 +00:00
|
|
|
|
actor.freeze();
|
|
|
|
|
|
2020-05-12 10:28:03 +00:00
|
|
|
|
if (this._clearAnimationInfo(actor)) {
|
|
|
|
|
log('Old animationInfo removed from actor %s'.format(actor));
|
2016-09-26 15:58:25 +00:00
|
|
|
|
this._shellwm.completed_size_change(actor);
|
2020-05-12 10:28:03 +00:00
|
|
|
|
}
|
2016-09-26 15:58:25 +00:00
|
|
|
|
|
2019-02-07 19:27:35 +00:00
|
|
|
|
let destroyId = actor.connect('destroy', () => {
|
|
|
|
|
this._clearAnimationInfo(actor);
|
|
|
|
|
});
|
|
|
|
|
|
2019-11-08 17:22:40 +00:00
|
|
|
|
this._resizePending.add(actor);
|
2020-05-12 11:50:05 +00:00
|
|
|
|
actor.__animationInfo = {
|
|
|
|
|
clone: actorClone,
|
|
|
|
|
oldRect: oldFrameRect,
|
|
|
|
|
frozen: true,
|
|
|
|
|
destroyId,
|
|
|
|
|
};
|
2017-10-31 01:19:44 +00:00
|
|
|
|
}
|
2016-09-26 15:58:25 +00:00
|
|
|
|
|
2017-10-31 00:03:21 +00:00
|
|
|
|
_sizeChangedWindow(shellwm, actor) {
|
2017-05-20 17:34:51 +00:00
|
|
|
|
if (!actor.__animationInfo)
|
2016-09-26 15:58:25 +00:00
|
|
|
|
return;
|
2019-11-08 17:00:05 +00:00
|
|
|
|
if (this._resizing.has(actor))
|
2017-01-25 16:47:18 +00:00
|
|
|
|
return;
|
2016-09-26 15:58:25 +00:00
|
|
|
|
|
2017-05-20 17:34:51 +00:00
|
|
|
|
let actorClone = actor.__animationInfo.clone;
|
2016-09-26 15:58:25 +00:00
|
|
|
|
let targetRect = actor.meta_window.get_frame_rect();
|
2017-05-20 17:34:51 +00:00
|
|
|
|
let sourceRect = actor.__animationInfo.oldRect;
|
2013-09-01 20:03:59 +00:00
|
|
|
|
|
2017-05-20 15:04:08 +00:00
|
|
|
|
let scaleX = targetRect.width / sourceRect.width;
|
|
|
|
|
let scaleY = targetRect.height / sourceRect.height;
|
2016-09-26 15:58:25 +00:00
|
|
|
|
|
2019-11-08 17:22:40 +00:00
|
|
|
|
this._resizePending.delete(actor);
|
2019-11-08 17:00:05 +00:00
|
|
|
|
this._resizing.add(actor);
|
2013-09-01 20:03:59 +00:00
|
|
|
|
|
2020-02-28 15:43:48 +00:00
|
|
|
|
Main.uiGroup.add_child(actorClone);
|
|
|
|
|
|
2013-09-01 20:03:59 +00:00
|
|
|
|
// Now scale and fade out the clone
|
2018-07-20 19:46:19 +00:00
|
|
|
|
actorClone.ease({
|
|
|
|
|
x: targetRect.x,
|
|
|
|
|
y: targetRect.y,
|
|
|
|
|
scale_x: scaleX,
|
|
|
|
|
scale_y: scaleY,
|
|
|
|
|
opacity: 0,
|
|
|
|
|
duration: WINDOW_ANIMATION_TIME,
|
2019-08-20 21:43:54 +00:00
|
|
|
|
mode: Clutter.AnimationMode.EASE_OUT_QUAD,
|
2018-07-20 19:46:19 +00:00
|
|
|
|
});
|
2013-09-01 20:03:59 +00:00
|
|
|
|
|
2017-05-20 14:34:35 +00:00
|
|
|
|
actor.translation_x = -targetRect.x + sourceRect.x;
|
|
|
|
|
actor.translation_y = -targetRect.y + sourceRect.y;
|
2016-09-26 15:58:25 +00:00
|
|
|
|
|
2013-09-01 20:03:59 +00:00
|
|
|
|
// Now set scale the actor to size it as the clone.
|
|
|
|
|
actor.scale_x = 1 / scaleX;
|
|
|
|
|
actor.scale_y = 1 / scaleY;
|
|
|
|
|
|
|
|
|
|
// Scale it to its actual new size
|
2018-07-20 19:46:19 +00:00
|
|
|
|
actor.ease({
|
|
|
|
|
scale_x: 1,
|
|
|
|
|
scale_y: 1,
|
|
|
|
|
translation_x: 0,
|
|
|
|
|
translation_y: 0,
|
|
|
|
|
duration: WINDOW_ANIMATION_TIME,
|
|
|
|
|
mode: Clutter.AnimationMode.EASE_OUT_QUAD,
|
2019-08-20 21:43:54 +00:00
|
|
|
|
onStopped: () => this._sizeChangeWindowDone(shellwm, actor),
|
2018-07-20 19:46:19 +00:00
|
|
|
|
});
|
2013-09-01 20:03:59 +00:00
|
|
|
|
|
2020-10-02 08:33:31 +00:00
|
|
|
|
// ease didn't animate and cleared the info, we are done
|
|
|
|
|
if (!actor.__animationInfo)
|
|
|
|
|
return;
|
|
|
|
|
|
2013-09-01 20:03:59 +00:00
|
|
|
|
// Now unfreeze actor updates, to get it to the new size.
|
|
|
|
|
// It's important that we don't wait until the animation is completed to
|
|
|
|
|
// do this, otherwise our scale will be applied to the old texture size.
|
2020-05-12 11:50:05 +00:00
|
|
|
|
actor.thaw();
|
|
|
|
|
actor.__animationInfo.frozen = false;
|
2017-10-31 01:19:44 +00:00
|
|
|
|
}
|
2008-12-29 04:44:03 +00:00
|
|
|
|
|
2017-10-31 00:03:21 +00:00
|
|
|
|
_clearAnimationInfo(actor) {
|
2017-05-20 17:34:51 +00:00
|
|
|
|
if (actor.__animationInfo) {
|
|
|
|
|
actor.__animationInfo.clone.destroy();
|
2019-02-07 19:27:35 +00:00
|
|
|
|
actor.disconnect(actor.__animationInfo.destroyId);
|
2020-05-12 11:50:05 +00:00
|
|
|
|
if (actor.__animationInfo.frozen)
|
|
|
|
|
actor.thaw();
|
|
|
|
|
|
2017-05-20 17:34:51 +00:00
|
|
|
|
delete actor.__animationInfo;
|
2016-09-26 15:58:25 +00:00
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
2017-10-31 01:19:44 +00:00
|
|
|
|
}
|
2016-09-26 15:58:25 +00:00
|
|
|
|
|
2017-10-31 00:03:21 +00:00
|
|
|
|
_sizeChangeWindowDone(shellwm, actor) {
|
2019-11-08 17:00:05 +00:00
|
|
|
|
if (this._resizing.delete(actor)) {
|
2018-07-20 19:46:19 +00:00
|
|
|
|
actor.remove_all_transitions();
|
2013-09-01 20:03:59 +00:00
|
|
|
|
actor.scale_x = 1.0;
|
|
|
|
|
actor.scale_y = 1.0;
|
|
|
|
|
actor.translation_x = 0;
|
|
|
|
|
actor.translation_y = 0;
|
2017-05-20 17:34:51 +00:00
|
|
|
|
this._clearAnimationInfo(actor);
|
2020-05-12 11:50:05 +00:00
|
|
|
|
this._shellwm.completed_size_change(actor);
|
2013-09-01 20:03:59 +00:00
|
|
|
|
}
|
2019-11-08 17:22:40 +00:00
|
|
|
|
|
2020-05-12 11:51:27 +00:00
|
|
|
|
if (this._resizePending.delete(actor)) {
|
|
|
|
|
this._clearAnimationInfo(actor);
|
2019-11-08 17:22:40 +00:00
|
|
|
|
this._shellwm.completed_size_change(actor);
|
2020-05-12 11:51:27 +00:00
|
|
|
|
}
|
2017-10-31 01:19:44 +00:00
|
|
|
|
}
|
2013-09-01 20:03:59 +00:00
|
|
|
|
|
2017-10-31 00:03:21 +00:00
|
|
|
|
_hasAttachedDialogs(window, ignoreWindow) {
|
2010-09-11 01:30:50 +00:00
|
|
|
|
var count = 0;
|
2017-10-31 00:38:18 +00:00
|
|
|
|
window.foreach_transient(win => {
|
2016-08-22 14:56:41 +00:00
|
|
|
|
if (win != ignoreWindow &&
|
|
|
|
|
win.is_attached_dialog() &&
|
|
|
|
|
win.get_transient_for() == window) {
|
2010-09-11 01:30:50 +00:00
|
|
|
|
count++;
|
2016-08-22 14:56:41 +00:00
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
return true;
|
2010-09-11 01:30:50 +00:00
|
|
|
|
});
|
|
|
|
|
return count != 0;
|
2017-10-31 01:19:44 +00:00
|
|
|
|
}
|
2010-09-11 01:30:50 +00:00
|
|
|
|
|
2017-10-31 00:03:21 +00:00
|
|
|
|
_checkDimming(window, ignoreWindow) {
|
2011-04-05 14:16:50 +00:00
|
|
|
|
let shouldDim = this._hasAttachedDialogs(window, ignoreWindow);
|
2011-03-08 03:09:41 +00:00
|
|
|
|
|
|
|
|
|
if (shouldDim && !window._dimmed) {
|
|
|
|
|
window._dimmed = true;
|
|
|
|
|
this._dimmedWindows.push(window);
|
2012-08-29 22:51:53 +00:00
|
|
|
|
this._dimWindow(window);
|
2011-03-08 03:09:41 +00:00
|
|
|
|
} else if (!shouldDim && window._dimmed) {
|
|
|
|
|
window._dimmed = false;
|
2017-10-31 00:38:18 +00:00
|
|
|
|
this._dimmedWindows =
|
|
|
|
|
this._dimmedWindows.filter(win => win != window);
|
2012-08-29 22:51:53 +00:00
|
|
|
|
this._undimWindow(window);
|
2010-09-30 21:09:15 +00:00
|
|
|
|
}
|
2017-10-31 01:19:44 +00:00
|
|
|
|
}
|
2010-09-30 21:09:15 +00:00
|
|
|
|
|
2017-10-31 00:03:21 +00:00
|
|
|
|
_dimWindow(window) {
|
2011-03-08 03:09:41 +00:00
|
|
|
|
let actor = window.get_compositor_private();
|
|
|
|
|
if (!actor)
|
2010-09-11 01:30:50 +00:00
|
|
|
|
return;
|
2012-07-13 17:57:36 +00:00
|
|
|
|
let dimmer = getWindowDimmer(actor);
|
2012-08-30 19:32:44 +00:00
|
|
|
|
if (!dimmer)
|
2012-07-13 17:57:36 +00:00
|
|
|
|
return;
|
2018-07-22 01:31:54 +00:00
|
|
|
|
dimmer.setDimmed(true, this._shouldAnimate());
|
2017-10-31 01:19:44 +00:00
|
|
|
|
}
|
2010-09-11 01:30:50 +00:00
|
|
|
|
|
2017-10-31 00:03:21 +00:00
|
|
|
|
_undimWindow(window) {
|
2011-03-08 03:09:41 +00:00
|
|
|
|
let actor = window.get_compositor_private();
|
|
|
|
|
if (!actor)
|
2010-09-11 01:30:50 +00:00
|
|
|
|
return;
|
2012-07-13 17:57:36 +00:00
|
|
|
|
let dimmer = getWindowDimmer(actor);
|
2012-08-30 19:32:44 +00:00
|
|
|
|
if (!dimmer)
|
2012-07-13 17:57:36 +00:00
|
|
|
|
return;
|
2018-07-22 01:31:54 +00:00
|
|
|
|
dimmer.setDimmed(false, this._shouldAnimate());
|
2017-10-31 01:19:44 +00:00
|
|
|
|
}
|
2010-09-11 01:30:50 +00:00
|
|
|
|
|
2020-09-17 07:25:49 +00:00
|
|
|
|
_waitForOverviewToHide() {
|
|
|
|
|
if (!Main.overview.visible)
|
|
|
|
|
return Promise.resolve();
|
|
|
|
|
|
|
|
|
|
return new Promise(resolve => {
|
|
|
|
|
const id = Main.overview.connect('hidden', () => {
|
|
|
|
|
Main.overview.disconnect(id);
|
|
|
|
|
resolve();
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async _mapWindow(shellwm, actor) {
|
2010-09-30 21:09:15 +00:00
|
|
|
|
actor._windowType = actor.meta_window.get_window_type();
|
2017-10-31 00:38:18 +00:00
|
|
|
|
actor._notifyWindowTypeSignalId =
|
|
|
|
|
actor.meta_window.connect('notify::window-type', () => {
|
|
|
|
|
let type = actor.meta_window.get_window_type();
|
|
|
|
|
if (type == actor._windowType)
|
|
|
|
|
return;
|
|
|
|
|
if (type == Meta.WindowType.MODAL_DIALOG ||
|
|
|
|
|
actor._windowType == Meta.WindowType.MODAL_DIALOG) {
|
|
|
|
|
let parent = actor.get_meta_window().get_transient_for();
|
|
|
|
|
if (parent)
|
|
|
|
|
this._checkDimming(parent);
|
|
|
|
|
}
|
2010-09-30 21:09:15 +00:00
|
|
|
|
|
2017-10-31 00:38:18 +00:00
|
|
|
|
actor._windowType = type;
|
|
|
|
|
});
|
|
|
|
|
actor.meta_window.connect('unmanaged', window => {
|
|
|
|
|
let parent = window.get_transient_for();
|
|
|
|
|
if (parent)
|
|
|
|
|
this._checkDimming(parent);
|
|
|
|
|
});
|
2012-12-15 02:23:36 +00:00
|
|
|
|
|
2016-02-22 16:59:05 +00:00
|
|
|
|
if (actor.meta_window.is_attached_dialog())
|
|
|
|
|
this._checkDimming(actor.get_meta_window().get_transient_for());
|
|
|
|
|
|
2014-07-07 15:18:07 +00:00
|
|
|
|
let types = [Meta.WindowType.NORMAL,
|
|
|
|
|
Meta.WindowType.DIALOG,
|
|
|
|
|
Meta.WindowType.MODAL_DIALOG];
|
|
|
|
|
if (!this._shouldAnimateActor(actor, types)) {
|
2009-09-15 17:09:51 +00:00
|
|
|
|
shellwm.completed_map(actor);
|
2008-12-29 04:44:03 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2014-07-07 15:18:07 +00:00
|
|
|
|
switch (actor._windowType) {
|
|
|
|
|
case Meta.WindowType.NORMAL:
|
|
|
|
|
actor.set_pivot_point(0.5, 1.0);
|
|
|
|
|
actor.scale_x = 0.01;
|
2014-07-28 16:12:30 +00:00
|
|
|
|
actor.scale_y = 0.05;
|
2014-07-07 15:18:07 +00:00
|
|
|
|
actor.opacity = 0;
|
2012-12-15 02:23:36 +00:00
|
|
|
|
actor.show();
|
2019-11-08 17:00:05 +00:00
|
|
|
|
this._mapping.add(actor);
|
2010-04-02 18:30:10 +00:00
|
|
|
|
|
2020-09-17 07:25:49 +00:00
|
|
|
|
await this._waitForOverviewToHide();
|
2018-07-20 19:46:19 +00:00
|
|
|
|
actor.ease({
|
|
|
|
|
opacity: 255,
|
|
|
|
|
scale_x: 1,
|
|
|
|
|
scale_y: 1,
|
|
|
|
|
duration: SHOW_WINDOW_ANIMATION_TIME,
|
|
|
|
|
mode: Clutter.AnimationMode.EASE_OUT_EXPO,
|
2019-08-20 21:43:54 +00:00
|
|
|
|
onStopped: () => this._mapWindowDone(shellwm, actor),
|
2018-07-20 19:46:19 +00:00
|
|
|
|
});
|
2014-07-07 15:18:07 +00:00
|
|
|
|
break;
|
|
|
|
|
case Meta.WindowType.MODAL_DIALOG:
|
|
|
|
|
case Meta.WindowType.DIALOG:
|
|
|
|
|
actor.set_pivot_point(0.5, 0.5);
|
|
|
|
|
actor.scale_y = 0;
|
2012-12-15 02:23:36 +00:00
|
|
|
|
actor.opacity = 0;
|
|
|
|
|
actor.show();
|
2019-11-08 17:00:05 +00:00
|
|
|
|
this._mapping.add(actor);
|
2012-12-15 02:23:36 +00:00
|
|
|
|
|
2020-09-17 07:25:49 +00:00
|
|
|
|
await this._waitForOverviewToHide();
|
2018-07-20 19:46:19 +00:00
|
|
|
|
actor.ease({
|
|
|
|
|
opacity: 255,
|
|
|
|
|
scale_x: 1,
|
|
|
|
|
scale_y: 1,
|
|
|
|
|
duration: DIALOG_SHOW_WINDOW_ANIMATION_TIME,
|
|
|
|
|
mode: Clutter.AnimationMode.EASE_OUT_QUAD,
|
2019-08-20 21:43:54 +00:00
|
|
|
|
onStopped: () => this._mapWindowDone(shellwm, actor),
|
2018-07-20 19:46:19 +00:00
|
|
|
|
});
|
2014-07-07 15:18:07 +00:00
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
shellwm.completed_map(actor);
|
2012-12-15 02:23:36 +00:00
|
|
|
|
}
|
2017-10-31 01:19:44 +00:00
|
|
|
|
}
|
2008-12-29 04:44:03 +00:00
|
|
|
|
|
2017-10-31 00:03:21 +00:00
|
|
|
|
_mapWindowDone(shellwm, actor) {
|
2019-11-08 17:00:05 +00:00
|
|
|
|
if (this._mapping.delete(actor)) {
|
2018-07-20 19:46:19 +00:00
|
|
|
|
actor.remove_all_transitions();
|
2010-04-02 18:30:10 +00:00
|
|
|
|
actor.opacity = 255;
|
2014-07-07 15:18:07 +00:00
|
|
|
|
actor.set_pivot_point(0, 0);
|
2012-12-16 19:02:17 +00:00
|
|
|
|
actor.scale_y = 1;
|
2014-07-07 15:18:07 +00:00
|
|
|
|
actor.scale_x = 1;
|
|
|
|
|
actor.translation_y = 0;
|
|
|
|
|
actor.translation_x = 0;
|
2009-09-15 17:09:51 +00:00
|
|
|
|
shellwm.completed_map(actor);
|
2009-02-06 00:57:54 +00:00
|
|
|
|
}
|
2017-10-31 01:19:44 +00:00
|
|
|
|
}
|
2009-02-06 00:57:54 +00:00
|
|
|
|
|
2017-10-31 00:03:21 +00:00
|
|
|
|
_destroyWindow(shellwm, actor) {
|
2011-03-08 03:09:41 +00:00
|
|
|
|
let window = actor.meta_window;
|
2010-09-30 21:09:15 +00:00
|
|
|
|
if (actor._notifyWindowTypeSignalId) {
|
2011-03-08 03:09:41 +00:00
|
|
|
|
window.disconnect(actor._notifyWindowTypeSignalId);
|
2010-09-30 21:09:15 +00:00
|
|
|
|
actor._notifyWindowTypeSignalId = 0;
|
|
|
|
|
}
|
2011-03-08 03:09:41 +00:00
|
|
|
|
if (window._dimmed) {
|
2017-10-31 00:38:18 +00:00
|
|
|
|
this._dimmedWindows =
|
|
|
|
|
this._dimmedWindows.filter(win => win != window);
|
2011-03-08 03:09:41 +00:00
|
|
|
|
}
|
2012-12-15 02:23:36 +00:00
|
|
|
|
|
2016-02-22 16:59:05 +00:00
|
|
|
|
if (window.is_attached_dialog())
|
|
|
|
|
this._checkDimming(window.get_transient_for(), window);
|
|
|
|
|
|
2014-07-08 09:51:49 +00:00
|
|
|
|
let types = [Meta.WindowType.NORMAL,
|
|
|
|
|
Meta.WindowType.DIALOG,
|
|
|
|
|
Meta.WindowType.MODAL_DIALOG];
|
|
|
|
|
if (!this._shouldAnimateActor(actor, types)) {
|
2012-12-15 02:23:36 +00:00
|
|
|
|
shellwm.completed_destroy(actor);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2017-06-13 03:51:31 +00:00
|
|
|
|
switch (actor.meta_window.window_type) {
|
2014-07-08 09:51:49 +00:00
|
|
|
|
case Meta.WindowType.NORMAL:
|
2014-06-27 14:53:14 +00:00
|
|
|
|
actor.set_pivot_point(0.5, 0.5);
|
2019-11-08 17:00:05 +00:00
|
|
|
|
this._destroying.add(actor);
|
2010-09-15 11:52:20 +00:00
|
|
|
|
|
2018-07-20 19:46:19 +00:00
|
|
|
|
actor.ease({
|
|
|
|
|
opacity: 0,
|
|
|
|
|
scale_x: 0.8,
|
|
|
|
|
scale_y: 0.8,
|
|
|
|
|
duration: DESTROY_WINDOW_ANIMATION_TIME,
|
|
|
|
|
mode: Clutter.AnimationMode.EASE_OUT_QUAD,
|
2019-08-20 21:43:54 +00:00
|
|
|
|
onStopped: () => this._destroyWindowDone(shellwm, actor),
|
2018-07-20 19:46:19 +00:00
|
|
|
|
});
|
2014-07-08 09:51:49 +00:00
|
|
|
|
break;
|
|
|
|
|
case Meta.WindowType.MODAL_DIALOG:
|
|
|
|
|
case Meta.WindowType.DIALOG:
|
|
|
|
|
actor.set_pivot_point(0.5, 0.5);
|
2019-11-08 17:00:05 +00:00
|
|
|
|
this._destroying.add(actor);
|
2014-07-08 09:51:49 +00:00
|
|
|
|
|
|
|
|
|
if (window.is_attached_dialog()) {
|
|
|
|
|
let parent = window.get_transient_for();
|
2017-10-31 00:38:18 +00:00
|
|
|
|
actor._parentDestroyId = parent.connect('unmanaged', () => {
|
2018-07-20 19:46:19 +00:00
|
|
|
|
actor.remove_all_transitions();
|
2014-07-08 09:51:49 +00:00
|
|
|
|
this._destroyWindowDone(shellwm, actor);
|
2017-10-31 00:38:18 +00:00
|
|
|
|
});
|
2014-07-08 09:51:49 +00:00
|
|
|
|
}
|
2010-09-11 01:30:50 +00:00
|
|
|
|
|
2018-07-20 19:46:19 +00:00
|
|
|
|
actor.ease({
|
|
|
|
|
scale_y: 0,
|
|
|
|
|
duration: DIALOG_DESTROY_WINDOW_ANIMATION_TIME,
|
|
|
|
|
mode: Clutter.AnimationMode.EASE_OUT_QUAD,
|
2019-08-20 21:43:54 +00:00
|
|
|
|
onStopped: () => this._destroyWindowDone(shellwm, actor),
|
2018-07-20 19:46:19 +00:00
|
|
|
|
});
|
2014-07-08 09:51:49 +00:00
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
shellwm.completed_destroy(actor);
|
2010-09-11 01:30:50 +00:00
|
|
|
|
}
|
2017-10-31 01:19:44 +00:00
|
|
|
|
}
|
2010-09-11 01:30:50 +00:00
|
|
|
|
|
2017-10-31 00:03:21 +00:00
|
|
|
|
_destroyWindowDone(shellwm, actor) {
|
2019-11-08 17:00:05 +00:00
|
|
|
|
if (this._destroying.delete(actor)) {
|
2020-10-24 20:24:35 +00:00
|
|
|
|
const parent = actor.get_meta_window()?.get_transient_for();
|
2010-09-15 11:52:20 +00:00
|
|
|
|
if (parent && actor._parentDestroyId) {
|
|
|
|
|
parent.disconnect(actor._parentDestroyId);
|
|
|
|
|
actor._parentDestroyId = 0;
|
2010-09-11 01:30:50 +00:00
|
|
|
|
}
|
2010-09-15 11:52:20 +00:00
|
|
|
|
shellwm.completed_destroy(actor);
|
2010-09-11 01:30:50 +00:00
|
|
|
|
}
|
2017-10-31 01:19:44 +00:00
|
|
|
|
}
|
2008-12-29 04:44:03 +00:00
|
|
|
|
|
2017-10-31 00:03:21 +00:00
|
|
|
|
_filterKeybinding(shellwm, binding) {
|
2014-12-11 14:35:40 +00:00
|
|
|
|
if (Main.actionMode == Shell.ActionMode.NONE)
|
2012-08-20 14:20:23 +00:00
|
|
|
|
return true;
|
2012-08-20 08:38:13 +00:00
|
|
|
|
|
2012-08-11 00:53:38 +00:00
|
|
|
|
// There's little sense in implementing a keybinding in mutter and
|
|
|
|
|
// not having it work in NORMAL mode; handle this case generically
|
|
|
|
|
// so we don't have to explicitly allow all builtin keybindings in
|
|
|
|
|
// NORMAL mode.
|
2014-12-11 14:35:40 +00:00
|
|
|
|
if (Main.actionMode == Shell.ActionMode.NORMAL &&
|
2012-08-11 00:53:38 +00:00
|
|
|
|
binding.is_builtin())
|
2012-08-20 08:38:13 +00:00
|
|
|
|
return false;
|
|
|
|
|
|
2014-12-11 14:35:40 +00:00
|
|
|
|
return !(this._allowedKeybindings[binding.get_name()] & Main.actionMode);
|
2017-10-31 01:19:44 +00:00
|
|
|
|
}
|
2012-08-20 08:38:13 +00:00
|
|
|
|
|
2018-07-13 13:04:02 +00:00
|
|
|
|
_switchWorkspace(shellwm, from, to, direction) {
|
|
|
|
|
if (!Main.sessionMode.hasWorkspaces || !this._shouldAnimate()) {
|
|
|
|
|
shellwm.completed_switch_workspace();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2020-01-21 13:09:56 +00:00
|
|
|
|
this._switchInProgress = true;
|
|
|
|
|
|
|
|
|
|
this._workspaceAnimation.animateSwitch(from, to, direction, () => {
|
|
|
|
|
this._shellwm.completed_switch_workspace();
|
|
|
|
|
this._switchInProgress = false;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_switchWorkspaceDone() {
|
|
|
|
|
if (!this._switchInProgress)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
this._shellwm.completed_switch_workspace();
|
|
|
|
|
this._switchInProgress = false;
|
2019-06-30 12:15:44 +00:00
|
|
|
|
}
|
|
|
|
|
|
2017-10-31 00:03:21 +00:00
|
|
|
|
_showTilePreview(shellwm, window, tileRect, monitorIndex) {
|
2013-09-01 22:26:12 +00:00
|
|
|
|
if (!this._tilePreview)
|
|
|
|
|
this._tilePreview = new TilePreview();
|
2019-08-28 20:06:14 +00:00
|
|
|
|
this._tilePreview.open(window, tileRect, monitorIndex);
|
2017-10-31 01:19:44 +00:00
|
|
|
|
}
|
2013-09-01 22:26:12 +00:00
|
|
|
|
|
2019-02-04 11:30:53 +00:00
|
|
|
|
_hideTilePreview() {
|
2013-09-01 22:26:12 +00:00
|
|
|
|
if (!this._tilePreview)
|
|
|
|
|
return;
|
2019-08-28 20:06:14 +00:00
|
|
|
|
this._tilePreview.close();
|
2017-10-31 01:19:44 +00:00
|
|
|
|
}
|
2013-09-01 22:26:12 +00:00
|
|
|
|
|
2017-10-31 00:03:21 +00:00
|
|
|
|
_showWindowMenu(shellwm, window, menu, rect) {
|
2014-06-02 19:47:24 +00:00
|
|
|
|
this._windowMenuManager.showWindowMenuForWindow(window, menu, rect);
|
2017-10-31 01:19:44 +00:00
|
|
|
|
}
|
2014-03-13 22:51:10 +00:00
|
|
|
|
|
2018-01-03 07:55:38 +00:00
|
|
|
|
_startSwitcher(display, window, binding) {
|
2016-05-19 14:36:46 +00:00
|
|
|
|
let constructor = null;
|
|
|
|
|
switch (binding.get_name()) {
|
2019-02-01 12:21:00 +00:00
|
|
|
|
case 'switch-applications':
|
|
|
|
|
case 'switch-applications-backward':
|
|
|
|
|
case 'switch-group':
|
|
|
|
|
case 'switch-group-backward':
|
|
|
|
|
constructor = AltTab.AppSwitcherPopup;
|
|
|
|
|
break;
|
|
|
|
|
case 'switch-windows':
|
|
|
|
|
case 'switch-windows-backward':
|
|
|
|
|
constructor = AltTab.WindowSwitcherPopup;
|
|
|
|
|
break;
|
|
|
|
|
case 'cycle-windows':
|
|
|
|
|
case 'cycle-windows-backward':
|
|
|
|
|
constructor = AltTab.WindowCyclerPopup;
|
|
|
|
|
break;
|
|
|
|
|
case 'cycle-group':
|
|
|
|
|
case 'cycle-group-backward':
|
|
|
|
|
constructor = AltTab.GroupCyclerPopup;
|
|
|
|
|
break;
|
|
|
|
|
case 'switch-monitor':
|
|
|
|
|
constructor = SwitchMonitor.SwitchMonitorPopup;
|
|
|
|
|
break;
|
2016-05-19 14:36:46 +00:00
|
|
|
|
}
|
2016-05-19 12:41:24 +00:00
|
|
|
|
|
2016-05-19 14:36:46 +00:00
|
|
|
|
if (!constructor)
|
|
|
|
|
return;
|
2016-05-19 12:41:24 +00:00
|
|
|
|
|
|
|
|
|
/* prevent a corner case where both popups show up at once */
|
|
|
|
|
if (this._workspaceSwitcherPopup != null)
|
|
|
|
|
this._workspaceSwitcherPopup.destroy();
|
|
|
|
|
|
2016-05-19 14:36:46 +00:00
|
|
|
|
let tabPopup = new constructor();
|
2016-05-19 12:41:24 +00:00
|
|
|
|
|
|
|
|
|
if (!tabPopup.show(binding.is_reversed(), binding.get_name(), binding.get_mask()))
|
|
|
|
|
tabPopup.destroy();
|
2017-10-31 01:19:44 +00:00
|
|
|
|
}
|
2016-05-19 12:41:24 +00:00
|
|
|
|
|
2018-01-03 07:55:38 +00:00
|
|
|
|
_startA11ySwitcher(display, window, binding) {
|
2014-05-29 21:26:25 +00:00
|
|
|
|
Main.ctrlAltTabManager.popup(binding.is_reversed(), binding.get_name(), binding.get_mask());
|
2017-10-31 01:19:44 +00:00
|
|
|
|
}
|
2011-02-07 16:29:34 +00:00
|
|
|
|
|
2019-05-29 15:20:23 +00:00
|
|
|
|
_allowFavoriteShortcuts() {
|
|
|
|
|
return Main.sessionMode.hasOverview;
|
|
|
|
|
}
|
|
|
|
|
|
2019-01-29 10:48:06 +00:00
|
|
|
|
_switchToApplication(display, window, binding) {
|
2019-05-29 15:20:23 +00:00
|
|
|
|
if (!this._allowFavoriteShortcuts())
|
|
|
|
|
return;
|
|
|
|
|
|
2019-01-29 01:27:05 +00:00
|
|
|
|
let [, , , target] = binding.get_name().split('-');
|
2019-01-29 10:48:06 +00:00
|
|
|
|
let apps = AppFavorites.getAppFavorites().getFavorites();
|
|
|
|
|
let app = apps[target - 1];
|
2021-05-08 10:28:06 +00:00
|
|
|
|
if (app) {
|
|
|
|
|
Main.overview.hide();
|
2019-01-29 10:48:06 +00:00
|
|
|
|
app.activate();
|
2021-05-08 10:28:06 +00:00
|
|
|
|
}
|
2019-01-29 10:48:06 +00:00
|
|
|
|
}
|
|
|
|
|
|
2019-02-04 11:30:53 +00:00
|
|
|
|
_toggleAppMenu() {
|
2013-04-26 14:14:55 +00:00
|
|
|
|
Main.panel.toggleAppMenu();
|
2017-10-31 01:19:44 +00:00
|
|
|
|
}
|
2012-03-27 13:26:20 +00:00
|
|
|
|
|
2019-02-04 11:30:53 +00:00
|
|
|
|
_toggleCalendar() {
|
2015-02-18 01:52:07 +00:00
|
|
|
|
Main.panel.toggleCalendar();
|
2017-10-31 01:19:44 +00:00
|
|
|
|
}
|
2015-02-18 01:52:07 +00:00
|
|
|
|
|
2018-01-03 07:55:38 +00:00
|
|
|
|
_showWorkspaceSwitcher(display, window, binding) {
|
|
|
|
|
let workspaceManager = display.get_workspace_manager();
|
|
|
|
|
|
2013-06-16 04:21:21 +00:00
|
|
|
|
if (!Main.sessionMode.hasWorkspaces)
|
|
|
|
|
return;
|
|
|
|
|
|
2018-01-03 07:55:38 +00:00
|
|
|
|
if (workspaceManager.n_workspaces == 1)
|
2010-02-12 22:52:15 +00:00
|
|
|
|
return;
|
|
|
|
|
|
2019-01-29 01:27:05 +00:00
|
|
|
|
let [action,,, target] = binding.get_name().split('-');
|
2012-06-27 19:13:32 +00:00
|
|
|
|
let newWs;
|
2013-05-17 14:54:23 +00:00
|
|
|
|
let direction;
|
2019-06-04 19:22:26 +00:00
|
|
|
|
let vertical = workspaceManager.layout_rows == -1;
|
|
|
|
|
let rtl = Clutter.get_default_text_direction() == Clutter.TextDirection.RTL;
|
2013-05-17 14:54:23 +00:00
|
|
|
|
|
2015-03-25 22:35:36 +00:00
|
|
|
|
if (action == 'move') {
|
|
|
|
|
// "Moving" a window to another workspace doesn't make sense when
|
|
|
|
|
// it cannot be unstuck, and is potentially confusing if a new
|
|
|
|
|
// workspaces is added at the start/end
|
|
|
|
|
if (window.is_always_on_all_workspaces() ||
|
|
|
|
|
(Meta.prefs_get_workspaces_only_on_primary() &&
|
|
|
|
|
window.get_monitor() != Main.layoutManager.primaryIndex))
|
2019-01-29 19:36:54 +00:00
|
|
|
|
return;
|
2015-03-25 22:35:36 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-05-18 17:55:05 +00:00
|
|
|
|
if (target == 'last') {
|
2019-06-04 19:22:26 +00:00
|
|
|
|
if (vertical)
|
|
|
|
|
direction = Meta.MotionDirection.DOWN;
|
|
|
|
|
else if (rtl)
|
|
|
|
|
direction = Meta.MotionDirection.LEFT;
|
|
|
|
|
else
|
|
|
|
|
direction = Meta.MotionDirection.RIGHT;
|
2018-01-03 07:55:38 +00:00
|
|
|
|
newWs = workspaceManager.get_workspace_by_index(workspaceManager.n_workspaces - 1);
|
2013-05-18 17:55:05 +00:00
|
|
|
|
} else if (isNaN(target)) {
|
2015-01-15 23:13:58 +00:00
|
|
|
|
// Prepend a new workspace dynamically
|
2020-06-19 20:37:13 +00:00
|
|
|
|
let prependTarget;
|
|
|
|
|
if (vertical)
|
|
|
|
|
prependTarget = 'up';
|
|
|
|
|
else if (rtl)
|
|
|
|
|
prependTarget = 'right';
|
|
|
|
|
else
|
|
|
|
|
prependTarget = 'left';
|
|
|
|
|
if (workspaceManager.get_active_workspace_index() === 0 &&
|
|
|
|
|
action === 'move' && target === prependTarget &&
|
|
|
|
|
this._isWorkspacePrepended === false) {
|
2015-01-15 23:13:58 +00:00
|
|
|
|
this.insertWorkspace(0);
|
2015-03-27 13:34:28 +00:00
|
|
|
|
this._isWorkspacePrepended = true;
|
|
|
|
|
}
|
2015-01-15 23:13:58 +00:00
|
|
|
|
|
2013-05-17 14:54:23 +00:00
|
|
|
|
direction = Meta.MotionDirection[target.toUpperCase()];
|
2018-01-03 07:55:38 +00:00
|
|
|
|
newWs = workspaceManager.get_active_workspace().get_neighbor(direction);
|
2019-01-24 22:06:48 +00:00
|
|
|
|
} else if ((target > 0) && (target <= workspaceManager.n_workspaces)) {
|
2013-05-17 14:54:23 +00:00
|
|
|
|
target--;
|
2018-01-03 07:55:38 +00:00
|
|
|
|
newWs = workspaceManager.get_workspace_by_index(target);
|
2013-05-17 14:54:23 +00:00
|
|
|
|
|
2019-06-04 19:22:26 +00:00
|
|
|
|
if (workspaceManager.get_active_workspace().index() > target) {
|
|
|
|
|
if (vertical)
|
|
|
|
|
direction = Meta.MotionDirection.UP;
|
|
|
|
|
else if (rtl)
|
|
|
|
|
direction = Meta.MotionDirection.RIGHT;
|
|
|
|
|
else
|
|
|
|
|
direction = Meta.MotionDirection.LEFT;
|
|
|
|
|
} else {
|
2019-08-20 02:24:37 +00:00
|
|
|
|
if (vertical) // eslint-disable-line no-lonely-if
|
2019-06-04 19:22:26 +00:00
|
|
|
|
direction = Meta.MotionDirection.DOWN;
|
|
|
|
|
else if (rtl)
|
|
|
|
|
direction = Meta.MotionDirection.LEFT;
|
|
|
|
|
else
|
|
|
|
|
direction = Meta.MotionDirection.RIGHT;
|
|
|
|
|
}
|
2013-05-17 14:54:23 +00:00
|
|
|
|
}
|
2012-04-14 13:29:54 +00:00
|
|
|
|
|
2019-06-04 19:22:26 +00:00
|
|
|
|
if (workspaceManager.layout_rows == -1 &&
|
|
|
|
|
direction != Meta.MotionDirection.UP &&
|
2012-06-27 20:07:32 +00:00
|
|
|
|
direction != Meta.MotionDirection.DOWN)
|
|
|
|
|
return;
|
|
|
|
|
|
2019-06-04 19:22:26 +00:00
|
|
|
|
if (workspaceManager.layout_columns == -1 &&
|
|
|
|
|
direction != Meta.MotionDirection.LEFT &&
|
|
|
|
|
direction != Meta.MotionDirection.RIGHT)
|
|
|
|
|
return;
|
|
|
|
|
|
2012-04-14 13:29:54 +00:00
|
|
|
|
if (action == 'switch')
|
2013-05-17 14:54:23 +00:00
|
|
|
|
this.actionMoveWorkspace(newWs);
|
2012-04-14 13:29:54 +00:00
|
|
|
|
else
|
2013-05-17 14:54:23 +00:00
|
|
|
|
this.actionMoveWindow(window, newWs);
|
2012-06-27 19:13:32 +00:00
|
|
|
|
|
|
|
|
|
if (!Main.overview.visible) {
|
|
|
|
|
if (this._workspaceSwitcherPopup == null) {
|
2015-03-27 13:34:28 +00:00
|
|
|
|
this._workspaceTracker.blockUpdates();
|
2012-06-27 19:13:32 +00:00
|
|
|
|
this._workspaceSwitcherPopup = new WorkspaceSwitcherPopup.WorkspaceSwitcherPopup();
|
2017-10-31 00:38:18 +00:00
|
|
|
|
this._workspaceSwitcherPopup.connect('destroy', () => {
|
2015-03-27 13:34:28 +00:00
|
|
|
|
this._workspaceTracker.unblockUpdates();
|
2012-06-27 19:13:32 +00:00
|
|
|
|
this._workspaceSwitcherPopup = null;
|
2015-03-27 13:34:28 +00:00
|
|
|
|
this._isWorkspacePrepended = false;
|
2017-10-31 00:38:18 +00:00
|
|
|
|
});
|
2012-06-27 19:13:32 +00:00
|
|
|
|
}
|
|
|
|
|
this._workspaceSwitcherPopup.display(direction, newWs.index());
|
|
|
|
|
}
|
2017-10-31 01:19:44 +00:00
|
|
|
|
}
|
2010-03-17 02:08:52 +00:00
|
|
|
|
|
2017-10-31 00:03:21 +00:00
|
|
|
|
actionMoveWorkspace(workspace) {
|
2013-06-16 04:21:21 +00:00
|
|
|
|
if (!Main.sessionMode.hasWorkspaces)
|
|
|
|
|
return;
|
|
|
|
|
|
2020-06-29 14:50:27 +00:00
|
|
|
|
if (!workspace.active)
|
2013-05-17 14:54:23 +00:00
|
|
|
|
workspace.activate(global.get_current_time());
|
2017-10-31 01:19:44 +00:00
|
|
|
|
}
|
2012-04-14 13:29:54 +00:00
|
|
|
|
|
2017-10-31 00:03:21 +00:00
|
|
|
|
actionMoveWindow(window, workspace) {
|
2013-06-16 04:21:21 +00:00
|
|
|
|
if (!Main.sessionMode.hasWorkspaces)
|
|
|
|
|
return;
|
|
|
|
|
|
2020-06-29 14:50:27 +00:00
|
|
|
|
if (!workspace.active) {
|
2012-04-14 13:29:54 +00:00
|
|
|
|
// This won't have any effect for "always sticky" windows
|
|
|
|
|
// (like desktop windows or docks)
|
2012-06-26 18:11:44 +00:00
|
|
|
|
|
2019-07-02 17:28:47 +00:00
|
|
|
|
this._workspaceAnimation.movingWindow = window;
|
2013-05-17 14:54:23 +00:00
|
|
|
|
window.change_workspace(workspace);
|
2012-04-14 13:29:54 +00:00
|
|
|
|
|
|
|
|
|
global.display.clear_mouse_mode();
|
2019-08-19 17:55:49 +00:00
|
|
|
|
workspace.activate_with_focus(window, global.get_current_time());
|
2012-04-14 13:29:54 +00:00
|
|
|
|
}
|
2017-10-31 01:19:44 +00:00
|
|
|
|
}
|
2013-08-17 15:42:39 +00:00
|
|
|
|
|
2021-01-29 19:22:52 +00:00
|
|
|
|
handleWorkspaceScroll(event) {
|
|
|
|
|
if (!this._canScroll)
|
|
|
|
|
return Clutter.EVENT_PROPAGATE;
|
|
|
|
|
|
|
|
|
|
if (event.type() !== Clutter.EventType.SCROLL)
|
|
|
|
|
return Clutter.EVENT_PROPAGATE;
|
|
|
|
|
|
|
|
|
|
if (event.is_pointer_emulated())
|
|
|
|
|
return Clutter.EVENT_PROPAGATE;
|
|
|
|
|
|
|
|
|
|
let direction = event.get_scroll_direction();
|
|
|
|
|
if (direction === Clutter.ScrollDirection.SMOOTH) {
|
|
|
|
|
const [dx, dy] = event.get_scroll_delta();
|
|
|
|
|
if (Math.abs(dx) > Math.abs(dy)) {
|
|
|
|
|
direction = dx < 0
|
2021-02-11 14:17:22 +00:00
|
|
|
|
? Clutter.ScrollDirection.LEFT
|
|
|
|
|
: Clutter.ScrollDirection.RIGHT;
|
2021-01-29 19:22:52 +00:00
|
|
|
|
} else if (Math.abs(dy) > Math.abs(dx)) {
|
|
|
|
|
direction = dy < 0
|
|
|
|
|
? Clutter.ScrollDirection.UP
|
|
|
|
|
: Clutter.ScrollDirection.DOWN;
|
|
|
|
|
} else {
|
|
|
|
|
return Clutter.EVENT_PROPAGATE;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const workspaceManager = global.workspace_manager;
|
|
|
|
|
const vertical = workspaceManager.layout_rows === -1;
|
2021-02-26 17:08:01 +00:00
|
|
|
|
const rtl = Clutter.get_default_text_direction() === Clutter.TextDirection.RTL;
|
2021-01-29 19:22:52 +00:00
|
|
|
|
const activeWs = workspaceManager.get_active_workspace();
|
|
|
|
|
let ws;
|
|
|
|
|
switch (direction) {
|
|
|
|
|
case Clutter.ScrollDirection.UP:
|
|
|
|
|
if (vertical)
|
|
|
|
|
ws = activeWs.get_neighbor(Meta.MotionDirection.UP);
|
|
|
|
|
else if (rtl)
|
|
|
|
|
ws = activeWs.get_neighbor(Meta.MotionDirection.RIGHT);
|
|
|
|
|
else
|
|
|
|
|
ws = activeWs.get_neighbor(Meta.MotionDirection.LEFT);
|
|
|
|
|
break;
|
|
|
|
|
case Clutter.ScrollDirection.DOWN:
|
|
|
|
|
if (vertical)
|
|
|
|
|
ws = activeWs.get_neighbor(Meta.MotionDirection.DOWN);
|
|
|
|
|
else if (rtl)
|
|
|
|
|
ws = activeWs.get_neighbor(Meta.MotionDirection.LEFT);
|
|
|
|
|
else
|
|
|
|
|
ws = activeWs.get_neighbor(Meta.MotionDirection.RIGHT);
|
|
|
|
|
break;
|
|
|
|
|
case Clutter.ScrollDirection.LEFT:
|
|
|
|
|
ws = activeWs.get_neighbor(Meta.MotionDirection.LEFT);
|
|
|
|
|
break;
|
|
|
|
|
case Clutter.ScrollDirection.RIGHT:
|
|
|
|
|
ws = activeWs.get_neighbor(Meta.MotionDirection.RIGHT);
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
return Clutter.EVENT_PROPAGATE;
|
|
|
|
|
}
|
|
|
|
|
this.actionMoveWorkspace(ws);
|
|
|
|
|
|
|
|
|
|
this._canScroll = false;
|
|
|
|
|
GLib.timeout_add(GLib.PRIORITY_DEFAULT,
|
|
|
|
|
SCROLL_TIMEOUT_TIME, () => {
|
|
|
|
|
this._canScroll = true;
|
|
|
|
|
return GLib.SOURCE_REMOVE;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
return Clutter.EVENT_STOP;
|
|
|
|
|
}
|
|
|
|
|
|
2017-10-31 00:03:21 +00:00
|
|
|
|
_confirmDisplayChange() {
|
2013-08-17 15:42:39 +00:00
|
|
|
|
let dialog = new DisplayChangeDialog(this._shellwm);
|
|
|
|
|
dialog.open();
|
2017-10-31 01:19:44 +00:00
|
|
|
|
}
|
2014-12-30 01:30:38 +00:00
|
|
|
|
|
2017-10-31 00:03:21 +00:00
|
|
|
|
_createCloseDialog(shellwm, window) {
|
2017-01-19 18:52:18 +00:00
|
|
|
|
return new CloseDialog.CloseDialog(window);
|
2017-10-31 01:19:44 +00:00
|
|
|
|
}
|
2017-01-19 18:52:18 +00:00
|
|
|
|
|
2017-10-31 00:03:21 +00:00
|
|
|
|
_createInhibitShortcutsDialog(shellwm, window) {
|
2017-07-14 01:15:17 +00:00
|
|
|
|
return new InhibitShortcutsDialog.InhibitShortcutsDialog(window);
|
2017-10-31 01:19:44 +00:00
|
|
|
|
}
|
2017-07-14 01:15:17 +00:00
|
|
|
|
|
2017-10-31 00:03:21 +00:00
|
|
|
|
_showResizePopup(display, show, rect, displayW, displayH) {
|
2014-12-30 01:30:38 +00:00
|
|
|
|
if (show) {
|
|
|
|
|
if (!this._resizePopup)
|
|
|
|
|
this._resizePopup = new ResizePopup();
|
|
|
|
|
|
|
|
|
|
this._resizePopup.set(rect, displayW, displayH);
|
|
|
|
|
} else {
|
2019-08-20 02:10:46 +00:00
|
|
|
|
if (!this._resizePopup)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
this._resizePopup.destroy();
|
|
|
|
|
this._resizePopup = null;
|
2014-12-30 01:30:38 +00:00
|
|
|
|
}
|
2017-10-31 01:19:44 +00:00
|
|
|
|
}
|
|
|
|
|
};
|