From 9ef185d214ca8f1edc01f95752ab9f7d333c7757 Mon Sep 17 00:00:00 2001 From: Serg Date: Sat, 14 Apr 2018 02:09:34 +0700 Subject: [PATCH] remove flexSpace --- MTMR/ItemsParsing.swift | 6 ------ MTMR/TouchBarController.swift | 8 +------- MTMR/defaultPreset.json | 1 - README.md | 7 ------- Resources/ReDetection.json | 1 - Resources/toxblh.json | 1 - 6 files changed, 1 insertion(+), 23 deletions(-) diff --git a/MTMR/ItemsParsing.swift b/MTMR/ItemsParsing.swift index 97845ec..c7e1d68 100644 --- a/MTMR/ItemsParsing.swift +++ b/MTMR/ItemsParsing.swift @@ -115,7 +115,6 @@ enum ItemType: Decodable { case staticButton(title: String) case appleScriptTitledButton(source: SourceProtocol, refreshInterval: Double) case timeButton(formatTemplate: String) - case flexSpace() case volume() case brightness() @@ -132,7 +131,6 @@ enum ItemType: Decodable { case staticButton case appleScriptTitledButton case timeButton - case flexSpace case volume case brightness } @@ -151,8 +149,6 @@ enum ItemType: Decodable { case .timeButton: let template = try container.decodeIfPresent(String.self, forKey: .formatTemplate) ?? "HH:mm" self = .timeButton(formatTemplate: template) - case .flexSpace: - self = .flexSpace() case .volume: self = .volume() case .brightness: @@ -212,8 +208,6 @@ func ==(lhs: ItemType, rhs: ItemType) -> Bool { switch (lhs, rhs) { case let (.staticButton(a), .staticButton(b)): return a == b - case let (.flexSpace(a), .flexSpace(b)): - return a == b case let (.appleScriptTitledButton(a, b), .appleScriptTitledButton(c, d)): return a == c && b == d diff --git a/MTMR/TouchBarController.swift b/MTMR/TouchBarController.swift index c2cb914..ec2bba5 100644 --- a/MTMR/TouchBarController.swift +++ b/MTMR/TouchBarController.swift @@ -23,8 +23,6 @@ extension ItemType { return "com.toxblh.mtmr.appleScriptButton." case .timeButton(formatTemplate: _): return "com.toxblh.mtmr.timeButton." - case .flexSpace(): - return "NSTouchBarItem.Identifier.flexibleSpace" case .volume(): return "com.toxblh.mtmr.volume" case .brightness(): @@ -81,9 +79,7 @@ class TouchBarController: NSObject, NSTouchBarDelegate { for item in jsonItems { let identifierString = item.type.identifierBase.appending(UUID().uuidString) - let identifier = item.type == ItemType.flexSpace() - ? NSTouchBarItem.Identifier.flexibleSpace - : NSTouchBarItem.Identifier(identifierString) + let identifier = NSTouchBarItem.Identifier(identifierString) itemDefinitions[identifier] = item if item.align == .left { leftIdentifiers.append(identifier) @@ -144,8 +140,6 @@ class TouchBarController: NSObject, NSTouchBarDelegate { barItem = AppleScriptTouchBarItem(identifier: identifier, source: source, interval: interval, onTap: action) case .timeButton(formatTemplate: let template): barItem = TimeTouchBarItem(identifier: identifier, formatTemplate: template) - case .flexSpace: - barItem = nil case .volume: barItem = VolumeViewController(identifier: identifier) case .brightness: diff --git a/MTMR/defaultPreset.json b/MTMR/defaultPreset.json index 9322ee9..aabb851 100644 --- a/MTMR/defaultPreset.json +++ b/MTMR/defaultPreset.json @@ -11,7 +11,6 @@ "keycode": 113, "width": 36, }, - { "type": "flexSpace" }, { "type": "volumeDown", "width": 44 }, { "type": "volumeUp", "width": 44 }, { "type": "previous" }, diff --git a/README.md b/README.md index 01d38b3..55a5dbf 100644 --- a/README.md +++ b/README.md @@ -101,11 +101,6 @@ File for customize your preset for MTMR: `open ~/Library/Application Support/MTM "formatTemplate": "HH:mm" //optional ``` -- `flexSpace` – to easily split touch bar in two parts: left and right -```json - "type": "flexSpace" -``` - ## Actions: - `hidKey` ```json @@ -183,7 +178,6 @@ File for customize your preset for MTMR: `open ~/Library/Application Support/MTM }, "refreshInterval": 1 }, - { "type": "flexSpace" }, { "type": "previous", "width": 36 }, { "type": "play", "width": 36 }, { "type": "next", "width": 36 }, @@ -214,7 +208,6 @@ File for customize your preset for MTMR: `open ~/Library/Application Support/MTM "action": "appleScript", "actionAppleScript": {"inline": "if application \"Safari\" is running then\r\ttell application \"Safari\"\r\t\trepeat with w in windows\r\t\t\trepeat with t in tabs of w\r\t\t\t\ttell t\r\t\t\t\t\tif URL starts with \"https:\/\/music.yandex.ru\" and name does not end with \"на Яндекс.Музыке\" then --последнее условие проверяет, запущена ли музыка\r\t\t\t\t\t\tactivate\r\t\t\t\t\t\tset index of w to 1\r\t\t\t\t\t\tdelay 0.1\r\t\t\t\t\t\tset current tab of w to t\r\t\t\t\t\tend if\r\t\t\t\tend tell\r\t\t\tend repeat\r\t\tend repeat\r\tend tell\rend if"}, }, { "type": "appleScriptTitledButton", "source": { "inline": "tell application \"Reminders\"\r\tset activeReminders to name of (reminders of list \"Напоминания\" whose completed is false)\r\tif activeReminders is not {} then\r\t\treturn first item of activeReminders\r\telse\r\t\treturn \"\"\r\tend if\rend tell" }, "refreshInterval": 30}, -{ "type": "flexSpace" }, { "type": "appleScriptTitledButton", "source": { "inline": "if application \"iTunes\" is running then\r\ttell application \"iTunes\"\r\t\tif player state is not stopped then return \"\"\r\tend tell\rend if\rif application \"Safari\" is running then\r\ttell application \"Safari\"\r\t\trepeat with t in tabs of windows\r\t\t\ttell t\r\t\t\t\tif URL starts with \"https:\/\/music.yandex.ru\" and name does not end with \"на Яндекс.Музыке\" then\r\t\t\t\t\treturn \"\"\r\t\t\t\tend if\r\t\t\tend tell\r\t\tend repeat\r\tend tell\rend if\rreturn \"▶\"" }, "refreshInterval": 30, "width": 40}, { "type": "volumeDown", "width": 44 }, { "type": "volumeUp", "width": 44 }, diff --git a/Resources/ReDetection.json b/Resources/ReDetection.json index 7efec22..9a12f09 100644 --- a/Resources/ReDetection.json +++ b/Resources/ReDetection.json @@ -24,7 +24,6 @@ }, "refreshInterval": 30 }, - { "type": "flexSpace" }, { "type": "appleScriptTitledButton", "source": { diff --git a/Resources/toxblh.json b/Resources/toxblh.json index 226086d..86199d3 100644 --- a/Resources/toxblh.json +++ b/Resources/toxblh.json @@ -40,7 +40,6 @@ }, "refreshInterval": 1 }, - { "type": "flexSpace" }, { "type": "play", "width": 36 }, { "type": "next", "width": 36 }, { "type": "sleep", "width": 36 },