Skip to content

Commit d15fa4e

Browse files
committed
Workspace switch: Follow natural scroll
1 parent 0ecd517 commit d15fa4e

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

lib/Gestures/GestureController.vala

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ public class Gala.GestureController : Object {
6060
public double distance { get; construct set; }
6161
public double overshoot_lower_clamp { get; construct set; default = 0d; }
6262
public double overshoot_upper_clamp { get; construct set; default = 1d; }
63+
public bool follow_natural_scroll { get; set; default = false; }
6364

6465
/**
6566
* When disabled gesture progress will stay where the gesture ended and not snap to full integers values.
@@ -166,6 +167,12 @@ public class Gala.GestureController : Object {
166167
direction_multiplier = -1;
167168
}
168169

170+
if (follow_natural_scroll &&
171+
!GestureSettings.is_natural_scroll_enabled (gesture.performed_on_device_type)
172+
) {
173+
direction_multiplier *= -1;
174+
}
175+
169176
if (snap && !Meta.Prefs.get_gnome_animations ()) {
170177
recognizing = false;
171178
prepare ();

lib/Gestures/GestureSettings.vala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ private class Gala.GestureSettings : Object {
2828
touchpad_settings = new GLib.Settings ("org.gnome.desktop.peripherals.touchpad");
2929
}
3030

31-
public bool is_natural_scroll_enabled (Clutter.InputDeviceType device_type) {
31+
public static bool is_natural_scroll_enabled (Clutter.InputDeviceType device_type) {
3232
return (device_type == Clutter.InputDeviceType.TOUCHSCREEN_DEVICE)
3333
? true
3434
: touchpad_settings.get_boolean ("natural-scroll");

src/Widgets/MultitaskingView/MultitaskingView.vala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@ public class Gala.MultitaskingView : ActorTarget, RootTarget, ActivatableCompone
6666
workspaces = new WorkspaceRow (display);
6767

6868
workspaces_gesture_controller = new GestureController (SWITCH_WORKSPACE, wm, MULTITASKING_VIEW) {
69-
overshoot_upper_clamp = 0.1
69+
overshoot_upper_clamp = 0.1,
70+
follow_natural_scroll = true,
7071
};
7172
workspaces_gesture_controller.enable_touchpad (wm.stage);
7273
workspaces_gesture_controller.enable_scroll (this, HORIZONTAL);

0 commit comments

Comments
 (0)