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

Merge remote-tracking branch 'upstream/master'

This commit is contained in:
ad 2018-04-29 22:51:34 +03:00
commit 9013779f71
5 changed files with 15 additions and 4 deletions

View File

@ -35,7 +35,7 @@ class AppleScriptTouchBarItem: CustomButtonTouchBarItem {
func refreshAndSchedule() { func refreshAndSchedule() {
#if DEBUG #if DEBUG
print("refresh happened") print("refresh happened (interval \(self.interval)), self \(self.identifier.rawValue))")
#endif #endif
let scriptResult = self.execute() let scriptResult = self.execute()
DispatchQueue.main.async { DispatchQueue.main.async {

View File

@ -50,7 +50,7 @@ class TouchBarController: NSObject, NSTouchBarDelegate {
static let shared = TouchBarController() static let shared = TouchBarController()
let touchBar = NSTouchBar() var touchBar: NSTouchBar!
var itemDefinitions: [NSTouchBarItem.Identifier: BarItemDefinition] = [:] var itemDefinitions: [NSTouchBarItem.Identifier: BarItemDefinition] = [:]
var items: [NSTouchBarItem.Identifier: NSTouchBarItem] = [:] var items: [NSTouchBarItem.Identifier: NSTouchBarItem] = [:]
@ -69,6 +69,10 @@ class TouchBarController: NSObject, NSTouchBarDelegate {
} }
func createAndUpdatePreset(jsonItems: [BarItemDefinition]? = nil) { func createAndUpdatePreset(jsonItems: [BarItemDefinition]? = nil) {
if let oldBar = self.touchBar {
NSTouchBar.minimizeSystemModalFunctionBar(oldBar)
}
self.touchBar = NSTouchBar()
var jsonItems = jsonItems var jsonItems = jsonItems
self.itemDefinitions = [:] self.itemDefinitions = [:]
self.items = [:] self.items = [:]
@ -110,8 +114,11 @@ class TouchBarController: NSObject, NSTouchBarDelegate {
} }
func loadItemDefinitions(jsonItems: [BarItemDefinition]) { func loadItemDefinitions(jsonItems: [BarItemDefinition]) {
let dateFormatter = DateFormatter()
dateFormatter.dateFormat = "HH-mm-ss"
let time = dateFormatter.string(from: Date())
for item in jsonItems { for item in jsonItems {
let identifierString = item.type.identifierBase.appending(UUID().uuidString) let identifierString = item.type.identifierBase.appending(time + "--" + UUID().uuidString)
let identifier = NSTouchBarItem.Identifier(identifierString) let identifier = NSTouchBarItem.Identifier(identifierString)
itemDefinitions[identifier] = item itemDefinitions[identifier] = item
if item.align == .left { if item.align == .left {

View File

@ -73,6 +73,7 @@
{ "type": "volumeDown", "width": 34, "align": "right" }, { "type": "volumeDown", "width": 34, "align": "right" },
{ "type": "volume", "width": 60, "align": "right" }, { "type": "volume", "width": 60, "align": "right" },
{ "type": "volumeUp", "width": 34, "align": "right" }, { "type": "volumeUp", "width": 34, "align": "right" },
{ "type": "inputsource", "align": "right" },
{ "type": "battery", "align": "right" }, { "type": "battery", "align": "right" },
{ "type": "timeButton", "align": "right" } { "type": "timeButton", "align": "right" }
] ]

View File

@ -5,6 +5,7 @@
# My TouchBar. My rules # My TouchBar. My rules
[![GitHub release](https://img.shields.io/github/release/toxblh/MTMR.svg)](https://github.com/Toxblh/MTMR/releases) [![GitHub release](https://img.shields.io/github/release/toxblh/MTMR.svg)](https://github.com/Toxblh/MTMR/releases)
[![license](https://img.shields.io/github/license/Toxblh/MTMR.svg)](https://github.com/Toxblh/MTMR/blob/master/LICENSE) [![Total downloads](https://img.shields.io/github/downloads/Toxblh/MTMR/total.svg)](https://github.com/Toxblh/MTMR/releases/latest) ![minimal system requirements](https://img.shields.io/badge/required-macOS%2010.12.2-blue.svg)
<p align="center"> <p align="center">
<img src="Resources/TouchBar-v0.8.1.png"> <img src="Resources/TouchBar-v0.8.1.png">
@ -67,6 +68,7 @@ File for customize your preset for MTMR: `open ~/Library/Application\ Support/MT
- battery - battery
- currency - currency
- weather - weather
- inputsource
> Media Keys > Media Keys
- previous - previous

View File

@ -18,6 +18,7 @@ rm -r App.xcarchive
# Prerequisite: npm i -g create-dmg # Prerequisite: npm i -g create-dmg
create-dmg "${NAME}.app" create-dmg "${NAME}.app"
VERSION=`mdls -raw -name kMDItemVersion MTMR.app` VERSION=`mdls -raw -name kMDItemVersion ${NAME}.app`
echo $VERSION echo $VERSION
zip -r "${NAME}v${VERSION}.zip" "${NAME}.app" zip -r "${NAME}v${VERSION}.zip" "${NAME}.app"