mzur / gnome-shell-wsmatrix

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

[WIP] initial gnome 40 support #152

Closed ebeem closed 3 years ago

ebeem commented 3 years ago

Please report bugs/issues or discuss features in the discussion accompanying the alpha release for GNOME 40 support.

Still has many bugs, and only the switcher is implemented (no overview).

bugs/missing features:

minor improvements & extra features:

what's good about this branch:

Currently, this implements the switcher using a modifier key. I think this implementation will help us fix a lot of issues and have more flexibility. I am not going to be able to work on this gnome#40 support for about 3 weeks, I will look at it after that and try to fix current bugs.

Any contributions are welcomed. We will probably not merge this into master, once we finalize it, it's better to create a new branch because this one will probably have a lot of dirty code in it.

fixes #146

ebeem commented 3 years ago

keybindings are fixed now, they follow the same older approach which is getting them from gsettings https://github.com/mzur/gnome-shell-wsmatrix/wiki/Custom-keyboard-shortcuts

The modifier key needs to be detected now to make the release modifier work properly in all different keybindings.

ebeem commented 3 years ago

Done, I think this branch is production ready now, we need more testers to confirm the stability. The missing features are not very critical and they didn't exist in the previous version anyways.

mzur commented 3 years ago

Thanks for all the work, @ebeem! I'm still struggling to find the time to dig through all the code. I'd like to review the code and all the issues that were raised here and are to be resolved by this PR before an official release is made. We could do an alpha release before that, though, if you like. Please bear with me, it could still take a few weeks for me to review and test everything.

ebeem commented 3 years ago

@mzur totally excused, everyone got their own busy weeks. Best of luck. :+1:

rakus commented 3 years ago

I'm using this branch for quite some while and it works good for me. Except ...

I'm using <Ctrl>+<Alt>+Arrow to move between desktops, the popup time is 0 and I have a 2 rows x 4 cols setup.

Problem:

If I release <Ctrl> and <Alt> at the same time, the chances are high, that I end up on the workspace the mouse is pointing to.

If I release <Ctrl> first and then <Alt> I end up on the workspace where I navigated to. Same other way around.

So it seems there is some kind of race condition. I read through the source (of the extension and Gnome-Shell) and found this comment that might be somewhat related.

Thank you for your great work!

ebeem commented 3 years ago

@rakus Can you please make sure your extension is up to date? this problem did exist before, but not anymore. I can't reproduce myself. As long as you don't move your pointer when you show the switcher popup, you should land in the workspace you want regardless of where your pointer is.

rakus commented 3 years ago

@ebeem I can definitely reproduce it with the current branch gnome-40. The directory ~/.local/share/gnome-shell/extensions/wsmatrix@martin.zurowietz.de is a symlink to the git repo and the branch is up to date (Commit 6ae77b2).

I'm using a Thinkpad with trackpoint (trackpad disabled). I suspected that this is a problem, but even after disabling the trackpoint and connecting a external mouse I could reproduce it. I could even reproduce it with all pointing devices disabled.

I have some basic knowledge of shell extension development. I could do some testing, collect logs ... whatever. Just tell me.

BTW: Fedora 34 & Gnome-Shell 40.2

ebeem commented 3 years ago

@rakus that will be so helpful! Here is the part that's supposed to fix your issue.

https://github.com/mzur/gnome-shell-wsmatrix/blob/6ae77b28373fce7e86167b04edd06565758b5734/wsmatrix%40martin.zurowietz.de/workspacePopup/workspaceSwitcherPopup.js#L18-L37

This code specifically this._disableHover();

And here are some references to what the code will modify

    _itemEntered(switcher, n) {
        if (!this.mouseActive)
            return;
        this._itemEnteredHandler(n);
    }

    _disableHover() {
        this.mouseActive = false;

        if (this._motionTimeoutId != 0)
            GLib.source_remove(this._motionTimeoutId);

        this._motionTimeoutId = GLib.timeout_add(GLib.PRIORITY_DEFAULT, DISABLE_HOVER_TIMEOUT, this._mouseTimedOut.bind(this));
        GLib.Source.set_name_by_id(this._motionTimeoutId, '[gnome-shell] this._mouseTimedOut');
    }

    _mouseTimedOut() {
        this._motionTimeoutId = 0;
        this.mouseActive = true;
        return GLib.SOURCE_REMOVE;
    }

I think you probably want to debug _itemEntered by overriding in WorkspaceSwitcherPopup and checking the value of mouseActive in there. It seems like yours is always true for some reason.

rakus commented 3 years ago

@ebeem Yes, when I end up on the wrong workspace, the mouse is active. But I also had lots of situations where I end up on the correct workspace. Then mouseActive is false. I'm still not able to provide a clear reproducible scenario. Very frustrating. The only thing I observed is that the mouse pointer seems to change shape for a very short period when I release Ctrl+Alt. This is only a short flash, but I can see it when I end up on the wrong workspace. I'm sorry to provide such imprecise problem description.

In desperation I have overridden the method vfunc_key_release_event like this:

vfunc_key_release_event(keyEvent) {
    this._disableHover();
    return super.vfunc_key_release_event(keyEvent);
}

Since then I was not able to reproduce the problem. I don't know which side effects this might have.

rakus commented 3 years ago

Forgotten to mention: When I end up on the wrong workspace I see this message in journal:

gnome-shell[6608]: Window manager warning: META_CURRENT_TIME used to choose focus window; focus window may not be correct.

I was not able to determine the source of this.

ebeem commented 3 years ago

Thanks @rakus The information you provided are actually very helpful. I think if you override the release event, you won't be able to select the workspace with your mouse in the popup. Because now you actually can hover workspaces or click them with your mouse to change workspace.

Now regarding the warning, it's not clear to me as well, but it seems to be something related to window focusing, I am not sure but I think there is another shortcut or behavior that's occurring along with the workspace switching. It seems like something else in your environment is performing some gnome tasks while the switcher is open.

rakus commented 3 years ago

@ebeem After overriding vfunc_key_release_event selecting by mouse still works. Even changing workspaces via scrolling works. Don't know which other mouse-related functionalities are available.

rakus commented 3 years ago

@ebeem I added some logging to workspaceSwitcherPopup.js:

_finish(_timestamp) {
    log("_finish - start: " + global.workspace_manager.get_active_workspace_index());
    while (modals.length > 0) {
    modals.pop().fadeAndDestroy();
    }
    log("_finish - end: " + global.workspace_manager.get_active_workspace_index());
}

_onDestroy() {
    log("_onDestroy: " + global.workspace_manager.get_active_workspace_index());
    super._onDestroy();
    while (modals.length > 0) {
    modals.pop().destroy();
    }
}
vfunc_key_release_event(keyEvent) {
    log("vfunc_key_release_event: " + global.workspace_manager.get_active_workspace_index());
    //this._disableHover();
    return super.vfunc_key_release_event(keyEvent);
}

When it goes wrong I see the following log entries:

Jun 19 20:45:40 ghostdog gnome-shell[6608]: vfunc_key_release_event: 2
Jun 19 20:45:40 ghostdog gnome-shell[6608]: _finish - start: 2
Jun 19 20:45:40 ghostdog gnome-shell[6608]: _finish - end: 2
Jun 19 20:45:40 ghostdog gnome-shell[6608]: Window manager warning: META_CURRENT_TIME used to choose focus window; focus window may not be correct.
Jun 19 20:45:40 ghostdog gnome-shell[6608]: _onDestroy: 5
rakus commented 3 years ago

Based on my previous comment, I added this._disableHover() to _finish(_timestamp):

_finish(_timestamp) {
    this._disableHover();
    while (modals.length > 0) {
        modals.pop().fadeAndDestroy();
    }
}

BTW: The timer created by _disableHover() is deleted in the _onDestroy() method in the class SwitcherPopup.

For now I couldn't reproduce my previous problem with this change.

ElijahLynn commented 3 years ago

I don't have that much time for this but do have some money so I just sent $10 USD to the maintainer (@mzur) and will send another $50 when this issue is closed out/released. In mean time I will try to test ~the beta~ this PR out as I just got auto-updated to 40.2 on Arch Linux and my grid is broken now and I do miss my workspace grid and shortcuts soo much!! Thank you all for your work on this extension, one of the useful extensions ever for me!

Update: I'll also send $50 to @ebeem on completion of Gnome 40 support if you want it, just provide me a method or link to send to. And @rakus, since you are helping too with testing and improvements so I'd like to offer $30 to you as well, if yes, send me method or link too.

mzur commented 3 years ago

@ElijahLynn Thanks for your willingness to contribute. I haven't forgotten this PR but my main issue is that I need more than the 1-2 hours I can usually spare to even start working on this. I'll probably have to take a whole day off to work on this and I haven't gotten around to do that yet.

@ebeem I already received a small donation related to this PR which I wanted to forward to you. I tried to reach you via the email address of your commits but this didn't work.

rakus commented 3 years ago

@ElijahLynn I try to help, because I love the extension. Thank you for you offer, but others have invested much more time on this issue than I did. They deserve the be honored.

ElijahLynn commented 3 years ago

I just tested it with https://github.com/mzur/gnome-shell-wsmatrix#developing and #161 and it already has given me my sanity back! Other than the overview still being horizontal (known issue/task mentioned in issue description) I haven't noticed any glitches yet and all my keyboard shortcuts just started working again, it even remembered how many workspaces I had in between uninstalling the old one and the version in this PR.

I'll keep this as is and pull in new changes to keep testing until this is ready to ship!

Thanks all!

ebeem commented 3 years ago

Thanks all for your support, it's very much appreciated. I am also a user of this extension, and I love using it and improving it more.

I am currently a bit busy with work and a part-time degree, I hope I will have more time to work more on this PR. There is some unreported progress with the overview workspace grid, but I can't send a WIP work to this PR anymore because I assume there are users to this PR and I want to make sure that their experience won't be lower because of incomplete work. I might create another branch in case someone is interested in developing or checking the current code.

Here is a photo of the overview (only primary screen works for now because the others need to be modified from another piece of code). Also, the space of the windows need to be decreased so the workspace grid can have more space to show all the thumbnails. Untitled1242134

I will finish my part-time degree by August and hopefully work on the rest of the issues then. I am leaving my paypal account below in case anyone is willing to support, many thanks! https://paypal.me/IAlmarhoon

mzur commented 3 years ago

@ebeem I forwarded you some money I already received for this PR and added your details to the sponsoring information of this repo. Also, I think we should keep everything to this PR and don't need another branch. Users of this branch can decide for themselves if they want to update to the most recent changes and can always roll back. We could also do alpha releases that are somewhat less work-in-progress than the most recent state of this PR.

Good luck with your degree! That's top priority, of course.

mohaque0 commented 3 years ago

@ebeem I would be interested in trying out your WIP branch with the overview changes. I'm not very familiar with the code but if there are any bugs with easy fixes I could try to contribute.

ebeem commented 3 years ago

@mohaque0 I will push the current changes, it's in no way final. I was also doing a lot of experimenting as it requires a lot of changes to really make wsmatrix integrated with the overview. It's not just about the workspace layout itself, it is also about the other new concepts in gnome 40 including multiple monitor support and application/search view mode.

tjaalton commented 3 years ago

I'm seeing an issue where wsmatrix crashes when resuming from suspend.. the error is 'this.this is undefined' according to the extensions app.

ebeem commented 3 years ago

@tjaalton that's right, I noticed this as well. I will see if I can do anything about it.

cjkr commented 3 years ago

Are there plans to have a workspace switcher widget in the panel to enable navigation between workspaces using only the mouse?

Also, is it possible to disable the switcher popup when changing workspaces?

mzur commented 3 years ago

@cjkr A widget in the panel is not planned. I think there is a separate extension for that. You can disable the popup when switching workspaces by setting the "time to show the popup" to 0 (but I don't know if this is already implemented for GNOME 40).

deekej commented 3 years ago

I've been constantly trying your WIP, @mzur, and the latest version of this PR seems to be crashing after some time spent running in Gnome on Wayland. After that, I have to relogin for the extension to start working again... :)

If you would tell me how, then I could provide you with some logs if needed. :)

Quip11 commented 3 years ago

Extra this

diff --git a/wsmatrix@martin.zurowietz.de/overview/overviewManager.js b/wsmatrix@martin.zurowietz.de/overview/overviewManager.js
index 7bbe8b4..9afc59d 100644
--- a/wsmatrix@martin.zurowietz.de/overview/overviewManager.js
+++ b/wsmatrix@martin.zurowietz.de/overview/overviewManager.js
@@ -54,7 +54,7 @@ var OverviewManager = class {
     destroy() {
         this._workspacesViewOverride.destroy();
         this._thumbnailsBoxOverride.destroy();
-        this.this._controlsManagerLayoutOverride.destroy();
+        this._controlsManagerLayoutOverride.destroy();
         // this._layoutManager.destroy();
         // this._layoutManager = this._overrideProperties['_layoutManager'];
         this._controls.destroy();
mzur commented 3 years ago

@deekej You can get logs with possible error messages with journalctl /usr/bin/gnome-shell.

@Quip11 Thanks!

ebeem commented 3 years ago

Thanks @Quip11 & @mzur I just tried your changes and I can confirm that it's working.

Quip11 commented 3 years ago

I've been constantly trying your WIP, @mzur, and the latest version of this PR seems to be crashing after some time spent running in Gnome on Wayland. After that, I have to relogin for the extension to start working again... :)

If you would tell me how, then I could provide you with some logs if needed. :)

Can you try again with @mzur's latest commit?

ebeem commented 3 years ago

maybe it's good to note that after suspend, the thumbnails in the overview aren't displayed in a grid anymore. probably destroyed and needs to be constructed again.

Quip11 commented 3 years ago

maybe it's good to note that after suspend, the thumbnails in the overview aren't displayed in a grid anymore. probably destroyed and needs to be constructed again.

Confirmed. Out of suspend, I pressed my Windows key and everything went blank but the top bar. I had to logout and login again.

ebeem commented 3 years ago

@Quip11 in the meantime, if it's an issue to you then you probably want to temporarily switch to xorg. With xorg you can simply restart the shell to get everything back without losing your windows and work.

We will also receive the new very of GNOME (GNOME 41) by Sep 22, we probably need to consider releasing for GNOME 41 since it's coming soon.

Quip11 commented 3 years ago

And the thumbnails that used to show up while switching workspaces is gone too.

Quip11 commented 3 years ago

@ebeem I now see the secondary monitor workspace indicator in the overview. Pressing Left and Right moves between workspaces as indicated. Pressing Up and Down switch workspaces in the overview, but the blue frame indicator doesn't move up and down with it.

My thumbnail popups are working too; I didn't have the timeout configured properly (changed from 10 ms to 1000 ms).

ebeem commented 3 years ago

@Quip11 Thanks for letting me know. I am working on the indicator already and it's working now, I just need to fix it's position. I should be able to fix it in minutes, the overview is working properly now but I need to fix the apps view as well.

ebeem commented 3 years ago

I think there is nothing else to do in the overview WINDOW_PICKER mode. I will continue working on the APP_GRID mode now.

please report any bugs so we can keep track of it.

Quip11 commented 3 years ago

Out-of-suspend works again.

In the overview, the blue frame workspace indicator now follows Up & Down keys, although the animation appears to briefly move Left to Right as if skipping workspaces to the correct place. Minor.

ebeem commented 3 years ago

@mzur I am done with this PR. The minor improvements & extra features section is for features & improvements that we might want to consider in the future and we didn't have them in earlier versions. I can't see any bugs in this PR and it already has more features than the earlier versions. Let's try to release a version for GNOME 40 before GNOME 41 lands and then we skip the GNOME 40 release which might be needed by some users.

tjaalton commented 3 years ago

Shouldn't the popup obey the time that ctrl-alt are pressed down, and not some fixed value in 'time to show the popup'?

Other than that it seems to work fine for me now, thanks!

ebeem commented 3 years ago

@tjaalton set the value of the timeout to 0 to get the behavior you want.

mzur commented 3 years ago

Thanks a lot @ebeem! I'll release this as an alpha version first, then I'll try to review the PR and release a proper version this (or next) week!

deekej commented 3 years ago

I've been having a weird issue with Gnome 40 and the extension after my latest update to this PR. After some time (but almost every time in longer running sessions) the Gnome stops to display the desktop (wallpaper) - instead there's a just a gray area - and it no longer reacts to the Activities button or shortcuts. The only thing I'm able to do is to restart the PC... Here's the photo of the problem:

IMG_20210913_152635__01

@mzur (and maybe others), here's the log of journactl -x --boot /usr/bin/gnome-shell that might contain some indication for you why this keeps happening: matrix-gnome-shell.log

When I had the Matrix extension disabled, none of the above was happening... :)

mzur commented 3 years ago

@deekej Are you sure that you use the latest version? In your log I find Main.overview._overview.controls is undefined which is the error that was addressed by my recent commit 2c218a6082ca1c24af47d607310e0fb003ed16bd.

ebeem commented 3 years ago

Good news, I tried the extension on GNOME 41.rc, it's working perfectly. I just needed to update the metadata.json. So most likely, we are not going to need to make any further changes.

mzur commented 3 years ago

I've tested the implementation without looking at the code, yet, and made the following observations:

I'll have a closer look at the code in the next days and will try to work on these issues.

I've also released the current state as v6.0.0-alpha.

Everyone, please report bugs/issues or discuss features in the discussion accompanying the release from now on.

I'd like to keep this PR focussed on the implementation from now on, as it's grown quite huge and confusing.

rinigus commented 3 years ago

@mzur: something was left unmerged in v6.0.0. For example, metadata.json does not add support for GNOME 40. There maybe more missing in that release when compared to this PR. So, in this respect, it seems that we should test branch gnome-40.

Werkov commented 3 years ago

I wanted to check what the differences are but I think the tag is stale?

git show v6.0.0-alpha # 1f3295856be82352d7878087ebf16f1bf91ef1a6
...
Date:   Tue Jun 29 14:20:22 2021 +0200

And I also don't see the changes from this PR in the released archive. Or was the v6.0.0-alpha not meant to include this PR?

mzur commented 3 years ago

@rinigus @Werkov Sorry, my fault, I tagged master instead of this branch (fixed now). The released archive should be correct, though.