1
0
mirror of https://github.com/Toxblh/MTMR.git synced 2026-01-11 09:28:38 +00:00

weather – example on bundled scripts

This commit is contained in:
Serg 2018-04-10 19:01:41 +07:00
parent b70c8ca4a3
commit 2bc8912add
3 changed files with 11 additions and 1 deletions

View File

@ -46,6 +46,14 @@ class SupportedTypesHolder {
"previous": { _ in return (item: .staticButton(title: ""), action: .hidKey(keycode: NX_KEYTYPE_PREVIOUS)) }, "previous": { _ in return (item: .staticButton(title: ""), action: .hidKey(keycode: NX_KEYTYPE_PREVIOUS)) },
"play": { _ in return (item: .staticButton(title: ""), action: .hidKey(keycode: NX_KEYTYPE_PLAY)) }, "play": { _ in return (item: .staticButton(title: ""), action: .hidKey(keycode: NX_KEYTYPE_PLAY)) },
"next": { _ in return (item: .staticButton(title: ""), action: .hidKey(keycode: NX_KEYTYPE_NEXT)) }, "next": { _ in return (item: .staticButton(title: ""), action: .hidKey(keycode: NX_KEYTYPE_NEXT)) },
"weather": { decoder in
enum CodingKeys: String, CodingKey { case refreshInterval }
let container = try decoder.container(keyedBy: CodingKeys.self)
let interval = try container.decodeIfPresent(Double.self, forKey: .refreshInterval)
let scriptURL = Bundle.main.url(forResource: "weather", withExtension: "scpt")!
let item = ItemType.appleScriptTitledButton(source: try! String(contentsOf: scriptURL), refreshInterval: interval ?? 1800.0)
return (item: item, action: .none)
},
] ]
static let sharedInstance = SupportedTypesHolder() static let sharedInstance = SupportedTypesHolder()

View File

@ -10,4 +10,5 @@
{ "type": "next" }, { "type": "next" },
{ "type": "volumeUp" }, { "type": "volumeUp" },
{ "type": "volumeUp" }, { "type": "volumeUp" },
{ "type": "weather", "refreshInterval": 1800 },
] ]

View File

@ -20,9 +20,10 @@ My the idea is to create the program like a platform for plugins for customizati
- [x] First the weather plugin - [x] First the weather plugin
- [x] Find how to open full-screen TouchBar without the cross and stripe menu - [x] Find how to open full-screen TouchBar without the cross and stripe menu
- [x] Find how to add haptic feedback - [x] Find how to add haptic feedback
- [ ] JSON or another approch for save preset and plugins maybe in `~/mtmr` - [x] JSON or another approch for save preset, maybe in `~/Library/Application Support/MTMR/`
- [ ] Layout: [always left, NSSliderView for center, always right] - [ ] Layout: [always left, NSSliderView for center, always right]
- [ ] Custom buttons size, actions by click in settings - [ ] Custom buttons size, actions by click in settings
- [ ] Overwrite default values from item types (e.g. title for brightness)
- [ ] Add icon and menu in StatusBar - [ ] Add icon and menu in StatusBar
- [ ] Hide from Dock - [ ] Hide from Dock
- [ ] Status menu: "preferences", "quit" - [ ] Status menu: "preferences", "quit"