mirror of
https://github.com/Toxblh/MTMR.git
synced 2026-01-10 17:08:39 +00:00
commit
843f25508a
@ -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)
|
||||
|
||||
@ -19,7 +19,7 @@
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>0.25</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>385</string>
|
||||
<string>401</string>
|
||||
<key>LSApplicationCategoryType</key>
|
||||
<string>public.app-category.utilities</string>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
|
||||
@ -25,6 +25,11 @@ My idea is to create a platform for creating plugins to customize the TouchBar.
|
||||
<img src="https://api.producthunt.com/widgets/embed-image/v1/featured.svg?post_id=my-touchbar-my-rules-mtmr&theme=light" alt="My TouchBar My Rules (MTMR)" height="36px" style="max-width:100%">
|
||||
</a></p>
|
||||
|
||||
##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
|
||||
|
||||
20
appcast.xml
Normal file
20
appcast.xml
Normal file
@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" standalone="yes"?>
|
||||
<rss xmlns:sparkle="http://www.andymatuschak.org/xml-namespaces/sparkle" version="2.0">
|
||||
<channel>
|
||||
<item>
|
||||
<title>File Doesn't Exist, Will Create: MTMR.app/Contents/Info.plist</title>
|
||||
<pubDate>Tue, 07 Apr 2020 05:14:23 +0530</pubDate>
|
||||
<description>
|
||||
|
||||
</description>
|
||||
<sparkle:minimumSystemVersion>File Doesn't Exist, Will Create: MTMR.app/Contents/Info.plist</sparkle:minimumSystemVersion>
|
||||
<enclosure url="https://mtmr.app/MTMR%20File Doesn't Exist, Will Create: MTMR.app/Contents/Info.plist.dmg"
|
||||
sparkle:version="File Doesn't Exist, Will Create: MTMR.app/Contents/Info.plist"
|
||||
sparkle:shortVersionString="File Doesn't Exist, Will Create: MTMR.app/Contents/Info.plist"
|
||||
length=""
|
||||
type="application/octet-stream"
|
||||
sparkle:dsaSignature=""
|
||||
/>
|
||||
</item>
|
||||
</channel>
|
||||
</rss>
|
||||
Loading…
Reference in New Issue
Block a user