mzur / gnome-shell-wsmatrix

GNOME shell extension to arrange workspaces in a two-dimensional grid with workspace thumbnails
GNU General Public License v3.0
458 stars 58 forks source link

Support GJS 1.72 Shell 42 #217

Closed ettavolt closed 2 years ago

ettavolt commented 2 years ago

Closes #212.

I'll go and ask Gnome team to open SecondaryMonitorDisplay along MonitorGroup and a couple of constants. If they don't, we'll need to copy entire SecondaryMonitorDisplay and monkey-patch WorkspacesDisplay.

ettavolt commented 2 years ago

With this and locally rebuilt shell (opening the above stuff) I now observe

apr 07 14:07:33 ptits-lt gnome-shell[16482]: clutter_actor_allocate: assertion '!isnan (real_allocation.x1) && !isnan (real_allocation.x2) && !isnan (real_allocation.y1) && !isnan (real_allocation.y2)' failed
apr 07 14:07:33 ptits-lt gnome-shell[16482]: Can't update stage views actor <unnamed>[<Gjs_ui_workspacesView_WorkspacesDisplay>:0x55648e05d5c0] is on because it needs an allocation.
apr 07 14:07:33 ptits-lt gnome-shell[16482]: Can't update stage views actor <unnamed>[<Gjs_ui_workspacesView_WorkspacesView>:0x55648faf3830] is on because it needs an allocation.
apr 07 14:07:33 ptits-lt gnome-shell[16482]: Can't update stage views actor <unnamed>[<Gjs_ui_workspace_Workspace>:0x55648dff14a0] is on because it needs an allocation.
апр 07 14:07:33 ptits-lt gnome-shell[16482]: Can't update stage views actor <unnamed>[<Gjs_ui_workspace_WorkspaceBackground>:0x55648dfd5880] is on because it needs an allocation.
апр 07 14:07:33 ptits-lt gnome-shell[16482]: Can't update stage views actor <unnamed>[<ClutterActor>:0x55648e4e5f40] is on because it needs an allocation.
apr 07 14:07:33 ptits-lt gnome-shell[16482]: Can't update stage views actor <unnamed>[<MetaBackgroundGroup>:0x55648cef3c60] is on because it needs an allocation.
apr 07 14:07:33 ptits-lt gnome-shell[16482]: Can't update stage views actor <unnamed>[<MetaBackgroundActor>:0x55648efa6df0] is on because it needs an allocation.
apr 07 14:07:33 ptits-lt gnome-shell[16482]: Can't update stage views actor <unnamed>[<ClutterActor>:0x55648ced7f70] is on because it needs an allocation.
apr 07 14:07:33 ptits-lt gnome-shell[16482]: Can't update stage views actor <unnamed>[<Gjs_ui_workspace_Workspace>:0x55648de04020] is on because it needs an allocation.
апр 07 14:07:33 ptits-lt gnome-shell[16482]: Can't update stage views actor <unnamed>[<Gjs_ui_workspace_WorkspaceBackground>:0x55648d2dac20] is on because it needs an allocation.
апр 07 14:07:33 ptits-lt gnome-shell[16482]: Can't update stage views actor <unnamed>[<ClutterActor>:0x55648ced7930] is on because it needs an allocation.
апр 07 14:07:33 ptits-lt gnome-shell[16482]: Can't update stage views actor <unnamed>[<MetaBackgroundGroup>:0x55648ced7610] is on because it needs an allocation.
апр 07 14:07:33 ptits-lt gnome-shell[16482]: Can't update stage views actor <unnamed>[<MetaBackgroundActor>:0x55648d30f7d0] is on because it needs an allocation.
apr 07 14:07:33 ptits-lt gnome-shell[16482]: Can't update stage views actor <unnamed>[<ClutterActor>:0x55648ced6fd0] is on because it needs an allocation.
apr 07 14:07:33 ptits-lt gnome-shell[16482]: Can't update stage views actor <unnamed>[<Gjs_ui_workspace_Workspace>:0x55648de68c20] is on because it needs an allocation.
apr 07 14:07:33 ptits-lt gnome-shell[16482]: Can't update stage views actor <unnamed>[<Gjs_ui_workspace_WorkspaceBackground>:0x55648e179210] is on because it needs an allocation.
апр 07 14:07:33 ptits-lt gnome-shell[16482]: Can't update stage views actor <unnamed>[<ClutterActor>:0x55648ced6cb0] is on because it needs an allocation.
апр 07 14:07:33 ptits-lt gnome-shell[16482]: Can't update stage views actor <unnamed>[<MetaBackgroundGroup>:0x55648ced6990] is on because it needs an allocation.
apr 07 14:07:33 ptits-lt gnome-shell[16482]: Can't update stage views actor <unnamed>[<MetaBackgroundActor>:0x55648d30fb00] is on because it needs an allocation.
apr 07 14:07:33 ptits-lt gnome-shell[16482]: Can't update stage views actor <unnamed>[<ClutterActor>:0x55648ced6670] is on because it needs an allocation.

Any ideas how to catch this NaN? :)

pdecat commented 2 years ago

Great work! I'd like to test this.

locally rebuilt shell (opening the above stuff)

Would you mind sharing precisely what changes you made?

ljanyst commented 2 years ago

Thanks for this!

There's a problem with the pop-up not disappearing when I release CTRL+ALT. I need to either select the workspace with enter or kill the popup with ESC.

ljanyst commented 2 years ago

Correction. It does not change workspaces for me at all.

ettavolt commented 2 years ago

Correction. It does not change workspaces for me at all.

Some overrides for inaccessible Shell UI is not enough to cover everything (overview is broken), but it has to be disabled if you are running a patched shell.

Edit: I've just pushed a couple of changes that should make the last commit compatible with a patched shell.

ljanyst commented 2 years ago

Thanks for the explanation! How fast do you think the patched shell will be available? Is it worth it to invest time in building custom Debian packages? Can you please point me to the patches?

ettavolt commented 2 years ago

Give that I saw noone in the shell PR, not soon. Debian packages are harder than Arch's, can't say. Patch

ljanyst commented 2 years ago

Thanks!

zweif commented 2 years ago

I added a commit for drag and drop: https://github.com/zweif/gnome-shell-wsmatrix/commit/60c0a0c0a02b1f771d3f7aa16af32725dc76593e I also tried to get workspace selection by clicking to work, but without success. The click event doesn't seem to be noticed for clicks in lower rows. Clicks on windows in thumbnails are working somehow.

esauvisky commented 2 years ago

First of all thanks for your work on porting this over to Gnome 42.

I checked out this PR and most things work, besides having a bug in which when switching to any workspace without windows, the windows of a different workspace (couldn't determine which) would show up, as if they were on that workspace instead to begin with. It's not possible to interact with the applications outside their actual workspace though.

I don't have much time and even less any knowledge on GJS but managed to pinpoint the issue via this journal error:

[...]
abr 18 08:06:30 gnome-shell[10586]: Called enable_unredirect_for_display while unredirection is enabled.
abr 18 08:06:30 gnome-shell[10586]: JS ERROR: TypeError: Object 0x389ef8fc1988 is not a subclass of GObject_Object, it's a Object
                                    _init@/home/emi/.local/share/gnome-shell/extensions/wsmatrix@martin.zurowietz.de/workspacePopup/workspaceAnimation.js:91:14
                                    MonitorGroup@/home/emi/.local/share/gnome-shell/extensions/wsmatrix@martin.zurowietz.de/workspacePopup/workspaceAnimation.js:19:4
                                    _prepareWorkspaceSwitch@/home/emi/.local/share/gnome-shell/extensions/wsmatrix@martin.zurowietz.de/workspacePopup/workspaceAnimation.js:241:27
                                    animateSwitch@resource:///org/gnome/shell/ui/workspaceAnimation.js:371:14
                                    _switchWorkspace@resource:///org/gnome/shell/ui/windowManager.js:1632:34
                                    actionMoveWorkspace@resource:///org/gnome/shell/ui/windowManager.js:1836:23
                                    _showWorkspaceSwitcher@/home/emi/.local/share/gnome-shell/extensions/wsmatrix@martin.zurowietz.de/workspacePopup/workspaceManagerOverride.js:426:25
                                    Caused by: Error: This JS object wrapper isn't wrapping a GObject. If this is a custom subclass, are you sure you chained up to the parent _init properly?

I assumed the subsequent code was probably not being executed and wrapped the instantiation of WorkspaceGroup in a try/catch block, which apparently worked around the issue for now:

        try {
            const stickyGroup = new WorkspaceGroup(null, monitor, movingWindow);
            this.add_child(stickyGroup);
        } catch (e) {}

Let me know if there is anything I can do to help with the porting.

mzur commented 2 years ago

I added a commit for drag and drop: zweif@60c0a0c I also tried to get workspace selection by clicking to work, but without success. The click event doesn't seem to be noticed for clicks in lower rows. Clicks on windows in thumbnails are working somehow.

@zweif This issue was already observed for GNOME Shell 40 (see #177).

mzur commented 2 years ago

@ebeem Could you please explain what the SecondaryMonitorDisplay override was meant to do? The overview seems to look alright on all monitors if I disable the override (this is one of the things that can't be imported any more in GNOME 42).

ebeem commented 2 years ago

@mzur I think it overrides the app grid mode. So if you have multi-monitors with the app grid view activates (double super), you should be able to see the thumbnails of the workspaces on the other monitors in a grid rather than a row.

ljanyst commented 2 years ago

I had a look and it seems to mostly work. Thanks everyone for fixing it. There's one regression though. In the previous version, the grid stayed on the screen as long as you kept CTRL+ALT pressed. Now, you either have to confirm the workspace selection with enter or set up a timeout for it to disappear. Any chance the old behavior can be restored?

mzur commented 2 years ago

@ebeem Thanks! This is what it looks like for me if the override is disabled:

Screenshot from 2022-04-22 15-55-10

I guess the override would fix the positioning of the workspaces on the second screen. But to be honest, I could live with the buggy behavior until the objects are made public again by GNOME Shell. Does anyone have objections?

mzur commented 2 years ago

@ljanyst Thanks, I can confirm this issue.

@ebeem Could you point out where the logic for the key event is located that lets the popup stay open while the keys are pressed? Then I can try to figure out why it no longer works in GNOME 42.

ebeem commented 2 years ago

https://github.com/mzur/gnome-shell-wsmatrix/blob/28c191c21c30995b918c19800a8664e9fb1f90c4/wsmatrix%40martin.zurowietz.de/workspacePopup/workspaceManagerOverride.js#L451

The return state here is null for some reason, I will try to debug it more, but this is either an upstream issue or there is some update that breaks this functionality

zweif commented 2 years ago

I added a commit for drag and drop: zweif@60c0a0c I also tried to get workspace selection by clicking to work, but without success. The click event doesn't seem to be noticed for clicks in lower rows. Clicks on windows in thumbnails are working somehow.

@zweif This issue was already observed for GNOME Shell 40 (see #177).

I wasn't aware of this issue and it seems to match my observations, but drag and drop works for me with this change.

ahopkins commented 2 years ago

Eagerly awaiting this... Anything that I can help with?

mzur commented 2 years ago

This can continue in https://github.com/mzur/gnome-shell-wsmatrix/pull/218. I'll create a beta release from that branch.