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