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