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

Changed touchbarcontroller to load image in group item

This commit is contained in:
MaandagDev 2020-01-24 01:17:18 +01:00
parent 5f876acc72
commit 13cfab2e82

View File

@ -230,7 +230,7 @@ class TouchBarController: NSObject, NSTouchBarDelegate {
guard let item = self.items[identifier], guard let item = self.items[identifier],
let definition = self.itemDefinitions[identifier], let definition = self.itemDefinitions[identifier],
definition.align != .center else { definition.align != .center else {
return nil return nil
} }
return item return item
} }
@ -309,8 +309,12 @@ class TouchBarController: NSObject, NSTouchBarDelegate {
if case let .width(value)? = item.additionalParameters[.width], let widthBarItem = barItem as? CanSetWidth { if case let .width(value)? = item.additionalParameters[.width], let widthBarItem = barItem as? CanSetWidth {
widthBarItem.setWidth(value: value) widthBarItem.setWidth(value: value)
} }
if case let .image(source)? = item.additionalParameters[.image], let item = barItem as? CustomButtonTouchBarItem { if case let .image(source)? = item.additionalParameters[.image] {
item.image = source.image if let item = barItem as? GroupBarItem {
item.collapsedRepresentationImage = source.image
} else if let item = barItem as? CustomButtonTouchBarItem {
item.image = source.image
}
} }
if case let .title(value)? = item.additionalParameters[.title] { if case let .title(value)? = item.additionalParameters[.title] {
if let item = barItem as? GroupBarItem { if let item = barItem as? GroupBarItem {
@ -353,7 +357,7 @@ class TouchBarController: NSObject, NSTouchBarDelegate {
return { return {
if let url = URL(string: url), NSWorkspace.shared.open(url) { if let url = URL(string: url), NSWorkspace.shared.open(url) {
#if DEBUG #if DEBUG
print("URL was successfully opened") print("URL was successfully opened")
#endif #endif
} else { } else {
print("error", url) print("error", url)
@ -395,7 +399,7 @@ class TouchBarController: NSObject, NSTouchBarDelegate {
return { return {
if let url = URL(string: url), NSWorkspace.shared.open(url) { if let url = URL(string: url), NSWorkspace.shared.open(url) {
#if DEBUG #if DEBUG
print("URL was successfully opened") print("URL was successfully opened")
#endif #endif
} else { } else {
print("error", url) print("error", url)