mirror of
https://github.com/Toxblh/MTMR.git
synced 2026-01-11 17:38:38 +00:00
commit
6674b5aef7
@ -355,6 +355,7 @@ enum GeneralParameter {
|
|||||||
case align(_: Align)
|
case align(_: Align)
|
||||||
case bordered(_: Bool)
|
case bordered(_: Bool)
|
||||||
case background(_:NSColor)
|
case background(_:NSColor)
|
||||||
|
case title(_:String)
|
||||||
}
|
}
|
||||||
|
|
||||||
struct GeneralParameters: Decodable {
|
struct GeneralParameters: Decodable {
|
||||||
@ -366,6 +367,7 @@ struct GeneralParameters: Decodable {
|
|||||||
case align
|
case align
|
||||||
case bordered
|
case bordered
|
||||||
case background
|
case background
|
||||||
|
case title
|
||||||
}
|
}
|
||||||
init(from decoder: Decoder) throws {
|
init(from decoder: Decoder) throws {
|
||||||
let container = try decoder.container(keyedBy: CodingKeys.self)
|
let container = try decoder.container(keyedBy: CodingKeys.self)
|
||||||
@ -384,6 +386,9 @@ struct GeneralParameters: Decodable {
|
|||||||
if let backgroundColor = try container.decodeIfPresent(String.self, forKey: .background)?.hexColor {
|
if let backgroundColor = try container.decodeIfPresent(String.self, forKey: .background)?.hexColor {
|
||||||
result[.background] = .background(backgroundColor)
|
result[.background] = .background(backgroundColor)
|
||||||
}
|
}
|
||||||
|
if let title = try container.decodeIfPresent(String.self, forKey: .title) {
|
||||||
|
result[.title] = .title(title)
|
||||||
|
}
|
||||||
parameters = result
|
parameters = result
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -275,6 +275,9 @@ class TouchBarController: NSObject, NSTouchBarDelegate {
|
|||||||
if case .image(let source)? = item.additionalParameters[.image], let item = barItem as? CustomButtonTouchBarItem {
|
if case .image(let source)? = item.additionalParameters[.image], let item = barItem as? CustomButtonTouchBarItem {
|
||||||
item.image = source.image
|
item.image = source.image
|
||||||
}
|
}
|
||||||
|
if case .title(let value)? = item.additionalParameters[.title], let item = barItem as? CustomButtonTouchBarItem {
|
||||||
|
item.title = value
|
||||||
|
}
|
||||||
return barItem
|
return barItem
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user