2019-07-02 13:28:47 -04:00
|
|
|
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
|
|
|
|
/* exported WorkspaceAnimationController */
|
|
|
|
|
2019-07-04 13:44:15 -04:00
|
|
|
const { Clutter, GObject, Meta, Shell } = imports.gi;
|
2019-07-02 13:28:47 -04:00
|
|
|
|
2020-07-16 06:40:13 -04:00
|
|
|
const Background = imports.ui.background;
|
|
|
|
const Layout = imports.ui.layout;
|
2019-07-02 13:28:47 -04:00
|
|
|
const Main = imports.ui.main;
|
|
|
|
const SwipeTracker = imports.ui.swipeTracker;
|
|
|
|
|
|
|
|
const WINDOW_ANIMATION_TIME = 250;
|
|
|
|
|
2019-07-04 13:44:15 -04:00
|
|
|
const WorkspaceGroup = GObject.registerClass(
|
|
|
|
class WorkspaceGroup extends Clutter.Actor {
|
|
|
|
_init(workspace, movingWindow) {
|
|
|
|
super._init();
|
|
|
|
|
|
|
|
this._workspace = workspace;
|
|
|
|
this._movingWindow = movingWindow;
|
|
|
|
this._windowRecords = [];
|
|
|
|
|
|
|
|
this._createWindows();
|
|
|
|
|
|
|
|
this.connect('destroy', this._onDestroy.bind(this));
|
|
|
|
this._restackedId = global.display.connect('restacked',
|
|
|
|
this._syncStacking.bind(this));
|
|
|
|
}
|
|
|
|
|
workspaceAnimation: Use a workspace strip
Currently, the workspace swipe transition only has one workspace in each
direction. This works until you try to do multiple swipes in quick
succession. The second swipe would continue the existing transition, which
only has 2 or 3 workspaces in it, and will hit a wall.
To prevent this, take all workspaces and arrange them into a column or row,
depending on the layout, and use that as a transition.
For the transition that happens when focusing a window on another workspace
(for example, via Alt+Tab), still use only two workspaces instead of all of
them.
Since we don't support layouts other than single rows/columns anymore,
diagonal transitions aren't supported anymore, and will be shown as
horizontal or vertical instead.
Since nw alt-tab and gesture transitions are different, don't allow to do
both at once, that is, disable swipe tracker when a programmatic transition
is going. This will also conveniently cancel a gesture transition if a
programmatic one is initiated while a gesture is in progress.
Fixes https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/2612
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1326>
2020-06-20 13:01:25 -04:00
|
|
|
get workspace() {
|
|
|
|
return this._workspace;
|
|
|
|
}
|
|
|
|
|
2019-07-04 13:44:15 -04:00
|
|
|
_shouldShowWindow(window) {
|
|
|
|
if (!window.showing_on_its_workspace())
|
|
|
|
return false;
|
|
|
|
|
|
|
|
const isSticky =
|
|
|
|
window.is_on_all_workspaces() || window === this._movingWindow;
|
|
|
|
|
2020-06-20 14:44:24 -04:00
|
|
|
// No workspace means we should show windows that are on all workspaces
|
|
|
|
if (!this._workspace)
|
|
|
|
return isSticky;
|
|
|
|
|
|
|
|
// Otherwise only show windows that are (only) on that workspace
|
2019-07-04 13:44:15 -04:00
|
|
|
return !isSticky && window.located_on_workspace(this._workspace);
|
|
|
|
}
|
|
|
|
|
|
|
|
_syncStacking() {
|
2019-07-04 14:15:15 -04:00
|
|
|
const windowActors = global.get_window_actors().filter(w =>
|
|
|
|
this._shouldShowWindow(w.meta_window));
|
|
|
|
|
|
|
|
let lastRecord;
|
2019-07-04 13:44:15 -04:00
|
|
|
|
|
|
|
for (const windowActor of windowActors) {
|
2019-07-04 14:15:15 -04:00
|
|
|
const record = this._windowRecords.find(r => r.windowActor === windowActor);
|
|
|
|
|
|
|
|
this.set_child_above_sibling(record.clone, lastRecord ? lastRecord.clone : null);
|
|
|
|
lastRecord = record;
|
2019-07-04 13:44:15 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
_createWindows() {
|
|
|
|
const windowActors = global.get_window_actors().filter(w =>
|
|
|
|
this._shouldShowWindow(w.meta_window));
|
|
|
|
|
|
|
|
for (const windowActor of windowActors) {
|
2019-07-04 14:15:15 -04:00
|
|
|
const clone = new Clutter.Clone({
|
|
|
|
source: windowActor,
|
|
|
|
x: windowActor.x,
|
|
|
|
y: windowActor.y,
|
|
|
|
});
|
|
|
|
|
|
|
|
this.add_child(clone);
|
2019-07-04 13:44:15 -04:00
|
|
|
|
2019-07-04 14:15:15 -04:00
|
|
|
const record = { windowActor, clone };
|
2019-07-04 13:44:15 -04:00
|
|
|
|
|
|
|
record.windowDestroyId = windowActor.connect('destroy', () => {
|
2019-07-04 14:15:15 -04:00
|
|
|
clone.destroy();
|
2019-07-04 13:44:15 -04:00
|
|
|
this._windowRecords.splice(this._windowRecords.indexOf(record), 1);
|
|
|
|
});
|
|
|
|
|
|
|
|
this._windowRecords.push(record);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
_removeWindows() {
|
|
|
|
for (const record of this._windowRecords) {
|
|
|
|
record.windowActor.disconnect(record.windowDestroyId);
|
2019-07-04 14:15:15 -04:00
|
|
|
record.clone.destroy();
|
2019-07-04 13:44:15 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
this._windowRecords = [];
|
|
|
|
}
|
|
|
|
|
|
|
|
_onDestroy() {
|
|
|
|
global.display.disconnect(this._restackedId);
|
|
|
|
this._removeWindows();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2020-07-16 06:40:13 -04:00
|
|
|
const MonitorGroup = GObject.registerClass(
|
|
|
|
class MonitorGroup extends Clutter.Actor {
|
|
|
|
_init(monitor) {
|
|
|
|
super._init();
|
|
|
|
|
|
|
|
const constraint = new Layout.MonitorConstraint({ index: monitor.index });
|
|
|
|
this.add_constraint(constraint);
|
|
|
|
|
|
|
|
const background = new Meta.BackgroundGroup();
|
|
|
|
|
|
|
|
this.add_child(background);
|
|
|
|
|
|
|
|
this._bgManager = new Background.BackgroundManager({
|
|
|
|
container: background,
|
|
|
|
monitorIndex: monitor.index,
|
|
|
|
controlPosition: false,
|
|
|
|
});
|
|
|
|
|
|
|
|
this.connect('destroy', this._onDestroy.bind(this));
|
|
|
|
}
|
|
|
|
|
|
|
|
_onDestroy() {
|
|
|
|
this._bgManager.destroy();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2019-07-02 13:28:47 -04:00
|
|
|
var WorkspaceAnimationController = class {
|
|
|
|
constructor() {
|
|
|
|
this._movingWindow = null;
|
|
|
|
this._switchData = null;
|
|
|
|
|
|
|
|
Main.overview.connect('showing', () => {
|
|
|
|
if (this._switchData) {
|
|
|
|
if (this._switchData.gestureActivated)
|
workspaceAnimation: Use a workspace strip
Currently, the workspace swipe transition only has one workspace in each
direction. This works until you try to do multiple swipes in quick
succession. The second swipe would continue the existing transition, which
only has 2 or 3 workspaces in it, and will hit a wall.
To prevent this, take all workspaces and arrange them into a column or row,
depending on the layout, and use that as a transition.
For the transition that happens when focusing a window on another workspace
(for example, via Alt+Tab), still use only two workspaces instead of all of
them.
Since we don't support layouts other than single rows/columns anymore,
diagonal transitions aren't supported anymore, and will be shown as
horizontal or vertical instead.
Since nw alt-tab and gesture transitions are different, don't allow to do
both at once, that is, disable swipe tracker when a programmatic transition
is going. This will also conveniently cancel a gesture transition if a
programmatic one is initiated while a gesture is in progress.
Fixes https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/2612
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1326>
2020-06-20 13:01:25 -04:00
|
|
|
this._finishWorkspaceSwitch(this._switchData);
|
2019-07-02 13:28:47 -04:00
|
|
|
this._swipeTracker.enabled = false;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
Main.overview.connect('hiding', () => {
|
|
|
|
this._swipeTracker.enabled = true;
|
|
|
|
});
|
|
|
|
|
|
|
|
const swipeTracker = new SwipeTracker.SwipeTracker(global.stage,
|
|
|
|
Shell.ActionMode.NORMAL, { allowDrag: false, allowScroll: false });
|
|
|
|
swipeTracker.connect('begin', this._switchWorkspaceBegin.bind(this));
|
|
|
|
swipeTracker.connect('update', this._switchWorkspaceUpdate.bind(this));
|
|
|
|
swipeTracker.connect('end', this._switchWorkspaceEnd.bind(this));
|
|
|
|
this._swipeTracker = swipeTracker;
|
|
|
|
}
|
|
|
|
|
workspaceAnimation: Use a workspace strip
Currently, the workspace swipe transition only has one workspace in each
direction. This works until you try to do multiple swipes in quick
succession. The second swipe would continue the existing transition, which
only has 2 or 3 workspaces in it, and will hit a wall.
To prevent this, take all workspaces and arrange them into a column or row,
depending on the layout, and use that as a transition.
For the transition that happens when focusing a window on another workspace
(for example, via Alt+Tab), still use only two workspaces instead of all of
them.
Since we don't support layouts other than single rows/columns anymore,
diagonal transitions aren't supported anymore, and will be shown as
horizontal or vertical instead.
Since nw alt-tab and gesture transitions are different, don't allow to do
both at once, that is, disable swipe tracker when a programmatic transition
is going. This will also conveniently cancel a gesture transition if a
programmatic one is initiated while a gesture is in progress.
Fixes https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/2612
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1326>
2020-06-20 13:01:25 -04:00
|
|
|
_prepareWorkspaceSwitch(workspaceIndices) {
|
2019-07-02 13:28:47 -04:00
|
|
|
if (this._switchData)
|
|
|
|
return;
|
|
|
|
|
2019-07-04 13:44:15 -04:00
|
|
|
const workspaceManager = global.workspace_manager;
|
workspaceAnimation: Use a workspace strip
Currently, the workspace swipe transition only has one workspace in each
direction. This works until you try to do multiple swipes in quick
succession. The second swipe would continue the existing transition, which
only has 2 or 3 workspaces in it, and will hit a wall.
To prevent this, take all workspaces and arrange them into a column or row,
depending on the layout, and use that as a transition.
For the transition that happens when focusing a window on another workspace
(for example, via Alt+Tab), still use only two workspaces instead of all of
them.
Since we don't support layouts other than single rows/columns anymore,
diagonal transitions aren't supported anymore, and will be shown as
horizontal or vertical instead.
Since nw alt-tab and gesture transitions are different, don't allow to do
both at once, that is, disable swipe tracker when a programmatic transition
is going. This will also conveniently cancel a gesture transition if a
programmatic one is initiated while a gesture is in progress.
Fixes https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/2612
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1326>
2020-06-20 13:01:25 -04:00
|
|
|
const vertical = workspaceManager.layout_rows === -1;
|
|
|
|
const nWorkspaces = workspaceManager.get_n_workspaces();
|
|
|
|
const activeWorkspaceIndex = workspaceManager.get_active_workspace_index();
|
2019-07-04 13:44:15 -04:00
|
|
|
|
2019-07-02 13:28:47 -04:00
|
|
|
const switchData = {};
|
|
|
|
|
|
|
|
this._switchData = switchData;
|
2020-06-20 14:44:24 -04:00
|
|
|
switchData.stickyGroup = new WorkspaceGroup(null, this.movingWindow);
|
workspaceAnimation: Use a workspace strip
Currently, the workspace swipe transition only has one workspace in each
direction. This works until you try to do multiple swipes in quick
succession. The second swipe would continue the existing transition, which
only has 2 or 3 workspaces in it, and will hit a wall.
To prevent this, take all workspaces and arrange them into a column or row,
depending on the layout, and use that as a transition.
For the transition that happens when focusing a window on another workspace
(for example, via Alt+Tab), still use only two workspaces instead of all of
them.
Since we don't support layouts other than single rows/columns anymore,
diagonal transitions aren't supported anymore, and will be shown as
horizontal or vertical instead.
Since nw alt-tab and gesture transitions are different, don't allow to do
both at once, that is, disable swipe tracker when a programmatic transition
is going. This will also conveniently cancel a gesture transition if a
programmatic one is initiated while a gesture is in progress.
Fixes https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/2612
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1326>
2020-06-20 13:01:25 -04:00
|
|
|
switchData.workspaceGroups = [];
|
2019-07-02 13:28:47 -04:00
|
|
|
switchData.gestureActivated = false;
|
|
|
|
switchData.inProgress = false;
|
|
|
|
|
|
|
|
switchData.container = new Clutter.Actor();
|
2020-07-16 06:40:13 -04:00
|
|
|
switchData.backgroundGroup = new Clutter.Actor();
|
|
|
|
|
|
|
|
for (const monitor of Main.layoutManager.monitors)
|
|
|
|
switchData.backgroundGroup.add_child(new MonitorGroup(monitor));
|
2019-07-02 13:28:47 -04:00
|
|
|
|
2020-07-16 06:40:13 -04:00
|
|
|
Main.uiGroup.insert_child_above(switchData.backgroundGroup, global.window_group);
|
|
|
|
Main.uiGroup.insert_child_above(switchData.container, switchData.backgroundGroup);
|
2020-06-20 14:44:24 -04:00
|
|
|
Main.uiGroup.insert_child_above(switchData.stickyGroup, switchData.container);
|
2019-07-02 13:28:47 -04:00
|
|
|
|
workspaceAnimation: Use a workspace strip
Currently, the workspace swipe transition only has one workspace in each
direction. This works until you try to do multiple swipes in quick
succession. The second swipe would continue the existing transition, which
only has 2 or 3 workspaces in it, and will hit a wall.
To prevent this, take all workspaces and arrange them into a column or row,
depending on the layout, and use that as a transition.
For the transition that happens when focusing a window on another workspace
(for example, via Alt+Tab), still use only two workspaces instead of all of
them.
Since we don't support layouts other than single rows/columns anymore,
diagonal transitions aren't supported anymore, and will be shown as
horizontal or vertical instead.
Since nw alt-tab and gesture transitions are different, don't allow to do
both at once, that is, disable swipe tracker when a programmatic transition
is going. This will also conveniently cancel a gesture transition if a
programmatic one is initiated while a gesture is in progress.
Fixes https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/2612
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1326>
2020-06-20 13:01:25 -04:00
|
|
|
let x = 0;
|
|
|
|
let y = 0;
|
|
|
|
|
|
|
|
if (!workspaceIndices)
|
|
|
|
workspaceIndices = [...Array(nWorkspaces).keys()];
|
2019-07-02 13:28:47 -04:00
|
|
|
|
workspaceAnimation: Use a workspace strip
Currently, the workspace swipe transition only has one workspace in each
direction. This works until you try to do multiple swipes in quick
succession. The second swipe would continue the existing transition, which
only has 2 or 3 workspaces in it, and will hit a wall.
To prevent this, take all workspaces and arrange them into a column or row,
depending on the layout, and use that as a transition.
For the transition that happens when focusing a window on another workspace
(for example, via Alt+Tab), still use only two workspaces instead of all of
them.
Since we don't support layouts other than single rows/columns anymore,
diagonal transitions aren't supported anymore, and will be shown as
horizontal or vertical instead.
Since nw alt-tab and gesture transitions are different, don't allow to do
both at once, that is, disable swipe tracker when a programmatic transition
is going. This will also conveniently cancel a gesture transition if a
programmatic one is initiated while a gesture is in progress.
Fixes https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/2612
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1326>
2020-06-20 13:01:25 -04:00
|
|
|
for (const i of workspaceIndices) {
|
|
|
|
const ws = workspaceManager.get_workspace_by_index(i);
|
|
|
|
const fullscreen = ws.list_windows().some(w => w.is_fullscreen());
|
2019-07-02 13:28:47 -04:00
|
|
|
|
workspaceAnimation: Use a workspace strip
Currently, the workspace swipe transition only has one workspace in each
direction. This works until you try to do multiple swipes in quick
succession. The second swipe would continue the existing transition, which
only has 2 or 3 workspaces in it, and will hit a wall.
To prevent this, take all workspaces and arrange them into a column or row,
depending on the layout, and use that as a transition.
For the transition that happens when focusing a window on another workspace
(for example, via Alt+Tab), still use only two workspaces instead of all of
them.
Since we don't support layouts other than single rows/columns anymore,
diagonal transitions aren't supported anymore, and will be shown as
horizontal or vertical instead.
Since nw alt-tab and gesture transitions are different, don't allow to do
both at once, that is, disable swipe tracker when a programmatic transition
is going. This will also conveniently cancel a gesture transition if a
programmatic one is initiated while a gesture is in progress.
Fixes https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/2612
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1326>
2020-06-20 13:01:25 -04:00
|
|
|
if (y > 0 && vertical && !fullscreen) {
|
|
|
|
// We have to shift windows up or down by the height of the panel to prevent having a
|
|
|
|
// visible gap between the windows while switching workspaces. Since fullscreen windows
|
|
|
|
// hide the panel, they don't need to be shifted up or down.
|
|
|
|
y -= Main.panel.height;
|
2019-07-02 13:28:47 -04:00
|
|
|
}
|
|
|
|
|
2019-07-04 13:44:15 -04:00
|
|
|
const group = new WorkspaceGroup(ws, this.movingWindow);
|
workspaceAnimation: Use a workspace strip
Currently, the workspace swipe transition only has one workspace in each
direction. This works until you try to do multiple swipes in quick
succession. The second swipe would continue the existing transition, which
only has 2 or 3 workspaces in it, and will hit a wall.
To prevent this, take all workspaces and arrange them into a column or row,
depending on the layout, and use that as a transition.
For the transition that happens when focusing a window on another workspace
(for example, via Alt+Tab), still use only two workspaces instead of all of
them.
Since we don't support layouts other than single rows/columns anymore,
diagonal transitions aren't supported anymore, and will be shown as
horizontal or vertical instead.
Since nw alt-tab and gesture transitions are different, don't allow to do
both at once, that is, disable swipe tracker when a programmatic transition
is going. This will also conveniently cancel a gesture transition if a
programmatic one is initiated while a gesture is in progress.
Fixes https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/2612
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1326>
2020-06-20 13:01:25 -04:00
|
|
|
|
|
|
|
switchData.workspaceGroups.push(group);
|
2019-07-04 13:44:15 -04:00
|
|
|
switchData.container.add_child(group);
|
|
|
|
switchData.container.set_child_above_sibling(group, null);
|
|
|
|
group.set_position(x, y);
|
workspaceAnimation: Use a workspace strip
Currently, the workspace swipe transition only has one workspace in each
direction. This works until you try to do multiple swipes in quick
succession. The second swipe would continue the existing transition, which
only has 2 or 3 workspaces in it, and will hit a wall.
To prevent this, take all workspaces and arrange them into a column or row,
depending on the layout, and use that as a transition.
For the transition that happens when focusing a window on another workspace
(for example, via Alt+Tab), still use only two workspaces instead of all of
them.
Since we don't support layouts other than single rows/columns anymore,
diagonal transitions aren't supported anymore, and will be shown as
horizontal or vertical instead.
Since nw alt-tab and gesture transitions are different, don't allow to do
both at once, that is, disable swipe tracker when a programmatic transition
is going. This will also conveniently cancel a gesture transition if a
programmatic one is initiated while a gesture is in progress.
Fixes https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/2612
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1326>
2020-06-20 13:01:25 -04:00
|
|
|
|
|
|
|
if (vertical)
|
|
|
|
y += global.screen_height;
|
|
|
|
else if (Clutter.get_default_text_direction() === Clutter.TextDirection.RTL)
|
|
|
|
x -= global.screen_width;
|
|
|
|
else
|
|
|
|
x += global.screen_width;
|
2019-07-02 13:28:47 -04:00
|
|
|
}
|
|
|
|
|
workspaceAnimation: Use a workspace strip
Currently, the workspace swipe transition only has one workspace in each
direction. This works until you try to do multiple swipes in quick
succession. The second swipe would continue the existing transition, which
only has 2 or 3 workspaces in it, and will hit a wall.
To prevent this, take all workspaces and arrange them into a column or row,
depending on the layout, and use that as a transition.
For the transition that happens when focusing a window on another workspace
(for example, via Alt+Tab), still use only two workspaces instead of all of
them.
Since we don't support layouts other than single rows/columns anymore,
diagonal transitions aren't supported anymore, and will be shown as
horizontal or vertical instead.
Since nw alt-tab and gesture transitions are different, don't allow to do
both at once, that is, disable swipe tracker when a programmatic transition
is going. This will also conveniently cancel a gesture transition if a
programmatic one is initiated while a gesture is in progress.
Fixes https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/2612
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1326>
2020-06-20 13:01:25 -04:00
|
|
|
const activeGroup = this._findWorkspaceGroupByIndex(activeWorkspaceIndex);
|
|
|
|
if (vertical)
|
|
|
|
switchData.container.y = -activeGroup.y;
|
|
|
|
else
|
|
|
|
switchData.container.x = -activeGroup.x;
|
2019-07-02 13:28:47 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
_finishWorkspaceSwitch(switchData) {
|
|
|
|
this._switchData = null;
|
|
|
|
|
2020-07-16 06:40:13 -04:00
|
|
|
switchData.backgroundGroup.destroy();
|
2019-07-02 13:28:47 -04:00
|
|
|
switchData.container.destroy();
|
2020-06-20 14:44:24 -04:00
|
|
|
switchData.stickyGroup.destroy();
|
2019-07-02 13:28:47 -04:00
|
|
|
|
|
|
|
this.movingWindow = null;
|
|
|
|
}
|
|
|
|
|
2020-01-21 08:09:56 -05:00
|
|
|
animateSwitch(from, to, direction, onComplete) {
|
workspaceAnimation: Use a workspace strip
Currently, the workspace swipe transition only has one workspace in each
direction. This works until you try to do multiple swipes in quick
succession. The second swipe would continue the existing transition, which
only has 2 or 3 workspaces in it, and will hit a wall.
To prevent this, take all workspaces and arrange them into a column or row,
depending on the layout, and use that as a transition.
For the transition that happens when focusing a window on another workspace
(for example, via Alt+Tab), still use only two workspaces instead of all of
them.
Since we don't support layouts other than single rows/columns anymore,
diagonal transitions aren't supported anymore, and will be shown as
horizontal or vertical instead.
Since nw alt-tab and gesture transitions are different, don't allow to do
both at once, that is, disable swipe tracker when a programmatic transition
is going. This will also conveniently cancel a gesture transition if a
programmatic one is initiated while a gesture is in progress.
Fixes https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/2612
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1326>
2020-06-20 13:01:25 -04:00
|
|
|
this._swipeTracker.enabled = false;
|
|
|
|
|
|
|
|
let workspaceIndices = [];
|
|
|
|
|
|
|
|
switch (direction) {
|
|
|
|
case Meta.MotionDirection.UP:
|
|
|
|
case Meta.MotionDirection.LEFT:
|
|
|
|
case Meta.MotionDirection.UP_LEFT:
|
|
|
|
case Meta.MotionDirection.UP_RIGHT:
|
|
|
|
workspaceIndices = [to, from];
|
|
|
|
break;
|
|
|
|
|
|
|
|
case Meta.MotionDirection.DOWN:
|
|
|
|
case Meta.MotionDirection.RIGHT:
|
|
|
|
case Meta.MotionDirection.DOWN_LEFT:
|
|
|
|
case Meta.MotionDirection.DOWN_RIGHT:
|
|
|
|
workspaceIndices = [from, to];
|
|
|
|
break;
|
|
|
|
}
|
2019-07-02 13:28:47 -04:00
|
|
|
|
workspaceAnimation: Use a workspace strip
Currently, the workspace swipe transition only has one workspace in each
direction. This works until you try to do multiple swipes in quick
succession. The second swipe would continue the existing transition, which
only has 2 or 3 workspaces in it, and will hit a wall.
To prevent this, take all workspaces and arrange them into a column or row,
depending on the layout, and use that as a transition.
For the transition that happens when focusing a window on another workspace
(for example, via Alt+Tab), still use only two workspaces instead of all of
them.
Since we don't support layouts other than single rows/columns anymore,
diagonal transitions aren't supported anymore, and will be shown as
horizontal or vertical instead.
Since nw alt-tab and gesture transitions are different, don't allow to do
both at once, that is, disable swipe tracker when a programmatic transition
is going. This will also conveniently cancel a gesture transition if a
programmatic one is initiated while a gesture is in progress.
Fixes https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/2612
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1326>
2020-06-20 13:01:25 -04:00
|
|
|
if (Clutter.get_default_text_direction() === Clutter.TextDirection.RTL &&
|
|
|
|
direction !== Meta.MotionDirection.UP &&
|
|
|
|
direction !== Meta.MotionDirection.DOWN)
|
|
|
|
workspaceIndices.reverse();
|
2019-07-02 13:28:47 -04:00
|
|
|
|
workspaceAnimation: Use a workspace strip
Currently, the workspace swipe transition only has one workspace in each
direction. This works until you try to do multiple swipes in quick
succession. The second swipe would continue the existing transition, which
only has 2 or 3 workspaces in it, and will hit a wall.
To prevent this, take all workspaces and arrange them into a column or row,
depending on the layout, and use that as a transition.
For the transition that happens when focusing a window on another workspace
(for example, via Alt+Tab), still use only two workspaces instead of all of
them.
Since we don't support layouts other than single rows/columns anymore,
diagonal transitions aren't supported anymore, and will be shown as
horizontal or vertical instead.
Since nw alt-tab and gesture transitions are different, don't allow to do
both at once, that is, disable swipe tracker when a programmatic transition
is going. This will also conveniently cancel a gesture transition if a
programmatic one is initiated while a gesture is in progress.
Fixes https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/2612
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1326>
2020-06-20 13:01:25 -04:00
|
|
|
this._prepareWorkspaceSwitch(workspaceIndices);
|
|
|
|
this._switchData.inProgress = true;
|
|
|
|
|
|
|
|
const fromGroup = this._findWorkspaceGroupByIndex(from);
|
|
|
|
const toGroup = this._findWorkspaceGroupByIndex(to);
|
2019-07-02 13:28:47 -04:00
|
|
|
|
workspaceAnimation: Use a workspace strip
Currently, the workspace swipe transition only has one workspace in each
direction. This works until you try to do multiple swipes in quick
succession. The second swipe would continue the existing transition, which
only has 2 or 3 workspaces in it, and will hit a wall.
To prevent this, take all workspaces and arrange them into a column or row,
depending on the layout, and use that as a transition.
For the transition that happens when focusing a window on another workspace
(for example, via Alt+Tab), still use only two workspaces instead of all of
them.
Since we don't support layouts other than single rows/columns anymore,
diagonal transitions aren't supported anymore, and will be shown as
horizontal or vertical instead.
Since nw alt-tab and gesture transitions are different, don't allow to do
both at once, that is, disable swipe tracker when a programmatic transition
is going. This will also conveniently cancel a gesture transition if a
programmatic one is initiated while a gesture is in progress.
Fixes https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/2612
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1326>
2020-06-20 13:01:25 -04:00
|
|
|
this._switchData.container.x = -fromGroup.x;
|
|
|
|
this._switchData.container.y = -fromGroup.y;
|
2019-07-02 13:28:47 -04:00
|
|
|
|
|
|
|
this._switchData.container.ease({
|
workspaceAnimation: Use a workspace strip
Currently, the workspace swipe transition only has one workspace in each
direction. This works until you try to do multiple swipes in quick
succession. The second swipe would continue the existing transition, which
only has 2 or 3 workspaces in it, and will hit a wall.
To prevent this, take all workspaces and arrange them into a column or row,
depending on the layout, and use that as a transition.
For the transition that happens when focusing a window on another workspace
(for example, via Alt+Tab), still use only two workspaces instead of all of
them.
Since we don't support layouts other than single rows/columns anymore,
diagonal transitions aren't supported anymore, and will be shown as
horizontal or vertical instead.
Since nw alt-tab and gesture transitions are different, don't allow to do
both at once, that is, disable swipe tracker when a programmatic transition
is going. This will also conveniently cancel a gesture transition if a
programmatic one is initiated while a gesture is in progress.
Fixes https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/2612
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1326>
2020-06-20 13:01:25 -04:00
|
|
|
x: -toGroup.x,
|
|
|
|
y: -toGroup.y,
|
2019-07-02 13:28:47 -04:00
|
|
|
duration: WINDOW_ANIMATION_TIME,
|
|
|
|
mode: Clutter.AnimationMode.EASE_OUT_CUBIC,
|
2020-01-21 08:09:56 -05:00
|
|
|
onComplete: () => {
|
|
|
|
this._finishWorkspaceSwitch(this._switchData);
|
|
|
|
onComplete();
|
workspaceAnimation: Use a workspace strip
Currently, the workspace swipe transition only has one workspace in each
direction. This works until you try to do multiple swipes in quick
succession. The second swipe would continue the existing transition, which
only has 2 or 3 workspaces in it, and will hit a wall.
To prevent this, take all workspaces and arrange them into a column or row,
depending on the layout, and use that as a transition.
For the transition that happens when focusing a window on another workspace
(for example, via Alt+Tab), still use only two workspaces instead of all of
them.
Since we don't support layouts other than single rows/columns anymore,
diagonal transitions aren't supported anymore, and will be shown as
horizontal or vertical instead.
Since nw alt-tab and gesture transitions are different, don't allow to do
both at once, that is, disable swipe tracker when a programmatic transition
is going. This will also conveniently cancel a gesture transition if a
programmatic one is initiated while a gesture is in progress.
Fixes https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/2612
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1326>
2020-06-20 13:01:25 -04:00
|
|
|
this._swipeTracker.enabled = true;
|
2020-01-21 08:09:56 -05:00
|
|
|
},
|
2019-07-02 13:28:47 -04:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
workspaceAnimation: Use a workspace strip
Currently, the workspace swipe transition only has one workspace in each
direction. This works until you try to do multiple swipes in quick
succession. The second swipe would continue the existing transition, which
only has 2 or 3 workspaces in it, and will hit a wall.
To prevent this, take all workspaces and arrange them into a column or row,
depending on the layout, and use that as a transition.
For the transition that happens when focusing a window on another workspace
(for example, via Alt+Tab), still use only two workspaces instead of all of
them.
Since we don't support layouts other than single rows/columns anymore,
diagonal transitions aren't supported anymore, and will be shown as
horizontal or vertical instead.
Since nw alt-tab and gesture transitions are different, don't allow to do
both at once, that is, disable swipe tracker when a programmatic transition
is going. This will also conveniently cancel a gesture transition if a
programmatic one is initiated while a gesture is in progress.
Fixes https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/2612
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1326>
2020-06-20 13:01:25 -04:00
|
|
|
_getProgressForWorkspace(workspaceGroup) {
|
|
|
|
if (global.workspace_manager.layout_rows === -1)
|
|
|
|
return workspaceGroup.y / global.screen_height;
|
|
|
|
else if (Clutter.get_default_text_direction() === Clutter.TextDirection.RTL)
|
|
|
|
return -workspaceGroup.x / global.screen_width;
|
2019-07-02 13:28:47 -04:00
|
|
|
else
|
workspaceAnimation: Use a workspace strip
Currently, the workspace swipe transition only has one workspace in each
direction. This works until you try to do multiple swipes in quick
succession. The second swipe would continue the existing transition, which
only has 2 or 3 workspaces in it, and will hit a wall.
To prevent this, take all workspaces and arrange them into a column or row,
depending on the layout, and use that as a transition.
For the transition that happens when focusing a window on another workspace
(for example, via Alt+Tab), still use only two workspaces instead of all of
them.
Since we don't support layouts other than single rows/columns anymore,
diagonal transitions aren't supported anymore, and will be shown as
horizontal or vertical instead.
Since nw alt-tab and gesture transitions are different, don't allow to do
both at once, that is, disable swipe tracker when a programmatic transition
is going. This will also conveniently cancel a gesture transition if a
programmatic one is initiated while a gesture is in progress.
Fixes https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/2612
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1326>
2020-06-20 13:01:25 -04:00
|
|
|
return workspaceGroup.x / global.screen_width;
|
|
|
|
}
|
2019-07-02 13:28:47 -04:00
|
|
|
|
workspaceAnimation: Use a workspace strip
Currently, the workspace swipe transition only has one workspace in each
direction. This works until you try to do multiple swipes in quick
succession. The second swipe would continue the existing transition, which
only has 2 or 3 workspaces in it, and will hit a wall.
To prevent this, take all workspaces and arrange them into a column or row,
depending on the layout, and use that as a transition.
For the transition that happens when focusing a window on another workspace
(for example, via Alt+Tab), still use only two workspaces instead of all of
them.
Since we don't support layouts other than single rows/columns anymore,
diagonal transitions aren't supported anymore, and will be shown as
horizontal or vertical instead.
Since nw alt-tab and gesture transitions are different, don't allow to do
both at once, that is, disable swipe tracker when a programmatic transition
is going. This will also conveniently cancel a gesture transition if a
programmatic one is initiated while a gesture is in progress.
Fixes https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/2612
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1326>
2020-06-20 13:01:25 -04:00
|
|
|
_findWorkspaceGroupByIndex(index) {
|
|
|
|
return this._switchData.workspaceGroups.find(g => g.workspace.index() === index);
|
|
|
|
}
|
2019-07-02 13:28:47 -04:00
|
|
|
|
workspaceAnimation: Use a workspace strip
Currently, the workspace swipe transition only has one workspace in each
direction. This works until you try to do multiple swipes in quick
succession. The second swipe would continue the existing transition, which
only has 2 or 3 workspaces in it, and will hit a wall.
To prevent this, take all workspaces and arrange them into a column or row,
depending on the layout, and use that as a transition.
For the transition that happens when focusing a window on another workspace
(for example, via Alt+Tab), still use only two workspaces instead of all of
them.
Since we don't support layouts other than single rows/columns anymore,
diagonal transitions aren't supported anymore, and will be shown as
horizontal or vertical instead.
Since nw alt-tab and gesture transitions are different, don't allow to do
both at once, that is, disable swipe tracker when a programmatic transition
is going. This will also conveniently cancel a gesture transition if a
programmatic one is initiated while a gesture is in progress.
Fixes https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/2612
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1326>
2020-06-20 13:01:25 -04:00
|
|
|
_findClosestWorkspaceGroup(progress) {
|
|
|
|
const distances = this._switchData.workspaceGroups.map(g => {
|
|
|
|
const workspaceProgress = this._getProgressForWorkspace(g);
|
|
|
|
return Math.abs(workspaceProgress - progress);
|
|
|
|
});
|
|
|
|
const index = distances.indexOf(Math.min(...distances));
|
|
|
|
return this._switchData.workspaceGroups[index];
|
2019-07-02 13:28:47 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
_switchWorkspaceBegin(tracker, monitor) {
|
|
|
|
if (Meta.prefs_get_workspaces_only_on_primary() &&
|
|
|
|
monitor !== Main.layoutManager.primaryIndex)
|
|
|
|
return;
|
|
|
|
|
|
|
|
const workspaceManager = global.workspace_manager;
|
|
|
|
const horiz = workspaceManager.layout_rows !== -1;
|
|
|
|
tracker.orientation = horiz
|
|
|
|
? Clutter.Orientation.HORIZONTAL
|
|
|
|
: Clutter.Orientation.VERTICAL;
|
|
|
|
|
workspaceAnimation: Use a workspace strip
Currently, the workspace swipe transition only has one workspace in each
direction. This works until you try to do multiple swipes in quick
succession. The second swipe would continue the existing transition, which
only has 2 or 3 workspaces in it, and will hit a wall.
To prevent this, take all workspaces and arrange them into a column or row,
depending on the layout, and use that as a transition.
For the transition that happens when focusing a window on another workspace
(for example, via Alt+Tab), still use only two workspaces instead of all of
them.
Since we don't support layouts other than single rows/columns anymore,
diagonal transitions aren't supported anymore, and will be shown as
horizontal or vertical instead.
Since nw alt-tab and gesture transitions are different, don't allow to do
both at once, that is, disable swipe tracker when a programmatic transition
is going. This will also conveniently cancel a gesture transition if a
programmatic one is initiated while a gesture is in progress.
Fixes https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/2612
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1326>
2020-06-20 13:01:25 -04:00
|
|
|
const baseDistance = horiz ? global.screen_width : global.screen_height;
|
2019-07-02 13:28:47 -04:00
|
|
|
|
|
|
|
let progress;
|
workspaceAnimation: Use a workspace strip
Currently, the workspace swipe transition only has one workspace in each
direction. This works until you try to do multiple swipes in quick
succession. The second swipe would continue the existing transition, which
only has 2 or 3 workspaces in it, and will hit a wall.
To prevent this, take all workspaces and arrange them into a column or row,
depending on the layout, and use that as a transition.
For the transition that happens when focusing a window on another workspace
(for example, via Alt+Tab), still use only two workspaces instead of all of
them.
Since we don't support layouts other than single rows/columns anymore,
diagonal transitions aren't supported anymore, and will be shown as
horizontal or vertical instead.
Since nw alt-tab and gesture transitions are different, don't allow to do
both at once, that is, disable swipe tracker when a programmatic transition
is going. This will also conveniently cancel a gesture transition if a
programmatic one is initiated while a gesture is in progress.
Fixes https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/2612
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1326>
2020-06-20 13:01:25 -04:00
|
|
|
let cancelProgress;
|
2019-07-02 13:28:47 -04:00
|
|
|
if (this._switchData && this._switchData.gestureActivated) {
|
|
|
|
this._switchData.container.remove_all_transitions();
|
|
|
|
if (!horiz)
|
|
|
|
progress = -this._switchData.container.y / baseDistance;
|
|
|
|
else if (Clutter.get_default_text_direction() === Clutter.TextDirection.RTL)
|
|
|
|
progress = this._switchData.container.x / baseDistance;
|
|
|
|
else
|
|
|
|
progress = -this._switchData.container.x / baseDistance;
|
|
|
|
|
workspaceAnimation: Use a workspace strip
Currently, the workspace swipe transition only has one workspace in each
direction. This works until you try to do multiple swipes in quick
succession. The second swipe would continue the existing transition, which
only has 2 or 3 workspaces in it, and will hit a wall.
To prevent this, take all workspaces and arrange them into a column or row,
depending on the layout, and use that as a transition.
For the transition that happens when focusing a window on another workspace
(for example, via Alt+Tab), still use only two workspaces instead of all of
them.
Since we don't support layouts other than single rows/columns anymore,
diagonal transitions aren't supported anymore, and will be shown as
horizontal or vertical instead.
Since nw alt-tab and gesture transitions are different, don't allow to do
both at once, that is, disable swipe tracker when a programmatic transition
is going. This will also conveniently cancel a gesture transition if a
programmatic one is initiated while a gesture is in progress.
Fixes https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/2612
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1326>
2020-06-20 13:01:25 -04:00
|
|
|
const wsGroup = this._findClosestWorkspaceGroup(progress);
|
|
|
|
cancelProgress = this._getProgressForWorkspaceGroup(wsGroup);
|
|
|
|
} else {
|
|
|
|
this._prepareWorkspaceSwitch();
|
2019-07-02 13:28:47 -04:00
|
|
|
|
workspaceAnimation: Use a workspace strip
Currently, the workspace swipe transition only has one workspace in each
direction. This works until you try to do multiple swipes in quick
succession. The second swipe would continue the existing transition, which
only has 2 or 3 workspaces in it, and will hit a wall.
To prevent this, take all workspaces and arrange them into a column or row,
depending on the layout, and use that as a transition.
For the transition that happens when focusing a window on another workspace
(for example, via Alt+Tab), still use only two workspaces instead of all of
them.
Since we don't support layouts other than single rows/columns anymore,
diagonal transitions aren't supported anymore, and will be shown as
horizontal or vertical instead.
Since nw alt-tab and gesture transitions are different, don't allow to do
both at once, that is, disable swipe tracker when a programmatic transition
is going. This will also conveniently cancel a gesture transition if a
programmatic one is initiated while a gesture is in progress.
Fixes https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/2612
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1326>
2020-06-20 13:01:25 -04:00
|
|
|
const activeIndex = workspaceManager.get_active_workspace_index();
|
|
|
|
const wsGroup = this._findWorkspaceGroupByIndex(activeIndex);
|
2019-07-02 13:28:47 -04:00
|
|
|
|
workspaceAnimation: Use a workspace strip
Currently, the workspace swipe transition only has one workspace in each
direction. This works until you try to do multiple swipes in quick
succession. The second swipe would continue the existing transition, which
only has 2 or 3 workspaces in it, and will hit a wall.
To prevent this, take all workspaces and arrange them into a column or row,
depending on the layout, and use that as a transition.
For the transition that happens when focusing a window on another workspace
(for example, via Alt+Tab), still use only two workspaces instead of all of
them.
Since we don't support layouts other than single rows/columns anymore,
diagonal transitions aren't supported anymore, and will be shown as
horizontal or vertical instead.
Since nw alt-tab and gesture transitions are different, don't allow to do
both at once, that is, disable swipe tracker when a programmatic transition
is going. This will also conveniently cancel a gesture transition if a
programmatic one is initiated while a gesture is in progress.
Fixes https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/2612
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1326>
2020-06-20 13:01:25 -04:00
|
|
|
progress = cancelProgress = this._getProgressForWorkspace(wsGroup);
|
|
|
|
}
|
2019-07-02 13:28:47 -04:00
|
|
|
|
workspaceAnimation: Use a workspace strip
Currently, the workspace swipe transition only has one workspace in each
direction. This works until you try to do multiple swipes in quick
succession. The second swipe would continue the existing transition, which
only has 2 or 3 workspaces in it, and will hit a wall.
To prevent this, take all workspaces and arrange them into a column or row,
depending on the layout, and use that as a transition.
For the transition that happens when focusing a window on another workspace
(for example, via Alt+Tab), still use only two workspaces instead of all of
them.
Since we don't support layouts other than single rows/columns anymore,
diagonal transitions aren't supported anymore, and will be shown as
horizontal or vertical instead.
Since nw alt-tab and gesture transitions are different, don't allow to do
both at once, that is, disable swipe tracker when a programmatic transition
is going. This will also conveniently cancel a gesture transition if a
programmatic one is initiated while a gesture is in progress.
Fixes https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/2612
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1326>
2020-06-20 13:01:25 -04:00
|
|
|
const points = this._switchData.workspaceGroups.map(this._getProgressForWorkspace);
|
2019-07-02 13:28:47 -04:00
|
|
|
|
workspaceAnimation: Use a workspace strip
Currently, the workspace swipe transition only has one workspace in each
direction. This works until you try to do multiple swipes in quick
succession. The second swipe would continue the existing transition, which
only has 2 or 3 workspaces in it, and will hit a wall.
To prevent this, take all workspaces and arrange them into a column or row,
depending on the layout, and use that as a transition.
For the transition that happens when focusing a window on another workspace
(for example, via Alt+Tab), still use only two workspaces instead of all of
them.
Since we don't support layouts other than single rows/columns anymore,
diagonal transitions aren't supported anymore, and will be shown as
horizontal or vertical instead.
Since nw alt-tab and gesture transitions are different, don't allow to do
both at once, that is, disable swipe tracker when a programmatic transition
is going. This will also conveniently cancel a gesture transition if a
programmatic one is initiated while a gesture is in progress.
Fixes https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/2612
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1326>
2020-06-20 13:01:25 -04:00
|
|
|
tracker.confirmSwipe(baseDistance, points, progress, cancelProgress);
|
2019-07-02 13:28:47 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
_switchWorkspaceUpdate(tracker, progress) {
|
|
|
|
if (!this._switchData)
|
|
|
|
return;
|
|
|
|
|
|
|
|
let xPos = 0;
|
|
|
|
let yPos = 0;
|
workspaceAnimation: Use a workspace strip
Currently, the workspace swipe transition only has one workspace in each
direction. This works until you try to do multiple swipes in quick
succession. The second swipe would continue the existing transition, which
only has 2 or 3 workspaces in it, and will hit a wall.
To prevent this, take all workspaces and arrange them into a column or row,
depending on the layout, and use that as a transition.
For the transition that happens when focusing a window on another workspace
(for example, via Alt+Tab), still use only two workspaces instead of all of
them.
Since we don't support layouts other than single rows/columns anymore,
diagonal transitions aren't supported anymore, and will be shown as
horizontal or vertical instead.
Since nw alt-tab and gesture transitions are different, don't allow to do
both at once, that is, disable swipe tracker when a programmatic transition
is going. This will also conveniently cancel a gesture transition if a
programmatic one is initiated while a gesture is in progress.
Fixes https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/2612
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1326>
2020-06-20 13:01:25 -04:00
|
|
|
|
|
|
|
if (global.workspace_manager.layout_rows === -1)
|
|
|
|
yPos = -Math.round(progress * global.screen_height);
|
|
|
|
else if (Clutter.get_default_text_direction() === Clutter.TextDirection.RTL)
|
|
|
|
xPos = Math.round(progress * global.screen_width);
|
|
|
|
else
|
|
|
|
xPos = -Math.round(progress * global.screen_width);
|
2019-07-02 13:28:47 -04:00
|
|
|
|
|
|
|
this._switchData.container.set_position(xPos, yPos);
|
|
|
|
}
|
|
|
|
|
|
|
|
_switchWorkspaceEnd(tracker, duration, endProgress) {
|
|
|
|
if (!this._switchData)
|
|
|
|
return;
|
|
|
|
|
workspaceAnimation: Use a workspace strip
Currently, the workspace swipe transition only has one workspace in each
direction. This works until you try to do multiple swipes in quick
succession. The second swipe would continue the existing transition, which
only has 2 or 3 workspaces in it, and will hit a wall.
To prevent this, take all workspaces and arrange them into a column or row,
depending on the layout, and use that as a transition.
For the transition that happens when focusing a window on another workspace
(for example, via Alt+Tab), still use only two workspaces instead of all of
them.
Since we don't support layouts other than single rows/columns anymore,
diagonal transitions aren't supported anymore, and will be shown as
horizontal or vertical instead.
Since nw alt-tab and gesture transitions are different, don't allow to do
both at once, that is, disable swipe tracker when a programmatic transition
is going. This will also conveniently cancel a gesture transition if a
programmatic one is initiated while a gesture is in progress.
Fixes https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/2612
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1326>
2020-06-20 13:01:25 -04:00
|
|
|
const newGroup = this._findClosestWorkspaceGroup(endProgress);
|
2019-07-02 13:28:47 -04:00
|
|
|
|
|
|
|
const switchData = this._switchData;
|
|
|
|
switchData.gestureActivated = true;
|
|
|
|
|
|
|
|
this._switchData.container.ease({
|
workspaceAnimation: Use a workspace strip
Currently, the workspace swipe transition only has one workspace in each
direction. This works until you try to do multiple swipes in quick
succession. The second swipe would continue the existing transition, which
only has 2 or 3 workspaces in it, and will hit a wall.
To prevent this, take all workspaces and arrange them into a column or row,
depending on the layout, and use that as a transition.
For the transition that happens when focusing a window on another workspace
(for example, via Alt+Tab), still use only two workspaces instead of all of
them.
Since we don't support layouts other than single rows/columns anymore,
diagonal transitions aren't supported anymore, and will be shown as
horizontal or vertical instead.
Since nw alt-tab and gesture transitions are different, don't allow to do
both at once, that is, disable swipe tracker when a programmatic transition
is going. This will also conveniently cancel a gesture transition if a
programmatic one is initiated while a gesture is in progress.
Fixes https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/2612
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1326>
2020-06-20 13:01:25 -04:00
|
|
|
x: -newGroup.x,
|
|
|
|
y: -newGroup.y,
|
2019-07-02 13:28:47 -04:00
|
|
|
duration,
|
|
|
|
mode: Clutter.AnimationMode.EASE_OUT_CUBIC,
|
|
|
|
onComplete: () => {
|
workspaceAnimation: Use a workspace strip
Currently, the workspace swipe transition only has one workspace in each
direction. This works until you try to do multiple swipes in quick
succession. The second swipe would continue the existing transition, which
only has 2 or 3 workspaces in it, and will hit a wall.
To prevent this, take all workspaces and arrange them into a column or row,
depending on the layout, and use that as a transition.
For the transition that happens when focusing a window on another workspace
(for example, via Alt+Tab), still use only two workspaces instead of all of
them.
Since we don't support layouts other than single rows/columns anymore,
diagonal transitions aren't supported anymore, and will be shown as
horizontal or vertical instead.
Since nw alt-tab and gesture transitions are different, don't allow to do
both at once, that is, disable swipe tracker when a programmatic transition
is going. This will also conveniently cancel a gesture transition if a
programmatic one is initiated while a gesture is in progress.
Fixes https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/2612
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1326>
2020-06-20 13:01:25 -04:00
|
|
|
if (!newGroup.workspace.active)
|
|
|
|
newGroup.workspace.activate(global.get_current_time());
|
2019-07-02 13:28:47 -04:00
|
|
|
this._finishWorkspaceSwitch(switchData);
|
|
|
|
},
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
get gestureActive() {
|
|
|
|
return this._switchData !== null && this._switchData.gestureActivated;
|
|
|
|
}
|
|
|
|
|
2020-01-21 08:09:56 -05:00
|
|
|
cancelSwitchAnimation() {
|
|
|
|
if (!this._switchData)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (this._switchData.gestureActivated)
|
|
|
|
return;
|
|
|
|
|
|
|
|
this._finishWorkspaceSwitch(this._switchData);
|
|
|
|
}
|
|
|
|
|
2019-07-02 13:28:47 -04:00
|
|
|
set movingWindow(movingWindow) {
|
|
|
|
this._movingWindow = movingWindow;
|
|
|
|
}
|
|
|
|
|
|
|
|
get movingWindow() {
|
|
|
|
return this._movingWindow;
|
|
|
|
}
|
|
|
|
};
|