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

hide button property, cleanup nasty code

This commit is contained in:
Serg 2018-05-12 12:02:45 +07:00
parent f7eb49e5de
commit bbea465500
7 changed files with 6 additions and 17 deletions

View File

@ -14,7 +14,7 @@ class AppleScriptTouchBarItem: CustomButtonTouchBarItem {
return
}
self.script = script
button.bezelColor = .clear
self.isBordered = false
DispatchQueue.main.async {
var error: NSDictionary?
guard script.compileAndReturnError(&error) else {

View File

@ -11,7 +11,7 @@ import Cocoa
class CustomButtonTouchBarItem: NSCustomTouchBarItem, NSGestureRecognizerDelegate {
var tapClosure: (() -> ())?
var longTapClosure: (() -> ())?
private(set) var button: NSButton! //todo hide completely
private var button: NSButton!
private var singleClick: NSClickGestureRecognizer!
private var longClick: NSPressGestureRecognizer!

View File

@ -10,7 +10,6 @@ class ScrollViewItem: NSCustomTouchBarItem {
stackView.orientation = .horizontal
let scrollView = NSScrollView(frame: CGRect(origin: .zero, size: stackView.fittingSize))
scrollView.documentView = stackView
// scrollView.documentView?.bounds.origin = CGPoint(x: 0.0, y: -2.5)
self.view = scrollView
}

View File

@ -50,8 +50,6 @@ class CurrencyBarItem: CustomButtonTouchBarItem {
super.init(identifier: identifier, title: "")
self.view = button
activity.repeats = true
activity.qualityOfService = .utility
activity.schedule { (completion: NSBackgroundActivityScheduler.CompletionHandler) in

View File

@ -19,9 +19,9 @@ class InputSourceBarItem: CustomButtonTouchBarItem {
observeIputSourceChangedNotification();
textInputSourceDidChange()
self.button.cell?.action = #selector(switchInputSource)
self.button.action = #selector(switchInputSource)
self.tapClosure = { [weak self] in
self?.switchInputSource()
}
}
required init?(coder: NSCoder) {
@ -32,11 +32,6 @@ class InputSourceBarItem: CustomButtonTouchBarItem {
CFNotificationCenterRemoveEveryObserver(notificationCenter, UnsafeRawPointer(Unmanaged.passUnretained(self).toOpaque()));
}
@objc override func handleGestureSingle(gr: NSClickGestureRecognizer) {
super.handleGestureSingle(gr: gr)
switchInputSource()
}
@objc public func textInputSourceDidChange() {
let currentSource = TISCopyCurrentKeyboardInputSource().takeUnretainedValue()

View File

@ -8,8 +8,7 @@ class TimeTouchBarItem: CustomButtonTouchBarItem {
dateFormatter.setLocalizedDateFormatFromTemplate(formatTemplate)
super.init(identifier: identifier, title: " ")
timer = Timer.scheduledTimer(timeInterval: 1, target: self, selector: #selector(updateTime), userInfo: nil, repeats: true)
self.view = button
button.bezelColor = .clear
self.isBordered = false
updateTime()
}

View File

@ -43,8 +43,6 @@ class WeatherBarItem: CustomButtonTouchBarItem, CLLocationManagerDelegate {
}
super.init(identifier: identifier, title: "")
self.view = button
let status = CLLocationManager.authorizationStatus()
if status == .restricted || status == .denied {