|
| 1 | +import Clutter from '@gi-types/clutter'; |
1 | 2 | import GLib from '@gi-types/glib2'; |
2 | 3 | import { imports } from 'gnome-shell'; |
3 | | -import { AllSettingsKeys, GioSettings, PinchGestureType } from './common/settings'; |
| 4 | +import { AllSettingsKeys, GioSettings, PinchGestureType, SwipeHorizontalGestureType, SwipeVerticalGestureType } from './common/settings'; |
4 | 5 | import * as Constants from './constants'; |
| 6 | +import { SwipeGestureInfo, SwipeGestureToExtensionMapper } from './src/gestures'; |
5 | 7 | import { AltTabConstants, ExtSettings, TouchpadConstants } from './constants'; |
6 | | -import { AltTabGestureExtension } from './src/altTab'; |
7 | | -import { ForwardBackGestureExtension } from './src/forwardBack'; |
8 | | -import { GestureExtension } from './src/gestures'; |
9 | | -import { OverviewRoundTripGestureExtension } from './src/overviewRoundTrip'; |
10 | 8 | import { CloseWindowExtension } from './src/pinchGestures/closeWindow'; |
11 | 9 | import { ShowDesktopExtension } from './src/pinchGestures/showDesktop'; |
12 | | -import { SnapWindowExtension } from './src/snapWindow'; |
13 | 10 | import * as DBusUtils from './src/utils/dbus'; |
14 | 11 | import * as VKeyboard from './src/utils/keyboard'; |
15 | 12 |
|
@@ -73,23 +70,12 @@ class Extension { |
73 | 70 | this._initializeSettings(); |
74 | 71 | this._extensions = []; |
75 | 72 | if (this.settings === undefined) |
76 | | - return; |
77 | | - |
| 73 | + return; |
| 74 | + |
78 | 75 | if (this.settings.get_boolean('enable-alttab-gesture')) |
79 | | - this._extensions.push(new AltTabGestureExtension()); |
| 76 | + // this._extensions.push(new AltTabGestureExtension()); |
80 | 77 |
|
81 | | - if (this.settings.get_boolean('enable-forward-back-gesture')) { |
82 | | - const appForwardBackKeyBinds = this.settings.get_value('forward-back-application-keyboard-shortcuts').deepUnpack(); |
83 | | - this._extensions.push(new ForwardBackGestureExtension(appForwardBackKeyBinds)); |
84 | | - } |
85 | | - |
86 | | - this._extensions.push( |
87 | | - new OverviewRoundTripGestureExtension(this.settings.get_enum('overview-navifation-states')), |
88 | | - new GestureExtension(), |
89 | | - ); |
90 | | - |
91 | | - if (this.settings.get_boolean('enable-window-manipulation-gesture')) |
92 | | - this._extensions.push(new SnapWindowExtension()); |
| 78 | + this._setSwipeGestures() |
93 | 79 |
|
94 | 80 | // pinch to show desktop |
95 | 81 | const pinchToFingersMap = this._getPinchGestureTypeAndFingers(); |
@@ -119,20 +105,60 @@ class Extension { |
119 | 105 |
|
120 | 106 | _initializeSettings() { |
121 | 107 | if (this.settings) { |
122 | | - ExtSettings.DEFAULT_SESSION_WORKSPACE_GESTURE = this.settings.get_boolean('default-session-workspace'); |
123 | | - ExtSettings.DEFAULT_OVERVIEW_GESTURE = this.settings.get_boolean('default-overview'); |
124 | | - ExtSettings.ALLOW_MINIMIZE_WINDOW = this.settings.get_boolean('allow-minimize-window'); |
| 108 | + // TODO: fix this somewhere, somehow |
| 109 | + // ExtSettings.ALLOW_MINIMIZE_WINDOW = this.settings.get_boolean('allow-minimize-window'); |
| 110 | + |
125 | 111 | ExtSettings.FOLLOW_NATURAL_SCROLL = this.settings.get_boolean('follow-natural-scroll'); |
126 | 112 | ExtSettings.DEFAULT_OVERVIEW_GESTURE_DIRECTION = this.settings.get_boolean('default-overview-gesture-direction'); |
127 | 113 | ExtSettings.APP_GESTURES = this.settings.get_boolean('enable-forward-back-gesture'); |
128 | 114 |
|
| 115 | + |
129 | 116 | TouchpadConstants.SWIPE_MULTIPLIER = Constants.TouchpadConstants.DEFAULT_SWIPE_MULTIPLIER * this.settings.get_double('touchpad-speed-scale'); |
130 | 117 | TouchpadConstants.PINCH_MULTIPLIER = Constants.TouchpadConstants.DEFAULT_PINCH_MULTIPLIER * this.settings.get_double('touchpad-pinch-speed'); |
131 | 118 | AltTabConstants.DELAY_DURATION = this.settings.get_int('alttab-delay'); |
132 | 119 | TouchpadConstants.HOLD_SWIPE_DELAY_DURATION = this.settings.get_int('hold-swipe-delay-duration'); |
133 | 120 | } |
134 | 121 | } |
135 | 122 |
|
| 123 | + private _setSwipeGestures() { |
| 124 | + if (this.settings) { |
| 125 | + const swipeHorizontal3FingerGesture = this.settings.get_enum('swipe-horizontal-3-finger-gesture'); |
| 126 | + const swipeVertical3FingerGesture = this.settings.get_enum('swipe-vertical-3-finger-gesture'); |
| 127 | + const swipeHorizontal4FingerGesture = this.settings.get_enum('swipe-horizontal-4-finger-gesture'); |
| 128 | + const swipeVertical4FingerGesture = this.settings.get_enum('swipe-vertical-4-finger-gesture'); |
| 129 | + |
| 130 | + const swipeGestureToExtension = new SwipeGestureToExtensionMapper(this.settings) |
| 131 | + |
| 132 | + const swipeHorizontal3FingerGestureInfo = new SwipeGestureInfo( |
| 133 | + Clutter.Orientation.HORIZONTAL, |
| 134 | + [3], swipeHorizontal3FingerGesture |
| 135 | + ) |
| 136 | + const extension_1 = swipeGestureToExtension.get_extension(swipeHorizontal3FingerGestureInfo) |
| 137 | + |
| 138 | + const swipeVertical3FingerGestureInfo = new SwipeGestureInfo( |
| 139 | + Clutter.Orientation.VERTICAL, |
| 140 | + [3], swipeVertical3FingerGesture |
| 141 | + ) |
| 142 | + const extension_2 = swipeGestureToExtension.get_extension(swipeVertical3FingerGestureInfo) |
| 143 | + |
| 144 | + const swipeHorizontal4FingerGestureInfo = new SwipeGestureInfo( |
| 145 | + Clutter.Orientation.HORIZONTAL, |
| 146 | + [4], swipeHorizontal4FingerGesture |
| 147 | + ) |
| 148 | + const extension_3 = swipeGestureToExtension.get_extension(swipeHorizontal4FingerGestureInfo) |
| 149 | + |
| 150 | + const swipeVertical4FingerGestureInfo = new SwipeGestureInfo( |
| 151 | + Clutter.Orientation.VERTICAL, |
| 152 | + [4], swipeVertical4FingerGesture |
| 153 | + ) |
| 154 | + const extension_4 = swipeGestureToExtension.get_extension(swipeVertical4FingerGestureInfo) |
| 155 | + |
| 156 | + this._extensions.push( |
| 157 | + extension_1, extension_2, extension_3, extension_4 |
| 158 | + ); |
| 159 | + } |
| 160 | + } |
| 161 | + |
136 | 162 | private _getPinchGestureTypeAndFingers(): Map<PinchGestureType, number[]> { |
137 | 163 | if (!this.settings) return new Map(); |
138 | 164 |
|
|
0 commit comments