Compare commits

...
11 Commits
Author SHA1 Message Date
toxblh 40fa61fcb5 Fix #164 2019-05-09 22:14:48 +01:00
toxblh 5a8117ac7f #154 .cghidEventTap -> .cgAnnotatedSessionEventTap 2019-05-07 10:37:29 +01:00
toxblh a606767ddc Revert "migration to swift 5"
This reverts commit 4497c7102c.
2019-04-02 17:10:18 +01:00
toxblh 6badc37dc3 Merge branch 'master' of https://github.com/Toxblh/MTMR 2019-04-02 17:07:27 +01:00
toxblh 4497c7102c migration to swift 5 2019-04-02 17:07:23 +01:00
Anton Palgunov b6c6bb945b Update README.md 2019-03-28 13:30:16 +00:00
Anton Palgunov 3e399d14c2 Update README.md 2019-03-27 10:58:41 +00:00
toxblh 624c8ac6d8 upd readme 2019-03-21 21:52:55 +00:00
toxblh ea68ce33c1 Merge branch 'master' of https://github.com/Toxblh/MTMR 2019-03-21 21:52:01 +00:00
Anton Palgunov e68f930efa Update README.md 2019-03-21 12:26:29 +00:00
Anton Palgunov 647ac0ba20 Update README.md 2019-03-03 14:37:56 +00:00
5 changed files with 34 additions and 13 deletions
+2 -2
View File
@@ -17,9 +17,9 @@
<key>CFBundlePackageType</key> <key>CFBundlePackageType</key>
<string>APPL</string> <string>APPL</string>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>0.20.1</string> <string>0.20.3</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>185</string> <string>197</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>
+3 -2
View File
@@ -51,7 +51,7 @@ class SupportedTypesHolder {
private var supportedTypes: [String: ParametersDecoder] = [ private var supportedTypes: [String: ParametersDecoder] = [
"escape": { _ in ( "escape": { _ in (
item: .staticButton(title: "esc"), item: .staticButton(title: "esc"),
action: .keyPress(keycode: 53), action: .keyPressSession(keycode: 53),
longAction: .none, longAction: .none,
parameters: [.align: .align(.left)] parameters: [.align: .align(.left)]
) }, ) },
@@ -447,7 +447,7 @@ enum ItemType: Decodable {
let workTime = try container.decodeIfPresent(Double.self, forKey: .workTime) ?? 1500.0 let workTime = try container.decodeIfPresent(Double.self, forKey: .workTime) ?? 1500.0
let restTime = try container.decodeIfPresent(Double.self, forKey: .restTime) ?? 600.0 let restTime = try container.decodeIfPresent(Double.self, forKey: .restTime) ?? 600.0
self = .pomodoro(workTime: workTime, restTime: restTime) self = .pomodoro(workTime: workTime, restTime: restTime)
case .network: case .network:
let flip = try container.decodeIfPresent(Bool.self, forKey: .flip) ?? false let flip = try container.decodeIfPresent(Bool.self, forKey: .flip) ?? false
self = .network(flip: flip) self = .network(flip: flip)
@@ -459,6 +459,7 @@ enum ActionType: Decodable {
case none case none
case hidKey(keycode: Int32) case hidKey(keycode: Int32)
case keyPress(keycode: Int) case keyPress(keycode: Int)
case keyPressSession(keycode: Int)
case appleScript(source: SourceProtocol) case appleScript(source: SourceProtocol)
case shellScript(executable: String, parameters: [String]) case shellScript(executable: String, parameters: [String])
case custom(closure: () -> Void) case custom(closure: () -> Void)
+10
View File
@@ -27,6 +27,16 @@ extension KeyPress {
keyDown?.post(tap: loc) keyDown?.post(tap: loc)
keyUp?.post(tap: loc) keyUp?.post(tap: loc)
} }
func sendSession() {
let src = CGEventSource(stateID: .hidSystemState)
let keyDown = CGEvent(keyboardEventSource: src, virtualKey: keyCode, keyDown: true)
let keyUp = CGEvent(keyboardEventSource: src, virtualKey: keyCode, keyDown: false)
let loc: CGEventTapLocation = .cgAnnotatedSessionEventTap
keyDown?.post(tap: loc)
keyUp?.post(tap: loc)
}
} }
func HIDPostAuxKey(_ key: Int32) { func HIDPostAuxKey(_ key: Int32) {
+2
View File
@@ -319,6 +319,8 @@ class TouchBarController: NSObject, NSTouchBarDelegate {
return { HIDPostAuxKey(keycode) } return { HIDPostAuxKey(keycode) }
case let .keyPress(keycode: keycode): case let .keyPress(keycode: keycode):
return { GenericKeyPress(keyCode: CGKeyCode(keycode)).send() } return { GenericKeyPress(keyCode: CGKeyCode(keycode)).send() }
case let .keyPressSession(keycode: keycode):
return { GenericKeyPress(keyCode: CGKeyCode(keycode)).sendSession() }
case let .appleScript(source: source): case let .appleScript(source: source):
guard let appleScript = source.appleScript else { guard let appleScript = source.appleScript else {
print("cannot create apple script for item \(item)") print("cannot create apple script for item \(item)")
+17 -9
View File
@@ -12,15 +12,15 @@
</p> </p>
**MTMR** Community: **MTMR** Community:
[<img height="24px" src="https://github.com/discourse/DiscourseMobile/raw/master/icon.png" /> Discourse](https://forum.mtmr.app)
[<img height="24px" src="https://camo.githubusercontent.com/88f53948f291c54736bf08f5fd7b037a848dfc62/68747470733a2f2f646973636f72646170702e636f6d2f6173736574732f30376463613830613130326434313439653937333664346231363263666636662e69636f"> Discord](https://discord.gg/CmNcDuQ) [<img height="24px" src="https://camo.githubusercontent.com/88f53948f291c54736bf08f5fd7b037a848dfc62/68747470733a2f2f646973636f72646170702e636f6d2f6173736574732f30376463613830613130326434313439653937333664346231363263666636662e69636f"> Discord](https://discord.gg/CmNcDuQ)
[<img height="24px" src="https://telegram.org/img/t_logo.png" /> Telegram](https://t.me/joinchat/AmVYGg8vW38c13_3MxdE_g) [<img height="24px" src="https://telegram.org/img/t_logo.png" /> Telegram](https://t.me/joinchat/AmVYGg8vW38c13_3MxdE_g)
<a href="https://www.paypal.me/toxblh/10" title="Donate via Paypal"><img height="32px" src="Resources/support_paypal.svg" alt="PayPal donate button" /></a> <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="32px" ></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="32px" 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>
[<img src="https://d1qb2nb5cznatu.cloudfront.net/startups/i/854859-e299e139ab7f79855c0bc589f10b0ec6-medium_jpg.jpg?buster=1453074480" height="32px" /> Become a backer](https://opencollective.com/MTMR#backer) <a href="https://www.producthunt.com/posts/my-touchbar-my-rules-mtmr">
[<img src="https://d1qb2nb5cznatu.cloudfront.net/startups/i/854859-e299e139ab7f79855c0bc589f10b0ec6-medium_jpg.jpg?buster=1453074480" height="32px" /> Become a sponsor](https://opencollective.com/MTMR#sponsor) <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>
My idea is to create a platform for creating plugins to customize the TouchBar. I very much like BTT and having a full custom TouchBar (my [BTT preset](https://github.com/Toxblh/btt-touchbar-preset)), and I wanted to create it. It's my first Swift project for MacOS :) My idea is to create a platform for creating plugins to customize the TouchBar. I very much like BTT and having a full custom TouchBar (my [BTT preset](https://github.com/Toxblh/btt-touchbar-preset)), and I wanted to create it. It's my first Swift project for MacOS :)
@@ -31,8 +31,15 @@ My idea is to create a platform for creating plugins to customize the TouchBar.
- Download lastest [release](https://github.com/Toxblh/MTMR/releases) from github - Download lastest [release](https://github.com/Toxblh/MTMR/releases) from github
- Or via Homebrew `brew cask install mtmr` - Or via Homebrew `brew cask install mtmr`
## Troubleshooting > First open: you should allow access for MTMR in Accessibility for correct buttons work like <kbd>Esc</kbd> Volume/Brightness and another system keys
Problems:
## Troubleshooting
If you can't open preferences:
- Opening another program which can't edit text
1. Open Terminal.app
2. Put `open -a TextEdit ~/Library/Application\ Support/MTMR/items.json` command and press <kbd>Enter</kbd>
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"
- "ESC don't work" - "ESC don't work"
@@ -179,7 +186,7 @@ To close a group, use the button:
{ {
"type": "pomodoro", "type": "pomodoro",
"workTime": 1200, // set time work in seconds. Default 1500 (25 min) "workTime": 1200, // set time work in seconds. Default 1500 (25 min)
"restTime": 600, // set time rest in seconds. Default 300 (5 min) "restTime": 600 // set time rest in seconds. Default 300 (5 min)
}, },
``` ```
@@ -188,6 +195,7 @@ To close a group, use the button:
```js ```js
{ {
"type": "network", "type": "network",
"flip": true
}, },
``` ```