mirror of
https://github.com/Toxblh/MTMR.git
synced 2026-01-11 17:38:38 +00:00
Compare commits
No commits in common. "3e82676008925314beb87d9aac69cd61547ce5c5" and "7a1800252cbfe9b9385fd2bcf2eb320a31058a7e" have entirely different histories.
3e82676008
...
7a1800252c
2
.github/FUNDING.yml
vendored
2
.github/FUNDING.yml
vendored
@ -3,4 +3,4 @@
|
|||||||
issuehunt: Toxblh
|
issuehunt: Toxblh
|
||||||
patreon: toxblh
|
patreon: toxblh
|
||||||
ko_fi: toxblh
|
ko_fi: toxblh
|
||||||
custom: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=WUAAG2HH58WE4
|
custom: https://www.paypal.me/toxblh
|
||||||
|
|||||||
@ -15,12 +15,12 @@ class BasicView: NSCustomTouchBarItem, NSGestureRecognizerDelegate {
|
|||||||
var fourfingers: NSPanGestureRecognizer!
|
var fourfingers: NSPanGestureRecognizer!
|
||||||
var swipeItems: [SwipeItem] = []
|
var swipeItems: [SwipeItem] = []
|
||||||
var prevPositions: [Int: CGFloat] = [2:0, 3:0, 4:0]
|
var prevPositions: [Int: CGFloat] = [2:0, 3:0, 4:0]
|
||||||
|
|
||||||
// legacy gesture positions
|
// legacy gesture positions
|
||||||
// by legacy I mean gestures to increse/decrease volume/brigtness which can be checked from app menu
|
// by legacy I mean gestures to increse/decrease volume/brigtness which can be checked from app menu
|
||||||
var legacyPrevPositions: [Int: CGFloat] = [2:0, 3:0, 4:0]
|
var legacyPrevPositions: [Int: CGFloat] = [2:0, 3:0, 4:0]
|
||||||
var legacyGesturesEnabled = false
|
var legacyGesturesEnabled = false
|
||||||
|
|
||||||
init(identifier: NSTouchBarItem.Identifier, items: [NSTouchBarItem], swipeItems: [SwipeItem]) {
|
init(identifier: NSTouchBarItem.Identifier, items: [NSTouchBarItem], swipeItems: [SwipeItem]) {
|
||||||
super.init(identifier: identifier)
|
super.init(identifier: identifier)
|
||||||
self.swipeItems = swipeItems
|
self.swipeItems = swipeItems
|
||||||
@ -29,27 +29,27 @@ class BasicView: NSCustomTouchBarItem, NSGestureRecognizerDelegate {
|
|||||||
stackView.spacing = 8
|
stackView.spacing = 8
|
||||||
stackView.orientation = .horizontal
|
stackView.orientation = .horizontal
|
||||||
view = stackView
|
view = stackView
|
||||||
|
|
||||||
twofingers = NSPanGestureRecognizer(target: self, action: #selector(twofingersHandler(_:)))
|
twofingers = NSPanGestureRecognizer(target: self, action: #selector(twofingersHandler(_:)))
|
||||||
twofingers.numberOfTouchesRequired = 2
|
twofingers.numberOfTouchesRequired = 2
|
||||||
twofingers.allowedTouchTypes = .direct
|
twofingers.allowedTouchTypes = .direct
|
||||||
view.addGestureRecognizer(twofingers)
|
view.addGestureRecognizer(twofingers)
|
||||||
|
|
||||||
threefingers = NSPanGestureRecognizer(target: self, action: #selector(threefingersHandler(_:)))
|
threefingers = NSPanGestureRecognizer(target: self, action: #selector(threefingersHandler(_:)))
|
||||||
threefingers.numberOfTouchesRequired = 3
|
threefingers.numberOfTouchesRequired = 3
|
||||||
threefingers.allowedTouchTypes = .direct
|
threefingers.allowedTouchTypes = .direct
|
||||||
view.addGestureRecognizer(threefingers)
|
view.addGestureRecognizer(threefingers)
|
||||||
|
|
||||||
fourfingers = NSPanGestureRecognizer(target: self, action: #selector(fourfingersHandler(_:)))
|
fourfingers = NSPanGestureRecognizer(target: self, action: #selector(fourfingersHandler(_:)))
|
||||||
fourfingers.numberOfTouchesRequired = 4
|
fourfingers.numberOfTouchesRequired = 4
|
||||||
fourfingers.allowedTouchTypes = .direct
|
fourfingers.allowedTouchTypes = .direct
|
||||||
view.addGestureRecognizer(fourfingers)
|
view.addGestureRecognizer(fourfingers)
|
||||||
}
|
}
|
||||||
|
|
||||||
required init?(coder _: NSCoder) {
|
required init?(coder _: NSCoder) {
|
||||||
fatalError("init(coder:) has not been implemented")
|
fatalError("init(coder:) has not been implemented")
|
||||||
}
|
}
|
||||||
|
|
||||||
func gestureHandler(position: CGFloat, fingers: Int, state: NSGestureRecognizer.State) {
|
func gestureHandler(position: CGFloat, fingers: Int, state: NSGestureRecognizer.State) {
|
||||||
switch state {
|
switch state {
|
||||||
case .began:
|
case .began:
|
||||||
@ -72,9 +72,9 @@ class BasicView: NSCustomTouchBarItem, NSGestureRecognizerDelegate {
|
|||||||
let prevPos = legacyPrevPositions[fingers]!
|
let prevPos = legacyPrevPositions[fingers]!
|
||||||
if ((position - prevPos) > 15) || ((prevPos - position) > 15) {
|
if ((position - prevPos) > 15) || ((prevPos - position) > 15) {
|
||||||
if position > prevPos {
|
if position > prevPos {
|
||||||
HIDPostAuxKey(NX_KEYTYPE_BRIGHTNESS_UP)
|
GenericKeyPress(keyCode: CGKeyCode(144)).send()
|
||||||
} else if position < prevPos {
|
} else if position < prevPos {
|
||||||
HIDPostAuxKey(NX_KEYTYPE_BRIGHTNESS_DOWN)
|
GenericKeyPress(keyCode: CGKeyCode(145)).send()
|
||||||
}
|
}
|
||||||
legacyPrevPositions[fingers] = position
|
legacyPrevPositions[fingers] = position
|
||||||
}
|
}
|
||||||
@ -89,7 +89,7 @@ class BasicView: NSCustomTouchBarItem, NSGestureRecognizerDelegate {
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@objc func twofingersHandler(_ sender: NSGestureRecognizer?) {
|
@objc func twofingersHandler(_ sender: NSGestureRecognizer?) {
|
||||||
let position = (sender?.location(in: sender?.view).x)!
|
let position = (sender?.location(in: sender?.view).x)!
|
||||||
self.gestureHandler(position: position, fingers: 2, state: sender!.state)
|
self.gestureHandler(position: position, fingers: 2, state: sender!.state)
|
||||||
|
|||||||
@ -17,9 +17,9 @@
|
|||||||
<key>CFBundlePackageType</key>
|
<key>CFBundlePackageType</key>
|
||||||
<string>APPL</string>
|
<string>APPL</string>
|
||||||
<key>CFBundleShortVersionString</key>
|
<key>CFBundleShortVersionString</key>
|
||||||
<string>0.27</string>
|
<string>0.26.1</string>
|
||||||
<key>CFBundleVersion</key>
|
<key>CFBundleVersion</key>
|
||||||
<string>434</string>
|
<string>425</string>
|
||||||
<key>LSApplicationCategoryType</key>
|
<key>LSApplicationCategoryType</key>
|
||||||
<string>public.app-category.utilities</string>
|
<string>public.app-category.utilities</string>
|
||||||
<key>LSMinimumSystemVersion</key>
|
<key>LSMinimumSystemVersion</key>
|
||||||
|
|||||||
@ -79,7 +79,7 @@ class SupportedTypesHolder {
|
|||||||
return (
|
return (
|
||||||
item: .staticButton(title: ""),
|
item: .staticButton(title: ""),
|
||||||
actions: [
|
actions: [
|
||||||
Action(trigger: .singleTap, value: .hidKey(keycode: NX_KEYTYPE_BRIGHTNESS_UP))
|
Action(trigger: .singleTap, value: .keyPress(keycode: 144))
|
||||||
],
|
],
|
||||||
legacyAction: .none,
|
legacyAction: .none,
|
||||||
legacyLongAction: .none,
|
legacyLongAction: .none,
|
||||||
@ -92,7 +92,7 @@ class SupportedTypesHolder {
|
|||||||
return (
|
return (
|
||||||
item: .staticButton(title: ""),
|
item: .staticButton(title: ""),
|
||||||
actions: [
|
actions: [
|
||||||
Action(trigger: .singleTap, value: .hidKey(keycode: NX_KEYTYPE_BRIGHTNESS_DOWN))
|
Action(trigger: .singleTap, value: .keyPress(keycode: 145))
|
||||||
],
|
],
|
||||||
legacyAction: .none,
|
legacyAction: .none,
|
||||||
legacyLongAction: .none,
|
legacyLongAction: .none,
|
||||||
|
|||||||
@ -18,7 +18,7 @@ My idea is to create a platform for creating plugins to customize the TouchBar.
|
|||||||
<a href="https://t.me/joinchat/AmVYGg8vW38c13_3MxdE_g"><img height="20px" src="https://telegram.org/img/t_logo.png" /> Telegram</a>
|
<a href="https://t.me/joinchat/AmVYGg8vW38c13_3MxdE_g"><img height="20px" src="https://telegram.org/img/t_logo.png" /> Telegram</a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p align="center"><a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=WUAAG2HH58WE4" title="Donate via Paypal"><img height="36px" src="Resources/support_paypal.svg" alt="PayPal donate button" /></a>
|
<p align="center"><a href="https://www.paypal.me/toxblh/10" title="Donate via Paypal"><img height="36px" src="Resources/support_paypal.svg" alt="PayPal donate button" /></a>
|
||||||
<a href="https://www.buymeacoffee.com/toxblh" target="_blank"><img src="https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png" alt="Buy Me A Coffee" height="36px" ></a>
|
<a href="https://www.buymeacoffee.com/toxblh" target="_blank"><img src="https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png" alt="Buy Me A Coffee" height="36px" ></a>
|
||||||
<a href="https://www.patreon.com/bePatron?u=9900748"><img height="36px" src="https://c5.patreon.com/external/logo/become_a_patron_button.png" srcset="https://c5.patreon.com/external/logo/become_a_patron_button@2x.png 2x"></a>
|
<a href="https://www.patreon.com/bePatron?u=9900748"><img height="36px" src="https://c5.patreon.com/external/logo/become_a_patron_button.png" srcset="https://c5.patreon.com/external/logo/become_a_patron_button@2x.png 2x"></a>
|
||||||
<a href="https://www.producthunt.com/posts/my-touchbar-my-rules-mtmr">
|
<a href="https://www.producthunt.com/posts/my-touchbar-my-rules-mtmr">
|
||||||
@ -480,8 +480,8 @@ by using background with color "#000000" and bordered == false you can create bu
|
|||||||
- Opening another program which can't edit text
|
- Opening another program which can't edit text
|
||||||
1. Open Terminal.app
|
1. Open Terminal.app
|
||||||
2. Put `open -a TextEdit ~/Library/Application\ Support/MTMR/items.json` command and press <kbd>Enter</kbd>
|
2. Put `open -a TextEdit ~/Library/Application\ Support/MTMR/items.json` command and press <kbd>Enter</kbd>
|
||||||
|
|
||||||
|
|
||||||
#### Buttons or gestures doesn't work:
|
#### Buttons or gestures doesn't work:
|
||||||
- "After the last update my mtmr is not working anymore!"
|
- "After the last update my mtmr is not working anymore!"
|
||||||
- "Buttons sometimes do not trigger action"
|
- "Buttons sometimes do not trigger action"
|
||||||
|
|||||||
4
build.sh
4
build.sh
@ -63,8 +63,8 @@ echo "<?xml version=\"1.0\" standalone=\"yes\"?>
|
|||||||
echo ""
|
echo ""
|
||||||
echo "Homebrew https://github.com/Homebrew/homebrew-cask/edit/master/Casks/mtmr.rb"
|
echo "Homebrew https://github.com/Homebrew/homebrew-cask/edit/master/Casks/mtmr.rb"
|
||||||
echo ""
|
echo ""
|
||||||
echo " version \"${VERSION}\""
|
echo " version '${VERSION}'"
|
||||||
echo " sha256 \"${SHA256}\""
|
echo " sha256 '${SHA256}'"
|
||||||
echo ""
|
echo ""
|
||||||
echo "Update MTMR v${VERSION}"
|
echo "Update MTMR v${VERSION}"
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user