mirror of
https://github.com/Toxblh/MTMR.git
synced 2026-01-11 09:28:38 +00:00
* action for battery plugin
This commit is contained in:
parent
9abb17ee76
commit
d76e16b9e6
@ -9,12 +9,11 @@
|
|||||||
import IOKit.ps
|
import IOKit.ps
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
class BatteryBarItem: NSCustomTouchBarItem {
|
class BatteryBarItem: CustomButtonTouchBarItem {
|
||||||
private var timer: Timer!
|
private var timer: Timer!
|
||||||
private let button = NSButton(title: "", target: nil, action: nil)
|
|
||||||
|
|
||||||
override init(identifier: NSTouchBarItem.Identifier) {
|
init(identifier: NSTouchBarItem.Identifier, onTap: @escaping () -> ()) {
|
||||||
super.init(identifier: identifier)
|
super.init(identifier: identifier, title: " ", onTap: onTap)
|
||||||
self.view = button
|
self.view = button
|
||||||
button.bezelColor = .clear
|
button.bezelColor = .clear
|
||||||
|
|
||||||
|
|||||||
@ -172,7 +172,7 @@ class TouchBarController: NSObject, NSTouchBarDelegate {
|
|||||||
case .timeButton(formatTemplate: let template):
|
case .timeButton(formatTemplate: let template):
|
||||||
barItem = TimeTouchBarItem(identifier: identifier, formatTemplate: template)
|
barItem = TimeTouchBarItem(identifier: identifier, formatTemplate: template)
|
||||||
case .battery():
|
case .battery():
|
||||||
barItem = BatteryBarItem(identifier: identifier)
|
barItem = BatteryBarItem(identifier: identifier, onTap: action)
|
||||||
case .dock:
|
case .dock:
|
||||||
barItem = AppScrubberTouchBarItem(identifier: identifier)
|
barItem = AppScrubberTouchBarItem(identifier: identifier)
|
||||||
case .volume:
|
case .volume:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user