-
-
Notifications
You must be signed in to change notification settings - Fork 60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support GJS 1.72 Shell 42 #217
Changes from all commits
b0c4b11
1b51812
7c9c28f
a3df0ae
c8a87ef
423e1e1
09af7f3
4bd10fb
174fa3c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
{ | ||
"shell-version": [ | ||
"40", | ||
"41" | ||
"42" | ||
], | ||
"uuid": "[email protected]", | ||
"url": "https://github.com/mzur/gnome-shell-wsmatrix", | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,28 +2,31 @@ const ExtensionUtils = imports.misc.extensionUtils; | |
const Self = ExtensionUtils.getCurrentExtension(); | ||
const Util = Self.imports.util; | ||
const OverviewControls = imports.ui.overviewControls; | ||
const { ControlsState } = OverviewControls; | ||
|
||
const { SMALL_WORKSPACE_RATIO } = OverviewControls; | ||
//const { SMALL_WORKSPACE_RATIO } = OverviewControls; | ||
const SMALL_WORKSPACE_RATIO = 0.15; | ||
|
||
var ControlsManagerLayout = class { | ||
constructor() { | ||
this.originalLayout = null; | ||
this._overrideProperties = { | ||
_computeWorkspacesBoxForState(state, workAreaBox, searchHeight, dashHeight, thumbnailsHeight) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is an incompatible change. @mzur, would you please open a shell-42 branch (or take this as it)? |
||
const { ControlsState } = OverviewControls; | ||
const workspaceBox = workAreaBox.copy(); | ||
const [startX, startY] = workAreaBox.get_origin(); | ||
_computeWorkspacesBoxForState(state, box, workAreaBox, searchHeight, dashHeight, thumbnailsHeight) { | ||
const workspaceBox = box.copy(); | ||
const [width, height] = workspaceBox.get_size(); | ||
const { y1: startY } = workAreaBox; | ||
const {spacing} = this; | ||
const {expandFraction} = this._workspacesThumbnails; | ||
let workspaceManager = global.workspace_manager; | ||
let rows = workspaceManager.layout_rows; | ||
|
||
switch (state) { | ||
case ControlsState.HIDDEN: | ||
workspaceBox.set_origin(...workAreaBox.get_origin()); | ||
workspaceBox.set_size(...workAreaBox.get_size()); | ||
break; | ||
case ControlsState.WINDOW_PICKER: | ||
workspaceBox.set_origin(startX, | ||
workspaceBox.set_origin(0, | ||
startY + searchHeight + spacing + | ||
thumbnailsHeight * rows + spacing * expandFraction); | ||
workspaceBox.set_size(width, | ||
|
@@ -33,7 +36,7 @@ var ControlsManagerLayout = class { | |
thumbnailsHeight * rows - spacing * expandFraction); | ||
break; | ||
case ControlsState.APP_GRID: | ||
workspaceBox.set_origin(startX, startY + searchHeight + spacing); | ||
workspaceBox.set_origin(0, startY + searchHeight + spacing); | ||
workspaceBox.set_size( | ||
width, | ||
Math.round(height * rows * SMALL_WORKSPACE_RATIO)); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,105 @@ | ||
const {GObject, Meta, St} = imports.gi; | ||
const {Clutter, GObject, Meta, St} = imports.gi; | ||
|
||
const Main = imports.ui.main; | ||
const GWorkspaceAnimation = imports.ui.workspaceAnimation; | ||
const Layout = imports.ui.layout; | ||
const ExtensionUtils = imports.misc.extensionUtils; | ||
const Self = ExtensionUtils.getCurrentExtension(); | ||
const Util = Self.imports.util; | ||
// const {WORKSPACE_SPACING} = GWorkspaceAnimation; | ||
const WORKSPACE_SPACING = 100; | ||
|
||
const MonitorGroup = GObject.registerClass({ | ||
Properties: { | ||
'progress': GObject.ParamSpec.double( | ||
'progress', 'progress', 'progress', | ||
GObject.ParamFlags.READWRITE, | ||
-Infinity, Infinity, 0), | ||
}, | ||
}, class MonitorGroup extends St.Widget { | ||
get baseDistance() { | ||
const spacing = WORKSPACE_SPACING * St.ThemeContext.get_for_stage(global.stage).scale_factor; | ||
|
||
if (global.workspace_manager.layout_rows === -1) | ||
return this._monitor.height + spacing; | ||
else | ||
return this._monitor.width + spacing; | ||
} | ||
|
||
get index() { | ||
return this._monitor.index; | ||
} | ||
|
||
getWorkspaceProgress(workspace) { | ||
const group = this._workspaceGroups.find(g => | ||
g.workspace.index() === workspace.index()); | ||
return this._getWorkspaceGroupProgress(group); | ||
} | ||
|
||
getSnapPoints() { | ||
return this._workspaceGroups.map(g => | ||
this._getWorkspaceGroupProgress(g)); | ||
} | ||
|
||
findClosestWorkspace(progress) { | ||
const distances = this.getSnapPoints().map(p => | ||
Math.abs(p - progress)); | ||
const index = distances.indexOf(Math.min(...distances)); | ||
return this._workspaceGroups[index].workspace; | ||
} | ||
|
||
const { WORKSPACE_SPACING } = GWorkspaceAnimation; | ||
_interpolateProgress(progress, monitorGroup) { | ||
if (this.index === monitorGroup.index) | ||
return progress; | ||
|
||
const points1 = monitorGroup.getSnapPoints(); | ||
const points2 = this.getSnapPoints(); | ||
|
||
const upper = points1.indexOf(points1.find(p => p >= progress)); | ||
const lower = points1.indexOf(points1.slice().reverse().find(p => p <= progress)); | ||
|
||
if (points1[upper] === points1[lower]) | ||
return points2[upper]; | ||
|
||
const t = (progress - points1[lower]) / (points1[upper] - points1[lower]); | ||
|
||
return points2[lower] + (points2[upper] - points2[lower]) * t; | ||
} | ||
|
||
updateSwipeForMonitor(progress, monitorGroup) { | ||
this.progress = this._interpolateProgress(progress, monitorGroup); | ||
} | ||
|
||
// The above is a copy of now inaccessible GWorkspaceAnimation.MonitorGroup | ||
// Modifications below. | ||
|
||
const MonitorGroup = GObject.registerClass( | ||
class MonitorGroup extends GWorkspaceAnimation.MonitorGroup { | ||
_init(monitor, workspaceIndices, movingWindow) { | ||
super._init(monitor, workspaceIndices, movingWindow); | ||
super._init({ | ||
clip_to_allocation: true, | ||
style_class: 'workspace-animation', | ||
}); | ||
|
||
this._monitor = monitor; | ||
|
||
const constraint = new Layout.MonitorConstraint({ index: monitor.index }); | ||
this.add_constraint(constraint); | ||
|
||
this._container = new Clutter.Actor(); | ||
this.add_child(this._container); | ||
|
||
const stickyGroup = new GWorkspaceAnimation.WorkspaceGroup(null, monitor, movingWindow); | ||
this.add_child(stickyGroup); | ||
|
||
this.activeWorkspace = workspaceIndices[0]; | ||
this.targetWorkspace = workspaceIndices[workspaceIndices.length - 1]; | ||
|
||
this._workspaceGroups = []; | ||
|
||
const workspaceManager = global.workspace_manager; | ||
const activeWorkspace = workspaceManager.get_active_workspace(); | ||
|
||
let x = 0; | ||
let y = 0; | ||
let workspaceManager = global.workspace_manager; | ||
this._workspaceGroups = []; | ||
|
||
for (const i of workspaceIndices) { | ||
let fromRow = Math.floor(this.activeWorkspace / this.columns); | ||
|
@@ -37,10 +120,6 @@ class MonitorGroup extends GWorkspaceAnimation.MonitorGroup { | |
} | ||
|
||
const group = new GWorkspaceAnimation.WorkspaceGroup(ws, monitor, movingWindow); | ||
// avoid warnings | ||
group._syncStacking = () => { | ||
}; | ||
|
||
this._workspaceGroups.push(group); | ||
this._container.add_child(group); | ||
group.set_position(x, y); | ||
|
@@ -55,6 +134,8 @@ class MonitorGroup extends GWorkspaceAnimation.MonitorGroup { | |
else if (targetColumn < fromColumn) | ||
x -= this.baseDistanceX; | ||
} | ||
|
||
this.progress = this.getWorkspaceProgress(activeWorkspace); | ||
} | ||
|
||
get rows() { | ||
|
@@ -132,7 +213,7 @@ class MonitorGroup extends GWorkspaceAnimation.MonitorGroup { | |
} | ||
}); | ||
|
||
class WorkspaceAnimationController extends GWorkspaceAnimation.WorkspaceAnimationController { | ||
var WorkspaceAnimationController = class WorkspaceAnimationController extends GWorkspaceAnimation.WorkspaceAnimationController { | ||
_prepareWorkspaceSwitch(workspaceIndices) { | ||
if (this._switchData) | ||
return; | ||
|
@@ -169,3 +250,38 @@ class WorkspaceAnimationController extends GWorkspaceAnimation.WorkspaceAnimatio | |
Meta.disable_unredirect_for_display(global.display); | ||
} | ||
} | ||
|
||
var WorkspaceGroup = class { | ||
constructor() { | ||
this.originalLayout = null; | ||
this._overrideProperties = { | ||
_syncStacking() { | ||
const windowActors = global.get_window_actors().filter(w => | ||
this._shouldShowWindow(w.meta_window)); | ||
|
||
let lastRecord; | ||
|
||
for (const windowActor of windowActors) { | ||
const record = this._windowRecords.find(r => r.windowActor === windowActor); | ||
|
||
if (record && lastRecord) { | ||
this.set_child_above_sibling(record.clone, lastRecord ? lastRecord.clone : this._background); | ||
lastRecord = record; | ||
} | ||
} | ||
}, | ||
Comment on lines
+258
to
+272
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @ettavolt Could you please explain why this is override necessary? The |
||
} | ||
} | ||
|
||
destroy() { | ||
this.restoreOriginalProperties(); | ||
} | ||
|
||
overrideOriginalProperties() { | ||
this.originalLayout = Util.overrideProto(GWorkspaceAnimation.WorkspaceGroup, this._overrideProperties); | ||
} | ||
|
||
restoreOriginalProperties() { | ||
Util.overrideProto(GWorkspaceAnimation.WorkspaceGroup, this.originalLayout); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wait for Gnome Team to agree or disagree on opening this and other bits.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you open an issue or merge request at https://gitlab.gnome.org/GNOME/gnome-shell?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here
Or just a patch (apply with patch -p1).