mzur / gnome-shell-wsmatrix

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

Fix Wraparound==NONE not working on single-row setups #142

Closed freshgiammi closed 3 years ago

freshgiammi commented 3 years ago

Fixes WRAPAROUND==NONE getting stuck on one-row layouts. This patch has been running flawlessly on my machine for at least a month, and other types of layouts doesn't seem to have any issues with this change.

mzur commented 3 years ago

Can you please explain what you mean exactly with "getting stuck"?

freshgiammi commented 3 years ago

The default gnome shortcuts for changing workspaces just get ignored if Wraparound is set to NONE. Here's a video that showcases that: https://www.youtube.com/watch?v=dIqHu6bHXqc

mzur commented 3 years ago

I could not reproduce this issue in either GNOME 3.36 (Ubuntu) or GNOME 3.38 (Arch). Which GNOME version and which distribution do you use? I'm not familiar with the UI and the Ctrl+Super shortcut so it's probably something else.

freshgiammi commented 3 years ago

That's weird, I'm running Gnome 3.38 on Arch. The shortcut is Super + Page Up/Down (Move to next/previous workspace), just changed to accomodate my habits in gnome settings. This seemed to happen even after a recent clean install without any extra extensions, so I've been ruling those out as a issue source when fixing this. Let me know if I can give you any sorts of logs or anything, since I can trigger this consistently.

mzur commented 3 years ago

Could you please check which direction is given here (should be Meta.MotionDirection.RIGHT or LEFT in your case). This line should return the correct target workspace even for single row setups.

freshgiammi commented 3 years ago

direction returns -2 for moving to the right workspace and -1 for moving to the left one, and i receive the same values even when wraparound is set to Next/Previous. Meta.MotionDirection returns those values as Down and Up accordingly, but they still work if it's set as Next/Previous, so I'm at a loss here. These values are what I get without the PR commit.

mzur commented 3 years ago

Ok, here is what I think is happening: The shortcuts Super+Page Down/Page Up don't switch to the "next" or "previous" workspace, but to the lower or upper workspace. This is equivalent for the stock vertical GNOME workspaces. In your case, however, there is no lower or upper workspace. That's why nothing is happening with None as wraparound mode. The Next/Previous mode, though, seems to do the right thing, as it switches to the next column if the last workspace of the current column is reached and you press the shortcut to switch one workspace down. What you actually need to do is to change your keyboard bindings to switch to the right/left workspace with Page Down/Page Up or use the default shortcuts Crtl+Alt+Arrow left/Arrow right. Is this correct?

freshgiammi commented 3 years ago

What you actually need to do is to change your keyboard bindings to switch to the right/left workspace with Page Down/Page Up

GNOME settings allows only shortcuts for upper/lower workspace, so I'm not quite sure how to achieve that.

or use the default shortcuts Crtl+Alt+Arrow left/Arrow right.

This appears to be working without my patch, but I can't find the shortcut in GNOME settings to change it to Ctrl+Super+Arrow left/Arrow right.

The reason I need this shortcut is because I frequently have to switch between Arch and Windows for work so I find it easier to keep the same shortcut to change workspaces.

EDIT: Upon a second inspection, it looks like GNOME Settings does not show a shortcut to switch to the left/right workspace, but there is actually a setting that can be changed via gsettings or dconf-editor: org.gnome.desktop.wm.keybindings switch-to-workspace-left and org.gnome.desktop.wm.keybindings switch-to-workspace-right

I'm sorry for having opened a PR without knowing these two shortcuts previously. Even if it doesn't look right at a first glance, your reasoning sounds actually correct and this appears to be the expected behaviour,

mzur commented 3 years ago

No need to apologize 😉 So it's working for you then?

Since you went through all the trouble and actually sent a PR for this extension, please consider contributing to the PR for full GNOME 3.38 support (#125). It seems like all previous contributors (including me) don't have spare time for this.

freshgiammi commented 3 years ago

Yeah, changing that shortcut was enough to fix this, so the PR isn't actually needed. The only thing I'd to is probably put some kind of heads up in the readme, since GNOME Settings appears to hide this shortcut and the behaviour can feel wrong if one doesn't know about switch-to-workspace-right/left like me. Thanks for the help!

I am busy between university and work, and I honestly feel like I have close to no experience in GNOME developement and extensions, but I'll do my best to fix any sort of bug I come across, especially with GNOME 40 around the corner. So far, running on 3.38 has had no issues whatsoever for me except for this.