Commit Graph

28 Commits

Author SHA1 Message Date
Matthew Wraith
10215f57e8
Gestures obey natural-scroll touchpad setting (#373)
Closes #371

Right now when I three-finger scroll in Wayland, moving my hand to the
right makes the windows move to the right as if dragging the proverbial
paper. As in, scrolling moves the content, not the view. In Gnome's
mouse/trackpad settings, this is referred to as "Natural Scrolling". One
can disable "Natural Scrolling" such that two-finger scrolling results
in moving the view, not the content.

This commit makes PaperWM respect the natural-scroll touchpad global
setting. If unnatural scrolling is enabled in Gnome's global settings,
then PaperWM will use unnatural scroll touchpad gestures, and vice versa.

The scroll direction is encoded as either a 1 or -1 and checks the Gnome
settings every Clutter.TouchpadGesturePhase.BEGIN.

There could be an extension added to this to make this setting
toggle-able separately from Gnome's global settings. There could be a
separate setting that overrides the Gnome global setting. There could be
people who prefer unnatural scrolling for their browser and such but
natural scrolling for PaperWM.
2021-03-08 19:21:39 +01:00
Tor Hedin Brønner
e76bfd9069 swipe: also fix 4-finger swipe horizontally 2020-08-15 15:28:25 +02:00
Tor Hedin Brønner
4a58b549e5 swipe: support 4-finger swiping 2020-08-15 15:22:16 +02:00
Tor Hedin Brønner
b35d8c77aa space button-press: Always select glide target
Selecting the window under the pointer doesn't work very well when
gliding.

Simply ignore it for now, letting us always listen on the background in
wayland.
2020-01-22 16:33:42 +01:00
goodwillcoding
77e7ae15a9 rename selectSpace to selectStackSpace
(and switchSpace to selectSequenceSpace)
2019-11-12 14:19:30 +01:00
Tor Hedin Brønner
d9d11fab97 space.workArea(): Wrap workarea logic
I left a few sites which operates in global coordinates, or otherwise actually
want the actual workArea.
2019-10-26 15:34:58 +02:00
Tor Hedin Brønner
2df6953f97 vertical swipe: fix velocity bug
We didn't update the time, so all ticks were compared against the time when we
started swiping.
2019-10-10 11:25:59 +02:00
Tor Hedin Brønner
94ecfc9f10 horizontal swipe: update target window continuously
Run the basic timetravel on each update, highlighting the calculated target.
2019-10-10 11:25:59 +02:00
Tor Hedin Brønner
ef1be46ff7 horizontal swipe: average velocity over the 3 latest ticks 2019-10-10 09:04:40 +02:00
Tor Hedin Brønner
e8a017b517 horizontal swipe: detect partially visible fullscreen windows
space.isPlaceable cares about the metawindow being placeable, while we only care
about it being partially visible.
2019-10-09 03:34:49 +02:00
Tor Hedin Brønner
2de1f82dfb prefs: Hook up sensitivity and friction spinners 2019-10-08 09:08:20 +02:00
Tor Hedin Brønner
5b70afb30d horizontal swipe: Rework target window logic
Not the prettiest code, but it works fairly well.

Selecting the target window works like this (when gliding is finished):
- if the tiling is outside the monitor select the first/last window and snap
- if there's any fully visible windows select the closest one
- if there's no visible window choose the window with highest visible width ratio

This is all calculated the moment we release the swipe, so instead of showing
any potential overshoot we simply adjust the travel so it doesn't overshoot.
2019-10-08 07:08:57 +02:00
Tor Hedin Brønner
f5ac57a752 horizontal swiping: Timetravel and use easing to glide 2019-10-07 10:31:02 +02:00
Tor Hedin Brønner
29cd9695b2 gestures: Fix unwanted snapping at the edges 2019-10-06 08:11:13 +02:00
Tor Hedin Brønner
18fd713900 Use clutter animations
There's a few differences in how onComplete is run:
- We need to run moveDone on every clone transition, as the transitions aren't
done when cloneContainer's transition finishes
- We cannot run layout until startup is done. For some reason onComplete runs
before monitor setup is done properly.

squash! Use clutter animations

- Can't use addTween as a timeout, but transitions are now finished when
onComplete is run, so there's no need for this anymore.
2019-09-28 15:06:57 +02:00
Tor Hedin Brønner
7fb9f4a0c1 Fix full hot code reload
`getCurrentExtension()` does not work with gnome-shell-mode's eval. Use a
somewhat verbose feature detection to work around the changes made in 3.34.
2019-09-03 17:36:37 +02:00
Rasmus Eneman
f949799c37 Fix crash under Gnome 3.34 2019-08-30 08:16:23 +02:00
Tor Hedin Brønner
02131fb22c Add swipe sensitivity preference
Tune using (defaults are [1.0, 2.0]):
dconf write /org/gnome/shell/extensions/paperwm/swipe-sensitivity "[x, y]"
2019-06-17 11:42:31 +02:00
Tor Hedin Brønner
529102add1 Add animation-time setting 2018-12-17 22:21:57 +01:00
Tor Hedin Brønner
e5938191e1 gestures: don't force edge alignment when selected is visible
If the selected window is still visible we don't forc alignment with the monitor
edges, making it possible to eg. center the first/last window with a touchpad.
2018-12-14 10:36:50 +01:00
Tor Hedin Brønner
2d9332b283 Horizontal swipe: never end up in a offscreen window
In the case of overshooting the last/first window we could end up not having a
window under the pointer, resulting in going back to the starting window.

The code indicates that the intention was always to ensure at the end :/
2018-12-10 22:02:29 +01:00
Tor Hedin Brønner
9c645bd6eb gestures: clean up logging 2018-12-09 12:06:32 +01:00
Tor Hedin Brønner
5a4fefe536 gestures: don't use weird average velocity
This didn't seem to do much good.
2018-11-26 17:50:41 +01:00
Tor Hedin Brønner
3d6f2f9426 horizontal swipe: stop animation when starting a new swipe 2018-10-16 11:07:54 +02:00
Tor Hedin Brønner
00837ffbcc horizontal swipe: store state on space
Each space should have its own state, so that several spaces can be scrolled at
the same time.
2018-10-16 11:07:54 +02:00
Tor Hedin Brønner
73ac480f39 Get rid of the ugly spaces._yPositions 2018-09-16 12:54:37 +02:00
Tor Hedin Brønner
c5d80dcdcf horizontal scroll: Use proper coordinates to select a window
This makes selection correct when the space is scaled.
2018-09-14 17:11:01 +02:00
Tor Hedin Brønner
124d752a1e Add 3 finger touchpad navigation on wayland
The code isn't all that pretty, but it's easy to modify and tune to test what
works well.

I've opted to keep the workspace menu's smooth scroll implementation. When
swiping it's necessary to wait for a button press on the desired space since the
pointer can be anywhere. As such making sure that the workspace stack always
ends up in a discrete state isn't that useful, so I opted for more control when
swiping.

We should add some preferences that users can use to tune the speed of swiping.
I assume that this can vary quite a lot between different touchpads.
2018-08-28 01:35:31 +02:00