diff --git a/MTMR/Info.plist b/MTMR/Info.plist
index 56bbe82..a3abddc 100644
--- a/MTMR/Info.plist
+++ b/MTMR/Info.plist
@@ -17,9 +17,9 @@
CFBundlePackageType
APPL
CFBundleShortVersionString
- 0.19.1
+ 0.19.2
CFBundleVersion
- 125
+ 129
LSApplicationCategoryType
public.app-category.utilities
LSMinimumSystemVersion
diff --git a/MTMR/ItemsParsing.swift b/MTMR/ItemsParsing.swift
index bb6aff8..ef76412 100644
--- a/MTMR/ItemsParsing.swift
+++ b/MTMR/ItemsParsing.swift
@@ -325,7 +325,7 @@ class SupportedTypesHolder {
enum ItemType: Decodable {
case staticButton(title: String)
case appleScriptTitledButton(source: SourceProtocol, refreshInterval: Double)
- case timeButton(formatTemplate: String)
+ case timeButton(formatTemplate: String, timeZone: String)
case battery()
case dock()
case volume()
@@ -347,6 +347,7 @@ enum ItemType: Decodable {
case from
case to
case full
+ case timeZone
case units
case api_key
case icon_type
@@ -392,7 +393,8 @@ enum ItemType: Decodable {
case .timeButton:
let template = try container.decodeIfPresent(String.self, forKey: .formatTemplate) ?? "HH:mm"
- self = .timeButton(formatTemplate: template)
+ let timeZone = try container.decodeIfPresent(String.self, forKey: .timeZone) ?? nil
+ self = .timeButton(formatTemplate: template, timeZone: timeZone!)
case .battery:
self = .battery()
diff --git a/MTMR/TouchBarController.swift b/MTMR/TouchBarController.swift
index de86288..512d0c0 100644
--- a/MTMR/TouchBarController.swift
+++ b/MTMR/TouchBarController.swift
@@ -24,7 +24,7 @@ extension ItemType {
return "com.toxblh.mtmr.staticButton."
case .appleScriptTitledButton(source: _):
return "com.toxblh.mtmr.appleScriptButton."
- case .timeButton(formatTemplate: _):
+ case .timeButton(formatTemplate: _, timeZone: _):
return "com.toxblh.mtmr.timeButton."
case .battery():
return "com.toxblh.mtmr.battery."
@@ -251,8 +251,8 @@ class TouchBarController: NSObject, NSTouchBarDelegate {
barItem = CustomButtonTouchBarItem(identifier: identifier, title: title)
case .appleScriptTitledButton(source: let source, refreshInterval: let interval):
barItem = AppleScriptTouchBarItem(identifier: identifier, source: source, interval: interval)
- case .timeButton(formatTemplate: let template):
- barItem = TimeTouchBarItem(identifier: identifier, formatTemplate: template)
+ case .timeButton(formatTemplate: let template, timeZone: let timeZone):
+ barItem = TimeTouchBarItem(identifier: identifier, formatTemplate: template, timeZone: timeZone)
case .battery():
barItem = BatteryBarItem(identifier: identifier)
case .dock:
diff --git a/MTMR/Widgets/TimeTouchBarItem.swift b/MTMR/Widgets/TimeTouchBarItem.swift
index 8a2be40..8cca802 100644
--- a/MTMR/Widgets/TimeTouchBarItem.swift
+++ b/MTMR/Widgets/TimeTouchBarItem.swift
@@ -4,8 +4,11 @@ class TimeTouchBarItem: CustomButtonTouchBarItem {
private let dateFormatter = DateFormatter()
private var timer: Timer!
- init(identifier: NSTouchBarItem.Identifier, formatTemplate: String) {
+ init(identifier: NSTouchBarItem.Identifier, formatTemplate: String, timeZone: String? = nil) {
dateFormatter.setLocalizedDateFormatFromTemplate(formatTemplate)
+ if let abbr = timeZone {
+ dateFormatter.timeZone = TimeZone(abbreviation: abbr)
+ }
super.init(identifier: identifier, title: " ")
timer = Timer.scheduledTimer(timeInterval: 1, target: self, selector: #selector(updateTime), userInfo: nil, repeats: true)
isBordered = false