From 83097324707e708e9f23661d75b7beb9364384b5 Mon Sep 17 00:00:00 2001
From: jazzhpatel
Date: Tue, 7 Apr 2020 04:36:11 +0530
Subject: [PATCH 1/2] Scroll Functionality Works
---
MTMR/BasicView.swift | 37 +++++++++++++++++++++++++++++++++++--
MTMR/Info.plist | 2 +-
2 files changed, 36 insertions(+), 3 deletions(-)
diff --git a/MTMR/BasicView.swift b/MTMR/BasicView.swift
index ce30af8..5d388cb 100644
--- a/MTMR/BasicView.swift
+++ b/MTMR/BasicView.swift
@@ -10,6 +10,7 @@ import Foundation
class BasicView: NSCustomTouchBarItem, NSGestureRecognizerDelegate {
+ var onefinger: NSPanGestureRecognizer!
var twofingers: NSPanGestureRecognizer!
var threefingers: NSPanGestureRecognizer!
var fourfingers: NSPanGestureRecognizer!
@@ -30,6 +31,11 @@ class BasicView: NSCustomTouchBarItem, NSGestureRecognizerDelegate {
stackView.orientation = .horizontal
view = stackView
+ onefinger = NSPanGestureRecognizer(target: self, action: #selector(onefingerHandler(_:)))
+ onefinger.numberOfTouchesRequired = 1
+ onefinger.allowedTouchTypes = .direct
+ view.addGestureRecognizer(onefinger)
+
twofingers = NSPanGestureRecognizer(target: self, action: #selector(twofingersHandler(_:)))
twofingers.numberOfTouchesRequired = 2
twofingers.allowedTouchTypes = .direct
@@ -57,9 +63,31 @@ class BasicView: NSCustomTouchBarItem, NSGestureRecognizerDelegate {
legacyPrevPositions[fingers] = position
case .changed:
if self.legacyGesturesEnabled {
+ if fingers == 1 {
+ let prevPos = legacyPrevPositions[fingers]!
+ if ((position - prevPos) > 3) || ((prevPos - position) > 3) {
+ if position > prevPos {
+ GenericKeyPress(keyCode: CGKeyCode(124)).send()
+ } else if position < prevPos {
+ GenericKeyPress(keyCode: CGKeyCode(123)).send()
+ }
+ legacyPrevPositions[fingers] = position
+ }
+ }
if fingers == 2 {
let prevPos = legacyPrevPositions[fingers]!
- if ((position - prevPos) > 10) || ((prevPos - position) > 10) {
+ if ((position - prevPos) > 50) || ((prevPos - position) > 50) {
+ if position > prevPos {
+ GenericKeyPress(keyCode: CGKeyCode(124)).send()
+ } else if position < prevPos {
+ GenericKeyPress(keyCode: CGKeyCode(123)).send()
+ }
+ legacyPrevPositions[fingers] = position
+ }
+ }
+ if fingers == 3 {
+ let prevPos = legacyPrevPositions[fingers]!
+ if ((position - prevPos) > 15) || ((prevPos - position) > 15) {
if position > prevPos {
HIDPostAuxKey(NX_KEYTYPE_SOUND_UP)
} else if position < prevPos {
@@ -68,7 +96,7 @@ class BasicView: NSCustomTouchBarItem, NSGestureRecognizerDelegate {
legacyPrevPositions[fingers] = position
}
}
- if fingers == 3 {
+ if fingers == 4 {
let prevPos = legacyPrevPositions[fingers]!
if ((position - prevPos) > 15) || ((prevPos - position) > 15) {
if position > prevPos {
@@ -90,6 +118,11 @@ class BasicView: NSCustomTouchBarItem, NSGestureRecognizerDelegate {
}
}
+ @objc func onefingerHandler(_ sender: NSGestureRecognizer?) {
+ let position = (sender?.location(in: sender?.view).x)!
+ self.gestureHandler(position: position, fingers: 1, state: sender!.state)
+ }
+
@objc func twofingersHandler(_ sender: NSGestureRecognizer?) {
let position = (sender?.location(in: sender?.view).x)!
self.gestureHandler(position: position, fingers: 2, state: sender!.state)
diff --git a/MTMR/Info.plist b/MTMR/Info.plist
index 8ee6ef2..323fcf8 100644
--- a/MTMR/Info.plist
+++ b/MTMR/Info.plist
@@ -19,7 +19,7 @@
CFBundleShortVersionString
0.25
CFBundleVersion
- 385
+ 399
LSApplicationCategoryType
public.app-category.utilities
LSMinimumSystemVersion
From 5c4fe31c7547082621fdb187aac2cf0e38db7509 Mon Sep 17 00:00:00 2001
From: jazzhpatel
Date: Tue, 7 Apr 2020 05:21:53 +0530
Subject: [PATCH 2/2] updated md
---
MTMR/Info.plist | 2 +-
README.md | 5 +++++
appcast.xml | 20 ++++++++++++++++++++
3 files changed, 26 insertions(+), 1 deletion(-)
create mode 100644 appcast.xml
diff --git a/MTMR/Info.plist b/MTMR/Info.plist
index 323fcf8..b474a95 100644
--- a/MTMR/Info.plist
+++ b/MTMR/Info.plist
@@ -19,7 +19,7 @@
CFBundleShortVersionString
0.25
CFBundleVersion
- 399
+ 401
LSApplicationCategoryType
public.app-category.utilities
LSMinimumSystemVersion
diff --git a/README.md b/README.md
index 1e51a50..8d2430d 100644
--- a/README.md
+++ b/README.md
@@ -25,6 +25,11 @@ My idea is to create a platform for creating plugins to customize the TouchBar.
+##Better Gestures!
+
+the commits to the code to get that make the cursor move by sliding on the touchbar ... you know how you could slide on the space bar on your phone ... it’s the same thing but on the touchbar and if you press ALT, it’ll scroll through words and if you press SHIFT, it’ll select the text, like you could move through tabs, just by holding CMD+SHIFT .... and two fingers makes it go slower for precision control ... its just single finger and double finger gestures sending left and right key presses.
+brooooooooooooooo
+
## Installation
- Download lastest [release](https://github.com/Toxblh/MTMR/releases) (.dmg) from github
diff --git a/appcast.xml b/appcast.xml
new file mode 100644
index 0000000..49c0a19
--- /dev/null
+++ b/appcast.xml
@@ -0,0 +1,20 @@
+
+
+
+ -
+ File Doesn't Exist, Will Create: MTMR.app/Contents/Info.plist
+ Tue, 07 Apr 2020 05:14:23 +0530
+
+
+
+ File Doesn't Exist, Will Create: MTMR.app/Contents/Info.plist
+
+
+
+