Schneegans / Desktop-Cube

🧊 Indulge in nostalgia with useless 3D effects.
GNU General Public License v3.0
627 stars 21 forks source link

Scroll workspaces without pointer movement on screen #91

Closed AJCxZ0 closed 2 years ago

AJCxZ0 commented 2 years ago

The Motivation

The ability to scroll workspaces, i.e. rotate the cube, is limited by the pointer reaching the edge of the screen. This limits the ability to scroll more than a few workspaces, requiring the user to stop scrolling, reposition the pointer on the screen and restart scrolling in order to scroll more workspaces. This is especially annoying to trackball users who can scroll forever. Note that when dragged from the desktop into the cube, only three workspaces can be rotated even when there are more workspaces and distance for the pointer to travel. This may be an unrelated (and unreported) bug. This is not the case when dragged from the overview into the cube.

The Solution

Do not move the pointer on the screen while scrolling.

The Alternatives

If not moving the pointer on the screen while scrolling is impossible, then a temporary increase in pointer sensitivity may enable more workspaces to be scrolled for a given pointer travel. A more sophisticated version of this would involve adjusting the sensitivity such that scrolling in either direction would reach the last workspace as the pointer reaches the edge of the screen (within reasonable limitations).

Schneegans commented 2 years ago

Hi there! That is indeed an issue. I am not sure whether the not-move-the-pointer-solution is feasible. It would definitely not work on touch screens. I'll play with the sensitivity and see how it feels....

Thank you for the sponsorship! Is it OK for you if I add you to the README?

AJCxZ0 commented 2 years ago

Thank you for looking into this. To give an idea of some numbers when looking at sensitivity, I typically have between 10 and 24 workspaces, with non-defaults

org.gnome.desktop.peripherals.mouse.speed = 0.63235294117647056
org.gnome.desktop.peripherals.mouse.accel-profile = adaptive

Dragging to the cube from the center of the desktop on my UHD (3840×2160) display enables me to scroll one workspace and from the center of the overview enables me to scroll two workspaces. Since I'm contributing nothing to the code and am unfamiliar with how the features are implemented, my ideas for implementation of a sensitivity-based solution are unconstrained. Therefore one approach may be to have horizontal sensitivity vary by tilt; that is when the cube has a shallow tilt, rotation is slow, but as the cube is tilted further, the sensitivity and corresponding rotation speed increases. I think that would be fairly intuitive since in a shallow tilt shows the small details in the exposed windows on the current workspace(s), while a deep tilt shows no small detail, just the workspaces and representations of the windows. The current sensitivity would be a good match for slowest. Fastest should be enough to rotate through all workplaces - possibly in one of, each of, or both directions.

It would be an honour to be included in the README.

Schneegans commented 2 years ago

Actually, that's how it's implemented currently :smile: Yet I think that it could be made a bit more sensitive. At least in the overview, this should work:

You really have to use the entire screen for this to work, maybe I could try to double the rotation speed.

As you noticed, this does not work when rotating outside of the overview. This is a somewhat a limitation of GNOME Shell: If you use gestures on your touchpad or touchscreen (if you have one), you'll notice the same behavior. Outside of the overview, you can only swipe to adjacent workspaces. I'll look through the code of GNOME Shell why that is the case, maybe I can fix it...

Schneegans commented 2 years ago

I found a solution for the swipe-only-one-workspace issue. In addition, I increased the horizontal rotation simply by a factor of two. If you want to, you can try this. You just need to do this:

git clone https://github.com/Schneegans/Desktop-Cube.git
cd Desktop-Cube
git checkout fix/#91
make install

Then restart GNOME Shell with Alt + F2, r + Enter. Or logout / login if you are on Wayland.

What do you think?

AJCxZ0 commented 2 years ago

Testing on a client with multiple screens configured on one side of the primary UHD screen, I have not yet tested how these results may differ from the single screen client.

Actually, that's how it's implemented currently smile Yet I think that it could be made a bit more sensitive. At least in the overview, this should work:

  • Start dragging at the edge of the screen, do not tilt the cube: You can rotate exactly to the adjacent workspace if you move the mouse across the screen.

This works as described.

  • Position the mouse in an upper corner, drag down to achieve maximum title, move the mouse horizontally across the bottom of the screen: You can rotate through all workspaces.

This does not work as described for me. Dragging the corner of a workspace down to maximally tilt the cube, then moving the pointer across the screen I can only rotate one workspace, as the rotation stops even as the pointer continues moving to the edge of the screen. In the other direction in which I have other screens, the pointer moves onto them and the cube continues rotating through workspaces.

I found a solution ... If you want to, you can try this.

Thank you for coming up with something to test so quickly. I want to and will try this, but with Wayland on both clients I will have to try later and report back.

AJCxZ0 commented 2 years ago

Impatiently I installed the extension with the fix and switched the extension off and back on in the Extensions application. In the overview, I dragged the top left of the current workspace all the way down, resulting in a roughly 45° tilt, then dragged it to the right of the screen. This resulted in a rotation of five workspaces, stopping as the pointer reached the right edge of the screen.

I'll test again after restarting the desktop later.

$ sudo apt install libglib2.0-dev-bin
$ git clone https://github.com/Schneegans/Desktop-Cube.git
Cloning into 'Desktop-Cube'...
remote: Enumerating objects: 1516, done.
remote: Counting objects: 100% (419/419), done.
remote: Compressing objects: 100% (199/199), done.
remote: Total 1516 (delta 244), reused 336 (delta 219), pack-reused 1097
Receiving objects: 100% (1516/1516), 14.22 MiB | 32.06 MiB/s, done.
Resolving deltas: 100% (853/853), done.
$ cd Desktop-Cube/
$ git checkout fix/#91
Branch 'fix/#91' set up to track remote branch 'fix/#91' from 'origin'.
Switched to a new branch 'fix/#91'
$ make install
Compiling resources...
Compiling schemas...
Packing zip file...
  adding: extension.js (deflated 76%)
  adding: prefs.js (deflated 68%)
  adding: src/utils.js (deflated 59%)
  adding: src/ImageChooserButton.js (deflated 66%)
  adding: src/Skybox.js (deflated 68%)
  adding: src/DragGesture.js (deflated 69%)
  adding: locale/ar/LC_MESSAGES/desktop-cube.mo (deflated 55%)
  adding: locale/ca/LC_MESSAGES/desktop-cube.mo (deflated 53%)
  adding: locale/de/LC_MESSAGES/desktop-cube.mo (deflated 51%)
  adding: locale/es/LC_MESSAGES/desktop-cube.mo (deflated 53%)
  adding: locale/fr/LC_MESSAGES/desktop-cube.mo (deflated 52%)
  adding: locale/gl/LC_MESSAGES/desktop-cube.mo (deflated 53%)
  adding: locale/it/LC_MESSAGES/desktop-cube.mo (deflated 52%)
  adding: locale/lt/LC_MESSAGES/desktop-cube.mo (deflated 41%)
  adding: locale/nb_NO/LC_MESSAGES/desktop-cube.mo (deflated 49%)
  adding: locale/nl/LC_MESSAGES/desktop-cube.mo (deflated 51%)
  adding: locale/ru/LC_MESSAGES/desktop-cube.mo (deflated 56%)
  adding: locale/sk/LC_MESSAGES/desktop-cube.mo (deflated 49%)
  adding: locale/tr/LC_MESSAGES/desktop-cube.mo (deflated 51%)
  adding: locale/zh_Hans/LC_MESSAGES/desktop-cube.mo (deflated 44%)
  adding: resources/desktop-cube.gresource (deflated 89%)
  adding: schemas/gschemas.compiled (deflated 49%)
  adding: metadata.json (deflated 46%)
  adding: LICENSE (deflated 66%)
  adding: stylesheet.css (deflated 51%)
gnome-extensions install "desktop-cube@schneegans.github.com.zip" --force
Extension installed successfully! Now restart the Shell ('Alt'+'F2', then 'r').

PS. If a fixed sensitivity multiplier ends up as the best solution, then please expose it as a preference with a sensible range of choices.

Schneegans commented 2 years ago

This does not work as described for me. Dragging the corner of a workspace down to maximally tilt the cube, then moving the pointer across the screen I can only rotate one workspace, as the rotation stops even as the pointer continues moving to the edge of the screen. In the other direction in which I have other screens, the pointer moves onto them and the cube continues rotating through workspaces.

Without the fix, this should only work in the overview. With the fix, it should work on the desktop as well.

PS: On Wayland, you need to log out / log in for the extension to be reloaded.

Schneegans commented 2 years ago

The fix/#91 branch now also contains a new setting for configuring this new sensitivity. Feel free to test it!

AJCxZ0 commented 2 years ago

The fix/#91 branch now also contains a new setting for configuring this new sensitivity.

Pulled, installed, restarted and tested with pleasing success. Dragging from either the desktop or overview on the same desktop I was previously using with unchanged preferences results in being able to scroll multiple workspaces with even a shallow tilt. I even noticed that the cube appears to have angular momentum and continues rotating when I release the left mouse button, even after the trackball has stopped, which is cool.

Thank you for exposing the Mouse rotation speed. The 1 - 10 range seems very practical and 2.0 a good default. I may settle on 3.3.

Closing this issue as this fix is more than satisfactory.

$ git pull
remote: Enumerating objects: 15, done.
remote: Counting objects: 100% (15/15), done.
remote: Compressing objects: 100% (5/5), done.
remote: Total 15 (delta 10), reused 15 (delta 10), pack-reused 0
Unpacking objects: 100% (15/15), 1.86 KiB | 105.00 KiB/s, done.
From https://github.com/Schneegans/Desktop-Cube
   f42fa04..965c534  fix/#91    -> origin/fix/#91
Updating f42fa04..965c534
Fast-forward
 docs/changelog.md                                  |  8 ++-
 extension.js                                       |  6 ++-
 prefs.js                                           |  1 +
 resources/ui/settings.ui                           | 62 ++++++++++++++++++++++
 ...gnome.shell.extensions.desktop-cube.gschema.xml |  6 +++
 src/DragGesture.js                                 |  4 +-
 6 files changed, 83 insertions(+), 4 deletions(-)
$ make install
Creating resources xml...
Compiling resources...
Compiling schemas...
Packing zip file...
  adding: extension.js (deflated 76%)
  adding: prefs.js (deflated 68%)
  adding: src/utils.js (deflated 59%)
  adding: src/ImageChooserButton.js (deflated 66%)
  adding: src/Skybox.js (deflated 68%)
  adding: src/DragGesture.js (deflated 69%)
  adding: locale/ar/LC_MESSAGES/desktop-cube.mo (deflated 55%)
  adding: locale/ca/LC_MESSAGES/desktop-cube.mo (deflated 53%)
  adding: locale/de/LC_MESSAGES/desktop-cube.mo (deflated 51%)
  adding: locale/es/LC_MESSAGES/desktop-cube.mo (deflated 53%)
  adding: locale/fr/LC_MESSAGES/desktop-cube.mo (deflated 52%)
  adding: locale/gl/LC_MESSAGES/desktop-cube.mo (deflated 53%)
  adding: locale/it/LC_MESSAGES/desktop-cube.mo (deflated 52%)
  adding: locale/lt/LC_MESSAGES/desktop-cube.mo (deflated 41%)
  adding: locale/nb_NO/LC_MESSAGES/desktop-cube.mo (deflated 49%)
  adding: locale/nl/LC_MESSAGES/desktop-cube.mo (deflated 51%)
  adding: locale/ru/LC_MESSAGES/desktop-cube.mo (deflated 56%)
  adding: locale/sk/LC_MESSAGES/desktop-cube.mo (deflated 49%)
  adding: locale/tr/LC_MESSAGES/desktop-cube.mo (deflated 51%)
  adding: locale/zh_Hans/LC_MESSAGES/desktop-cube.mo (deflated 44%)
  adding: resources/desktop-cube.gresource (deflated 90%)
  adding: schemas/gschemas.compiled (deflated 48%)
  adding: metadata.json (deflated 46%)
  adding: LICENSE (deflated 66%)
  adding: stylesheet.css (deflated 51%)
gnome-extensions install "desktop-cube@schneegans.github.com.zip" --force
Extension installed successfully! Now restart the Shell ('Alt'+'F2', then 'r').
AJCxZ0 commented 2 years ago

Tested on another client with a single display. Working as expected.