mirror of
https://github.com/Toxblh/MTMR.git
synced 2026-01-12 09:58:38 +00:00
* add shadow to app scrubber
This commit is contained in:
parent
20699e9de7
commit
7774b1fa5e
@ -35,8 +35,10 @@ class AppScrubberTouchBarItem: NSCustomTouchBarItem, NSScrubberDelegate, NSScrub
|
|||||||
scrubber.mode = .free // .fixed
|
scrubber.mode = .free // .fixed
|
||||||
let layout = NSScrubberFlowLayout();
|
let layout = NSScrubberFlowLayout();
|
||||||
layout.itemSize = NSSize(width: 44, height: 30)
|
layout.itemSize = NSSize(width: 44, height: 30)
|
||||||
|
layout.itemSpacing = 2
|
||||||
scrubber.scrubberLayout = layout
|
scrubber.scrubberLayout = layout
|
||||||
scrubber.selectionBackgroundStyle = .roundedBackground
|
scrubber.selectionBackgroundStyle = .roundedBackground
|
||||||
|
scrubber.showsAdditionalContentIndicators = true
|
||||||
|
|
||||||
view = scrubber
|
view = scrubber
|
||||||
|
|
||||||
|
|||||||
@ -7,7 +7,7 @@ class AppleScriptTouchBarItem: CustomButtonTouchBarItem {
|
|||||||
|
|
||||||
init?(identifier: NSTouchBarItem.Identifier, source: SourceProtocol, interval: TimeInterval, onTap: @escaping ()->()) {
|
init?(identifier: NSTouchBarItem.Identifier, source: SourceProtocol, interval: TimeInterval, onTap: @escaping ()->()) {
|
||||||
self.interval = interval
|
self.interval = interval
|
||||||
super.init(identifier: identifier, title: "compile", onTap: onTap)
|
super.init(identifier: identifier, title: "⏳", onTap: onTap)
|
||||||
self.forceHideConstraint = self.view.widthAnchor.constraint(equalToConstant: 0)
|
self.forceHideConstraint = self.view.widthAnchor.constraint(equalToConstant: 0)
|
||||||
guard let script = source.appleScript else {
|
guard let script = source.appleScript else {
|
||||||
button.title = "no script"
|
button.title = "no script"
|
||||||
@ -18,9 +18,9 @@ class AppleScriptTouchBarItem: CustomButtonTouchBarItem {
|
|||||||
DispatchQueue.main.async {
|
DispatchQueue.main.async {
|
||||||
var error: NSDictionary?
|
var error: NSDictionary?
|
||||||
guard script.compileAndReturnError(&error) else {
|
guard script.compileAndReturnError(&error) else {
|
||||||
print(error?.description ?? "unknown error")
|
// print(error?.description ?? "unknown error")
|
||||||
DispatchQueue.main.async {
|
DispatchQueue.main.async {
|
||||||
self.button.title = "compile error"
|
self.button.title = "error"
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -33,7 +33,7 @@ class AppleScriptTouchBarItem: CustomButtonTouchBarItem {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func refreshAndSchedule() {
|
func refreshAndSchedule() {
|
||||||
print("refresh happened")
|
// print("refresh happened")
|
||||||
let scriptResult = self.execute()
|
let scriptResult = self.execute()
|
||||||
DispatchQueue.main.async {
|
DispatchQueue.main.async {
|
||||||
self.button.title = scriptResult
|
self.button.title = scriptResult
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user