diff --git a/MTMR.xcodeproj/project.pbxproj b/MTMR.xcodeproj/project.pbxproj index e3a5a77..a0dff76 100644 --- a/MTMR.xcodeproj/project.pbxproj +++ b/MTMR.xcodeproj/project.pbxproj @@ -18,6 +18,8 @@ B082B271205C7D8000BC04DC /* MTMRUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = B082B270205C7D8000BC04DC /* MTMRUITests.swift */; }; B0A7E9AA205D6AA400EEF070 /* KeyPress.swift in Sources */ = {isa = PBXBuildFile; fileRef = B0A7E9A9205D6AA400EEF070 /* KeyPress.swift */; }; B0C1CFCA205C97D30021C862 /* WindowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B0C1CFC9205C97D30021C862 /* WindowController.swift */; }; + B0F8771A207AC1EA00D6E430 /* TouchBarSupport.m in Sources */ = {isa = PBXBuildFile; fileRef = B0F87719207AC1EA00D6E430 /* TouchBarSupport.m */; }; + B0F8771D207AD35400D6E430 /* battery.scpt in Resources */ = {isa = PBXBuildFile; fileRef = B0F8771C207AD35400D6E430 /* battery.scpt */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -58,6 +60,9 @@ B082B272205C7D8000BC04DC /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; B0A7E9A9205D6AA400EEF070 /* KeyPress.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KeyPress.swift; sourceTree = ""; }; B0C1CFC9205C97D30021C862 /* WindowController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WindowController.swift; sourceTree = ""; }; + B0F87719207AC1EA00D6E430 /* TouchBarSupport.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = TouchBarSupport.m; sourceTree = ""; }; + B0F8771B207AC92700D6E430 /* TouchBarSupport.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TouchBarSupport.h; sourceTree = ""; }; + B0F8771C207AD35400D6E430 /* battery.scpt */ = {isa = PBXFileReference; lastKnownFileType = text; path = battery.scpt; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -130,6 +135,9 @@ B082B258205C7D8000BC04DC /* Main.storyboard */, B082B25B205C7D8000BC04DC /* Info.plist */, B082B25C205C7D8000BC04DC /* MTMR.entitlements */, + B0F87719207AC1EA00D6E430 /* TouchBarSupport.m */, + B0F8771B207AC92700D6E430 /* TouchBarSupport.h */, + B0F8771C207AD35400D6E430 /* battery.scpt */, ); path = MTMR; sourceTree = ""; @@ -215,12 +223,17 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0920; - LastUpgradeCheck = 0920; + LastUpgradeCheck = 0930; ORGANIZATIONNAME = "Anton Palgunov"; TargetAttributes = { B082B24E205C7D8000BC04DC = { CreatedOnToolsVersion = 9.2; ProvisioningStyle = Automatic; + SystemCapabilities = { + com.apple.Sandbox = { + enabled = 0; + }; + }; }; B082B260205C7D8000BC04DC = { CreatedOnToolsVersion = 9.2; @@ -261,6 +274,7 @@ files = ( B082B257205C7D8000BC04DC /* Assets.xcassets in Resources */, B082B25A205C7D8000BC04DC /* Main.storyboard in Resources */, + B0F8771D207AD35400D6E430 /* battery.scpt in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -288,6 +302,7 @@ B059D622205E03F5006E6B86 /* TouchBarController.swift in Sources */, B082B255205C7D8000BC04DC /* ViewController.swift in Sources */, B0C1CFCA205C97D30021C862 /* WindowController.swift in Sources */, + B0F8771A207AC1EA00D6E430 /* TouchBarSupport.m in Sources */, B082B253205C7D8000BC04DC /* AppDelegate.swift in Sources */, B059D624205E04F3006E6B86 /* TouchBarItems.swift in Sources */, B0A7E9AA205D6AA400EEF070 /* KeyPress.swift in Sources */, @@ -351,6 +366,7 @@ CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_EMPTY_BODY = YES; @@ -358,6 +374,7 @@ CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; @@ -408,6 +425,7 @@ CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_EMPTY_BODY = YES; @@ -415,6 +433,7 @@ CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; @@ -447,7 +466,6 @@ isa = XCBuildConfiguration; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - CODE_SIGN_ENTITLEMENTS = MTMR/MTMR.entitlements; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; DEVELOPMENT_TEAM = D6D8BR2QNB; @@ -468,7 +486,6 @@ isa = XCBuildConfiguration; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - CODE_SIGN_ENTITLEMENTS = MTMR/MTMR.entitlements; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; DEVELOPMENT_TEAM = D6D8BR2QNB; diff --git a/MTMR.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/MTMR.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/MTMR.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/MTMR/AppDelegate.swift b/MTMR/AppDelegate.swift index f6ab644..ab5d0cf 100644 --- a/MTMR/AppDelegate.swift +++ b/MTMR/AppDelegate.swift @@ -16,7 +16,6 @@ class AppDelegate: NSObject, NSApplicationDelegate { func applicationDidFinishLaunching(_ aNotification: Notification) { TouchBarController.shared.setupControlStripPresence() // Insert code here to initialize your application - } func applicationWillTerminate(_ aNotification: Notification) { diff --git a/MTMR/KeyPress.swift b/MTMR/KeyPress.swift index b74be39..539c978 100644 --- a/MTMR/KeyPress.swift +++ b/MTMR/KeyPress.swift @@ -8,23 +8,73 @@ import Foundation - -func KeyPress (keyCode: CGKeyCode) { - let keyDown = CGEvent(keyboardEventSource: nil, virtualKey: keyCode, keyDown: true) - let keyUp = CGEvent(keyboardEventSource: nil, virtualKey: keyCode, keyDown: false) - - keyDown?.post(tap: .cghidEventTap) - keyUp?.post(tap: .cghidEventTap) +protocol KeyPress { + var keyCode: CGKeyCode { get } + func send() } -func ESCKeyPress() { - KeyPress(keyCode: 53) +extension KeyPress { + func send () { + let src = CGEventSource(stateID: .hidSystemState) + let keyDown = CGEvent(keyboardEventSource: src, virtualKey: keyCode, keyDown: true) + let keyUp = CGEvent(keyboardEventSource: src, virtualKey: keyCode, keyDown: false) + + let loc: CGEventTapLocation = .cghidEventTap + keyDown?.post(tap: loc) + keyUp?.post(tap: loc) + } } -func BrightnessUpPress() { - KeyPress(keyCode: 107) +struct ESCKeyPress: KeyPress { + let keyCode: CGKeyCode = 53 } -func BrightnessDownPress() { - KeyPress(keyCode: 113) +struct BrightnessUpPress: KeyPress { + let keyCode: CGKeyCode = 107 } + +struct BrightnessDownPress: KeyPress { + let keyCode: CGKeyCode = 113 +} + + +func doKey(_ key: Int, down: Bool) { + let flags = NSEvent.ModifierFlags(rawValue: down ? 0xa00 : 0xb00) + let data1 = (key << 16) | ((down ? 0xa : 0xb) << 8) + + let ev = NSEvent.otherEvent( + with: NSEvent.EventType.systemDefined, + location: NSPoint(x:0.0, y:0.0), + modifierFlags: flags, + timestamp: TimeInterval(0), + windowNumber: 0, + context: nil, + // context: 0, + subtype: 8, + data1: data1, + data2: -1 + ) + let cev = ev!.cgEvent! + cev.post(tap: CGEventTapLocation(rawValue: 0)!) +} + +func HIDPostAuxKey(_ key: Int) { + doKey(key, down: true) + doKey(key, down: false) +} + + +// hidsystem/ev_keymap.h +let NX_KEYTYPE_SOUND_UP = 0 +let NX_KEYTYPE_SOUND_DOWN = 1 + +let NX_KEYTYPE_BRIGHTNESS_UP = 2 +let NX_KEYTYPE_BRIGHTNESS_DOWN = 3 + +let NX_KEYTYPE_PLAY = 16 +let NX_KEYTYPE_NEXT = 17 +let NX_KEYTYPE_PREVIOUS = 18 + + + + diff --git a/MTMR/MTMR.entitlements b/MTMR/MTMR.entitlements index f2ef3ae..0c67376 100644 --- a/MTMR/MTMR.entitlements +++ b/MTMR/MTMR.entitlements @@ -1,10 +1,5 @@ - - com.apple.security.app-sandbox - - com.apple.security.files.user-selected.read-only - - + diff --git a/MTMR/TouchBarController.swift b/MTMR/TouchBarController.swift index 1b33a44..c3a622d 100644 --- a/MTMR/TouchBarController.swift +++ b/MTMR/TouchBarController.swift @@ -14,19 +14,40 @@ class TouchBarController: NSObject, NSTouchBarDelegate { let touchBar = NSTouchBar() + var timer = Timer() + var timeButton: NSButton = NSButton() + private override init() { super.init() touchBar.delegate = self - touchBar.defaultItemIdentifiers = [.escButton, .volumeUp, .volumeDown, .time, .preferences] + touchBar.defaultItemIdentifiers = [ + .escButton, + + .brightDown, + .brightUp, + + .prev, + .play, + .next, + + .sleep, + .weather, + + .volumeDown, + .volumeUp, + .battery, + .time, + ] self.presentTouchBar() } func setupControlStripPresence() { - DFRSystemModalShowsCloseBoxWhenFrontMost(true) + DFRSystemModalShowsCloseBoxWhenFrontMost(false) let item = NSCustomTouchBarItem(identifier: .controlStripItem) item.view = NSButton(image: #imageLiteral(resourceName: "Strip"), target: self, action: #selector(presentTouchBar)) NSTouchBarItem.addSystemTrayItem(item) DFRElementSetControlStripPresenceForIdentifier(.controlStripItem, true) + timer = Timer.scheduledTimer(timeInterval: 1, target: self, selector: #selector(self.updateTime), userInfo: nil, repeats: true) } func updateControlStripPresence() { @@ -45,59 +66,112 @@ class TouchBarController: NSObject, NSTouchBarDelegate { switch identifier { case .escButton: let item = NSCustomTouchBarItem(identifier: identifier) - item.view = NSButton(title: "ESC", target: self, action: #selector(handleEsc)) + item.view = NSButton(title: "esc", target: self, action: #selector(handleEsc)) return item + + case .brightUp: + let item = NSCustomTouchBarItem(identifier: identifier) + item.view = NSButton(title: "🔆", target: self, action: #selector(handleBrightUp)) + return item + case .brightDown: + let item = NSCustomTouchBarItem(identifier: identifier) + item.view = NSButton(title: "🔅", target: self, action: #selector(handleBrightDown)) + return item + case .volumeDown: let item = NSCustomTouchBarItem(identifier: identifier) - item.view = NSButton(title: "V-", target: self, action: #selector(handleVolumeDown)) + item.view = NSButton(title: "🔉", target: self, action: #selector(handleVolumeDown)) return item case .volumeUp: let item = NSCustomTouchBarItem(identifier: identifier) - item.view = NSButton(title: "V+", target: self, action: #selector(handleVolumeUp)) + item.view = NSButton(title: "🔊", target: self, action: #selector(handleVolumeUp)) return item + +// case .prev: +// let item = NSCustomTouchBarItem(identifier: identifier) +// item.view = NSButton(title: "⏪", target: self, action: #selector(handlePrev)) +// return item + case .play: + let item = NSCustomTouchBarItem(identifier: identifier) + item.view = NSButton(title: "⏯", target: self, action: #selector(handlePlay)) + return item + case .next: + let item = NSCustomTouchBarItem(identifier: identifier) + item.view = NSButton(title: "⏩", target: self, action: #selector(handleNext)) + return item + + case .time: + let item = NSCustomTouchBarItem(identifier: identifier) + timeButton = NSButton(title: self.getCurrentTime(), target: self, action: nil) + item.view = timeButton + return item + default: return nil } } + func getCurrentTime() -> String { + let date = Date() + let dateFormatter = DateFormatter() + dateFormatter.setLocalizedDateFormatFromTemplate("HH:mm") + let timestamp = dateFormatter.string(from: date) + return timestamp + } + + @objc func updateTime() { + timeButton.title = getCurrentTime() + } + @objc func handleEsc() { - ESCKeyPress() + let sender = ESCKeyPress() + sender.send() } @objc func handleVolumeUp() { - self.volume(directon: "up") + HIDPostAuxKey(Int(NX_KEYTYPE_SOUND_UP)) } @objc func handleVolumeDown() { - self.volume(directon: "down") + HIDPostAuxKey(Int(NX_KEYTYPE_SOUND_DOWN)) } - func volume(directon: String) { - var myAppleScript = "set volume output volume (output volume of (get volume settings) - 5)" + @objc func handleBrightDown() { +// HIDPostAuxKey(Int(NX_KEYTYPE_BRIGHTNESS_DOWN)) - if (directon == "up") { - myAppleScript = "set volume output volume (output volume of (get volume settings) + 5)" - } - - var error: NSDictionary? - if let scriptObject = NSAppleScript(source: myAppleScript) { - let output: NSAppleEventDescriptor = scriptObject.executeAndReturnError(&error) - - print(output.stringValue as Any) - - if (error != nil) { - print("error: \(String(describing: error))") - } - } + let sender = BrightnessUpPress() + sender.send() } - @objc func brightness(directon: String) { - if (directon == "up") { - BrightnessUpPress() - print("BR - Up") - } else { - BrightnessDownPress() - print("BR - Down") - } + @objc func handleBrightUp() { +// HIDPostAuxKey(Int(NX_KEYTYPE_BRIGHTNESS_UP)) + + let sender = BrightnessDownPress() + sender.send() } + + @objc func handlePrev() { + HIDPostAuxKey(Int(NX_KEYTYPE_PREVIOUS)) + } + + @objc func handlePlay() { + HIDPostAuxKey(Int(NX_KEYTYPE_PLAY)) + } + + @objc func handleNext() { + HIDPostAuxKey(Int(NX_KEYTYPE_NEXT)) + } + +// func getBattery() { +// var error: NSDictionary? +// if let scriptObject = NSAppleScript(source: <#T##String#>) { +// if let output: NSAppleEventDescriptor = scriptObject.executeAndReturnError( +// &error) { +// print(output.stringValue) +// } else if (error != nil) { +// print("error: \(error)") +// } +// } +// } + } diff --git a/MTMR/TouchBarItems.swift b/MTMR/TouchBarItems.swift index 1c12c87..3799c4e 100644 --- a/MTMR/TouchBarItems.swift +++ b/MTMR/TouchBarItems.swift @@ -10,10 +10,26 @@ import Cocoa extension NSTouchBarItem.Identifier { static let escButton = NSTouchBarItem.Identifier("com.toxblh.mtmr.escButton") - static let time = NSTouchBarItem.Identifier("com.toxblh.mtmr.time") + + // Volume static let volumeUp = NSTouchBarItem.Identifier("com.toxblh.mtmr.volumeUp") static let volumeDown = NSTouchBarItem.Identifier("com.toxblh.mtmr.volumeDown") - static let preferences = NSTouchBarItem.Identifier("com.toxblh.mtmr.preferences") + + // Brightness + static let brightUp = NSTouchBarItem.Identifier("com.toxblh.mtmr.brightUp") + static let brightDown = NSTouchBarItem.Identifier("com.toxblh.mtmr.brightDown") + + // Music + static let prev = NSTouchBarItem.Identifier("com.toxblh.mtmr.prev") + static let next = NSTouchBarItem.Identifier("com.toxblh.mtmr.next") + static let play = NSTouchBarItem.Identifier("com.toxblh.mtmr.play") + + // Plugins + static let sleep = NSTouchBarItem.Identifier("com.toxblh.mtmr.sleep") + static let weather = NSTouchBarItem.Identifier("com.toxblh.mtmr.weather") + static let time = NSTouchBarItem.Identifier("com.toxblh.mtmr.time") + static let battery = NSTouchBarItem.Identifier("com.toxblh.mtmr.battery") + static let nowPlaying = NSTouchBarItem.Identifier("com.toxblh.mtmr.nowPlaying") static let controlStripItem = NSTouchBarItem.Identifier("com.toxblh.mtmr.controlStrip") } diff --git a/MTMR/TouchBarPrivateApi-Bridging.h b/MTMR/TouchBarPrivateApi-Bridging.h index ce3ddc4..28ea5b2 100644 --- a/MTMR/TouchBarPrivateApi-Bridging.h +++ b/MTMR/TouchBarPrivateApi-Bridging.h @@ -7,3 +7,4 @@ // #import "TouchBarPrivateApi.h" +#import "TouchBarSupport.h" diff --git a/MTMR/TouchBarPrivateApi.h b/MTMR/TouchBarPrivateApi.h index dbf6c3e..7873691 100644 --- a/MTMR/TouchBarPrivateApi.h +++ b/MTMR/TouchBarPrivateApi.h @@ -5,6 +5,7 @@ extern void DFRElementSetControlStripPresenceForIdentifier(NSTouchBarItemIdentif extern void DFRSystemModalShowsCloseBoxWhenFrontMost(BOOL); + @interface NSTouchBarItem (PrivateMethods) + (void)addSystemTrayItem:(NSTouchBarItem *)item; @@ -13,6 +14,7 @@ extern void DFRSystemModalShowsCloseBoxWhenFrontMost(BOOL); @end + @interface NSTouchBar (PrivateMethods) // presentSystemModalFunctionBar:placement:systemTrayItemIdentifier: @@ -25,3 +27,4 @@ extern void DFRSystemModalShowsCloseBoxWhenFrontMost(BOOL); + (void)minimizeSystemModalFunctionBar:(NSTouchBar *)touchBar; @end + diff --git a/MTMR/TouchBarSupport.h b/MTMR/TouchBarSupport.h index 74079b4..0452f39 100644 --- a/MTMR/TouchBarSupport.h +++ b/MTMR/TouchBarSupport.h @@ -6,8 +6,12 @@ // Copyright © 2018 Anton Palgunov. All rights reserved. // -#ifndef TouchBarSupport_h -#define TouchBarSupport_h +#import +@interface MediaKeys : NSObject -#endif /* TouchBarSupport_h */ ++ (void)decreaseVolume; ++ (void)increaseVolume; ++ (void)muteVolume; + +@end diff --git a/MTMR/TouchBarSupport.m b/MTMR/TouchBarSupport.m index 3467930..dbd620a 100644 --- a/MTMR/TouchBarSupport.m +++ b/MTMR/TouchBarSupport.m @@ -6,4 +6,61 @@ // Copyright © 2018 Anton Palgunov. All rights reserved. // -#import +#import "TouchBarSupport.h" + +@implementation MediaKeys + +static io_connect_t get_event_driver(void) +{ + static mach_port_t sEventDrvrRef = 0; + mach_port_t masterPort, service, iter; + kern_return_t kr; + + if (!sEventDrvrRef) + { + kr = IOMasterPort( bootstrap_port, &masterPort ); + kr = IOServiceGetMatchingServices( masterPort, IOServiceMatching( kIOHIDSystemClass ), &iter ); + service = IOIteratorNext( iter ); + kr = IOServiceOpen( service, mach_task_self(), + kIOHIDParamConnectType, &sEventDrvrRef ); + IOObjectRelease( service ); + IOObjectRelease( iter ); + } + return sEventDrvrRef; +} + + +static void HIDPostAuxKey( const UInt8 auxKeyCode ) +{ + NXEventData event; + kern_return_t kr; + IOGPoint loc = { 0, 0 }; + + // Key press event + UInt32 evtInfo = auxKeyCode << 16 | NX_KEYDOWN << 8; + bzero(&event, sizeof(NXEventData)); + event.compound.subType = NX_SUBTYPE_AUX_CONTROL_BUTTONS; + event.compound.misc.L[0] = evtInfo; + kr = IOHIDPostEvent( get_event_driver(), NX_SYSDEFINED, loc, &event, kNXEventDataVersion, 0, FALSE ); + + // Key release event + evtInfo = auxKeyCode << 16 | NX_KEYUP << 8; + bzero(&event, sizeof(NXEventData)); + event.compound.subType = NX_SUBTYPE_AUX_CONTROL_BUTTONS; + event.compound.misc.L[0] = evtInfo; + kr = IOHIDPostEvent( get_event_driver(), NX_SYSDEFINED, loc, &event, kNXEventDataVersion, 0, FALSE ); +} + ++ (void)decreaseVolume { + HIDPostAuxKey(NX_KEYTYPE_SOUND_DOWN); +} + ++ (void)increaseVolume { + HIDPostAuxKey(NX_KEYTYPE_SOUND_UP); +} + ++ (void)muteVolume { + HIDPostAuxKey(NX_KEYTYPE_MUTE); +} + +@end diff --git a/MTMR/battery.scpt b/MTMR/battery.scpt index e69de29..a3a5848 100644 --- a/MTMR/battery.scpt +++ b/MTMR/battery.scpt @@ -0,0 +1,29 @@ +set theList to paragraphs of text of (do shell script "pmset -g batt") +set percent to word 6 of theList's item 2 +set charge to word 7 of theList's item 2 + +if (charge = "charging") then +set iconC to "⚡️" +else +set iconC to "" +end if + +set remainingRaw to my split(theList's item 2, " ") +set remainingTime to remainingRaw's item 5 + +if (remainingTime = "(no") then +set strTime to " (?)" +else if (remainingTime = "0:00") then +set strTime to "" +else +set strTime to " (" & remainingTime & ")" +end if + +return iconC & percent & "%" & strTime + +to split(someText, delimiter) +set AppleScript's text item delimiters to delimiter +set someText to someText's text items +set AppleScript's text item delimiters to {""} +return someText +end split diff --git a/README.md b/README.md index cca13db..9d58d39 100644 --- a/README.md +++ b/README.md @@ -4,12 +4,17 @@ # My TouchBar. My rules +

+ +

+ My the idea is to create the program like a platform for plugins for customization TouchBar. I very like BTT and a full custom TouchBar. And I want to create it. And it's my the first Swift project for MacOS :) ### Roadmap - [x] Create the first prototype with TouchBar in Storyboard - [x] Put in stripe menu on startup the application -- [ ] Find how to simulate real buttons like brightness, volume, night shift and etc. +- [x] Find how to simulate real buttons like brightness, volume, night shift and etc. +- [x] Time in touchbar! - [ ] First the weather plugin - [ ] Create the same panel like in my [BTT preset](https://github.com/Toxblh/btt-touchbar-preset) - [ ] Find how to open full-screen TouchBar without the cross and stripe menu diff --git a/Resources/TouchBarV0.1.png b/Resources/TouchBarV0.1.png new file mode 100644 index 0000000..2df24f4 Binary files /dev/null and b/Resources/TouchBarV0.1.png differ