From e45fb6e705c8833f79efc0b8a00bb4a578ffaab4 Mon Sep 17 00:00:00 2001 From: Guillaume Broder Date: Sun, 7 Jan 2018 19:31:31 +0100 Subject: [PATCH] :wrench: Preferences WIP - All prefs pane GUI are done #2 - Now to build the functions behind... Signed-off-by: Guillaume Broder --- .swiftlint.yml | 6 +- MonitorControl.xcodeproj/project.pbxproj | 52 ++- MonitorControl/AppDelegate.swift | 32 +- .../KeyboardPref.imageset/Contents.json | 23 ++ .../KeyboardPref.imageset/Keyboard-32.png | Bin 0 -> 546 bytes .../KeyboardPref.imageset/Keyboard-64.png | Bin 0 -> 2257 bytes .../KeyboardPref.imageset/Keyboard-96.png | Bin 0 -> 3199 bytes MonitorControl/Base.lproj/Main.storyboard | 379 ++++++++++++++++++ MonitorControl/Base.lproj/MainMenu.xib | 13 +- MonitorControl/Info.plist | 4 +- MonitorControl/Objects/ButtonCellView.swift | 35 ++ MonitorControl/Objects/Display.swift | 4 +- .../Prefs/DisplayPrefsViewController.swift | 123 ++++++ .../Prefs/KeysPrefsViewController.swift | 40 ++ .../Prefs/MainPrefsViewController.swift | 52 +++ MonitorControl/Utils.swift | 21 + MonitorControl/en.lproj/Localizable.strings | 9 + MonitorControl/en.lproj/Main.strings | 72 ++++ MonitorControl/en.lproj/MainMenu.strings | 3 + MonitorControl/fr.lproj/Localizable.strings | 9 + MonitorControl/fr.lproj/Main.strings | 72 ++++ MonitorControl/fr.lproj/MainMenu.strings | 3 + Podfile | 7 +- Podfile.lock | 20 +- 24 files changed, 954 insertions(+), 25 deletions(-) create mode 100644 MonitorControl/Assets.xcassets/KeyboardPref.imageset/Contents.json create mode 100644 MonitorControl/Assets.xcassets/KeyboardPref.imageset/Keyboard-32.png create mode 100644 MonitorControl/Assets.xcassets/KeyboardPref.imageset/Keyboard-64.png create mode 100644 MonitorControl/Assets.xcassets/KeyboardPref.imageset/Keyboard-96.png create mode 100644 MonitorControl/Base.lproj/Main.storyboard create mode 100644 MonitorControl/Objects/ButtonCellView.swift create mode 100644 MonitorControl/Prefs/DisplayPrefsViewController.swift create mode 100644 MonitorControl/Prefs/KeysPrefsViewController.swift create mode 100644 MonitorControl/Prefs/MainPrefsViewController.swift create mode 100644 MonitorControl/en.lproj/Main.strings create mode 100644 MonitorControl/fr.lproj/Main.strings diff --git a/.swiftlint.yml b/.swiftlint.yml index c328b1b..24d0248 100644 --- a/.swiftlint.yml +++ b/.swiftlint.yml @@ -3,7 +3,5 @@ disabled_rules: - function_body_length excluded: - Pods -type_body_length: -- warning: 500 -file_length: -- warning: 500 +type_body_length: 500 +file_length: 500 diff --git a/MonitorControl.xcodeproj/project.pbxproj b/MonitorControl.xcodeproj/project.pbxproj index 102f51d..7c3fb04 100644 --- a/MonitorControl.xcodeproj/project.pbxproj +++ b/MonitorControl.xcodeproj/project.pbxproj @@ -14,6 +14,11 @@ 56754EB41D9A4016007BCDC5 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 56754EB21D9A4016007BCDC5 /* MainMenu.xib */; }; 9A19D3B73485870616B6D4E0 /* Pods_MonitorControl.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 398F482D5C8816B29F16AAEB /* Pods_MonitorControl.framework */; }; F03A8DF21FFBAA6F0034DC27 /* Display.swift in Sources */ = {isa = PBXBuildFile; fileRef = F03A8DF11FFBAA6F0034DC27 /* Display.swift */; }; + F0445D3820023E710025AE82 /* MainPrefsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F0445D3720023E710025AE82 /* MainPrefsViewController.swift */; }; + F0445D3D200254FA0025AE82 /* KeysPrefsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F0445D3B200254FA0025AE82 /* KeysPrefsViewController.swift */; }; + F0445D40200259C10025AE82 /* DisplayPrefsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F0445D3F200259C10025AE82 /* DisplayPrefsViewController.swift */; }; + F0445D41200282E60025AE82 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F0445D43200282E60025AE82 /* Main.storyboard */; }; + F0445D4D200294AB0025AE82 /* ButtonCellView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F0445D4C200294AB0025AE82 /* ButtonCellView.swift */; }; F091C9B31F6EA6110096FD65 /* SliderHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = F091C9B21F6EA6110096FD65 /* SliderHandler.swift */; }; F091C9B81F6EA79B0096FD65 /* Utils.swift in Sources */ = {isa = PBXBuildFile; fileRef = F091C9B71F6EA79B0096FD65 /* Utils.swift */; }; F0A987E81F77B40E009B603D /* OSD.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F0A987D61F77B290009B603D /* OSD.framework */; }; @@ -36,13 +41,20 @@ 56754EB31D9A4016007BCDC5 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = ""; }; 56754EB51D9A4016007BCDC5 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; F03A8DF11FFBAA6F0034DC27 /* Display.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Display.swift; sourceTree = ""; }; + F0445D3720023E710025AE82 /* MainPrefsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainPrefsViewController.swift; sourceTree = ""; }; + F0445D3B200254FA0025AE82 /* KeysPrefsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KeysPrefsViewController.swift; sourceTree = ""; }; + F0445D3F200259C10025AE82 /* DisplayPrefsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DisplayPrefsViewController.swift; sourceTree = ""; }; + F0445D42200282E60025AE82 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + F0445D45200282EB0025AE82 /* fr */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = fr; path = fr.lproj/Main.strings; sourceTree = ""; }; + F0445D47200282F80025AE82 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Main.strings; sourceTree = ""; }; + F0445D49200285690025AE82 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/MainMenu.strings; sourceTree = ""; }; + F0445D4B2002856C0025AE82 /* fr */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = fr; path = fr.lproj/MainMenu.strings; sourceTree = ""; }; + F0445D4C200294AB0025AE82 /* ButtonCellView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ButtonCellView.swift; sourceTree = ""; }; F091C9B21F6EA6110096FD65 /* SliderHandler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SliderHandler.swift; sourceTree = ""; }; F091C9B71F6EA79B0096FD65 /* Utils.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Utils.swift; sourceTree = ""; }; - F091C9B91F6EB43B0096FD65 /* fr */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; lineEnding = 0; name = fr; path = fr.lproj/MainMenu.strings; sourceTree = ""; }; F091C9C21F6EB8660096FD65 /* en */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; lineEnding = 0; name = en; path = en.lproj/Localizable.strings; sourceTree = ""; }; F091C9C31F6EB8720096FD65 /* fr */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; lineEnding = 0; name = fr; path = fr.lproj/Localizable.strings; sourceTree = ""; }; F091C9C41F6EBA5A0096FD65 /* Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Bridging-Header.h"; sourceTree = ""; }; - F0A987D51F77A823009B603D /* en */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; lineEnding = 0; name = en; path = en.lproj/MainMenu.strings; sourceTree = ""; }; F0A987D61F77B290009B603D /* OSD.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = OSD.framework; sourceTree = ""; }; F0A987DA1F77B404009B603D /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/MainMenu.strings; sourceTree = ""; }; F0A987DC1F77B404009B603D /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Localizable.strings; sourceTree = ""; }; @@ -108,10 +120,12 @@ children = ( 56754EAE1D9A4016007BCDC5 /* AppDelegate.swift */, F091C9B71F6EA79B0096FD65 /* Utils.swift */, + F0445D43200282E60025AE82 /* Main.storyboard */, + 56754EB21D9A4016007BCDC5 /* MainMenu.xib */, + F0445D3620023D5B0025AE82 /* Prefs */, F091C9B41F6EA6180096FD65 /* Objects */, F091C9C41F6EBA5A0096FD65 /* Bridging-Header.h */, 56754EB01D9A4016007BCDC5 /* Assets.xcassets */, - 56754EB21D9A4016007BCDC5 /* MainMenu.xib */, F091C9C11F6EB8660096FD65 /* Localizable.strings */, 56754EB51D9A4016007BCDC5 /* Info.plist */, ); @@ -127,9 +141,20 @@ name = Pods; sourceTree = ""; }; + F0445D3620023D5B0025AE82 /* Prefs */ = { + isa = PBXGroup; + children = ( + F0445D3720023E710025AE82 /* MainPrefsViewController.swift */, + F0445D3B200254FA0025AE82 /* KeysPrefsViewController.swift */, + F0445D3F200259C10025AE82 /* DisplayPrefsViewController.swift */, + ); + path = Prefs; + sourceTree = ""; + }; F091C9B41F6EA6180096FD65 /* Objects */ = { isa = PBXGroup; children = ( + F0445D4C200294AB0025AE82 /* ButtonCellView.swift */, F091C9B21F6EA6110096FD65 /* SliderHandler.swift */, F03A8DF11FFBAA6F0034DC27 /* Display.swift */, ); @@ -236,6 +261,7 @@ buildActionMask = 2147483647; files = ( 56754EB11D9A4016007BCDC5 /* Assets.xcassets in Resources */, + F0445D41200282E60025AE82 /* Main.storyboard in Resources */, F0EB972F1F6ED7C800686D2A /* Localizable.strings in Resources */, 55359E3B1E2737EC002671BC /* ddcctl.sh in Resources */, 56754EB41D9A4016007BCDC5 /* MainMenu.xib in Resources */, @@ -267,10 +293,12 @@ ); inputPaths = ( "${SRCROOT}/Pods/Target Support Files/Pods-MonitorControl/Pods-MonitorControl-frameworks.sh", + "${BUILT_PRODUCTS_DIR}/MASPreferences/MASPreferences.framework", "${BUILT_PRODUCTS_DIR}/MediaKeyTap/MediaKeyTap.framework", ); name = "[CP] Embed Pods Frameworks"; outputPaths = ( + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MASPreferences.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MediaKeyTap.framework", ); runOnlyForDeploymentPostprocessing = 0; @@ -317,11 +345,15 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + F0445D40200259C10025AE82 /* DisplayPrefsViewController.swift in Sources */, F03A8DF21FFBAA6F0034DC27 /* Display.swift in Sources */, F091C9B31F6EA6110096FD65 /* SliderHandler.swift in Sources */, 56754EAF1D9A4016007BCDC5 /* AppDelegate.swift in Sources */, 55359E391E2737EC002671BC /* DDC.c in Sources */, + F0445D3820023E710025AE82 /* MainPrefsViewController.swift in Sources */, + F0445D3D200254FA0025AE82 /* KeysPrefsViewController.swift in Sources */, F091C9B81F6EA79B0096FD65 /* Utils.swift in Sources */, + F0445D4D200294AB0025AE82 /* ButtonCellView.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -332,12 +364,22 @@ isa = PBXVariantGroup; children = ( 56754EB31D9A4016007BCDC5 /* Base */, - F091C9B91F6EB43B0096FD65 /* fr */, - F0A987D51F77A823009B603D /* en */, + F0445D49200285690025AE82 /* en */, + F0445D4B2002856C0025AE82 /* fr */, ); name = MainMenu.xib; sourceTree = ""; }; + F0445D43200282E60025AE82 /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + F0445D42200282E60025AE82 /* Base */, + F0445D45200282EB0025AE82 /* fr */, + F0445D47200282F80025AE82 /* en */, + ); + name = Main.storyboard; + sourceTree = ""; + }; F091C9C11F6EB8660096FD65 /* Localizable.strings */ = { isa = PBXVariantGroup; children = ( diff --git a/MonitorControl/AppDelegate.swift b/MonitorControl/AppDelegate.swift index 74cebbe..a98b343 100644 --- a/MonitorControl/AppDelegate.swift +++ b/MonitorControl/AppDelegate.swift @@ -10,6 +10,7 @@ import Cocoa import Foundation import MediaKeyTap +import MASPreferences var app: AppDelegate! = nil let prefs = UserDefaults.standard @@ -33,14 +34,25 @@ class AppDelegate: NSObject, NSApplicationDelegate, MediaKeyTapDelegate { let step = 100/16 var mediaKeyTap: MediaKeyTap? + var prefsController: NSWindowController? func applicationDidFinishLaunching(_ aNotification: Notification) { app = self mediaKeyTap = MediaKeyTap.init(delegate: self, forKeys: [.brightnessUp, .brightnessDown, .mute, .volumeUp, .volumeDown], observeBuiltIn: false) + let storyboard: NSStoryboard = NSStoryboard.init(name: NSStoryboard.Name(rawValue: "Main"), bundle: Bundle.main) + prefsController = MASPreferencesWindowController(viewControllers: + [ + storyboard.instantiateController(withIdentifier: NSStoryboard.SceneIdentifier(rawValue: "MainPrefsVC")), + storyboard.instantiateController(withIdentifier: NSStoryboard.SceneIdentifier(rawValue: "KeysPrefsVC")), + storyboard.instantiateController(withIdentifier: NSStoryboard.SceneIdentifier(rawValue: "DisplayPrefsVC")) + ], + title: NSLocalizedString("Preferences", comment: "Shown in Preferences window")) statusItem.image = NSImage.init(named: NSImage.Name(rawValue: "status")) statusItem.menu = statusMenu + setDefaultPrefs() + Utils.acquirePrivileges() CGDisplayRegisterReconfigurationCallback({_, _, _ in app.updateDisplays()}, nil) @@ -56,6 +68,24 @@ class AppDelegate: NSObject, NSApplicationDelegate, MediaKeyTapDelegate { NSApplication.shared.terminate(self) } + @IBAction func prefsClicked(_ sender: AnyObject) { + if let prefsController = prefsController { + prefsController.showWindow(sender) + prefsController.window?.makeKeyAndOrderFront(sender) + } + } + + /// Set the default prefs of the app + func setDefaultPrefs() { + let prefs = UserDefaults.standard + if !prefs.bool(forKey: Utils.PrefKeys.appAlreadyLaunched.rawValue) { + prefs.set(true, forKey: Utils.PrefKeys.appAlreadyLaunched.rawValue) + + prefs.set(false, forKey: Utils.PrefKeys.startAtLogin.rawValue) + prefs.set(true, forKey: Utils.PrefKeys.startWhenExternal.rawValue) + } + } + // MARK: - Menu func clearDisplays() { @@ -92,7 +122,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, MediaKeyTapDelegate { let name = Utils.getDisplayName(forEdid: edid) let serial = Utils.getDisplaySerial(forEdid: edid) - let display = Display(identifier: id, name: name, serial: serial, isBuiltIn: false) + let display = Display(identifier: id, name: name, serial: serial, isEnabled: true) displays.append(display) let monitorSubMenu = NSMenu() diff --git a/MonitorControl/Assets.xcassets/KeyboardPref.imageset/Contents.json b/MonitorControl/Assets.xcassets/KeyboardPref.imageset/Contents.json new file mode 100644 index 0000000..5c0a83d --- /dev/null +++ b/MonitorControl/Assets.xcassets/KeyboardPref.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "Keyboard-32.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "Keyboard-64.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "Keyboard-96.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/MonitorControl/Assets.xcassets/KeyboardPref.imageset/Keyboard-32.png b/MonitorControl/Assets.xcassets/KeyboardPref.imageset/Keyboard-32.png new file mode 100644 index 0000000000000000000000000000000000000000..f1ce97086d86067d71d7d30690219d907835c72b GIT binary patch literal 546 zcmV+-0^R+IP)eozP@rvGqc$Y$F^}C2hVl! zJ&!O5h{BLKib#@#EKSL?j3Un|%aW?9sOy@hv$knaRIR?|+S9)7bgw`9r@#8|b{z5M z^Eu}G>xis#1d0%)9>|IuU71LI}ZE(k(V+^Q5c58a85C2^A@w8OQ;>4 zwyp$ss;!!&xU|PnhT@{&Lg7umMVJY~WMd3`$sfq$dl=J~fD0#XmFHj5wnwS!%2A88 zhBa9RTsU#7vM9tDBYqgIlV(3~;#RZSjE#J{pJO_mO4Br~$ui)=iCZz%RVDZP9i*`~ zY4+d@8o1qVz~Q9X6ExtjU^1DAwU#wmhVTl?QmV~HuGedTH704siCdL!+PF>M_W^X6 zGULR}GZekwOEwtajU{j>-AbLm&*fM>!)WA&f;$aUDrK8;ghrHw}Cv* zWw+bOXf)#A89?E)GvI35R&Xn()oLZ@^BFiC%~2j}gZ*~94I5Z4mvTCtfP>K-Ctgbv zxK);A-#m}ua40Uz;c#I6FGq;i;=+kr4F-b`_a3|Xd@hT{;w9k1iCekx=6H7;9lb*m k)8oR4`)8xg@=*r>05_Fb3fPxTfdBvi literal 0 HcmV?d00001 diff --git a/MonitorControl/Assets.xcassets/KeyboardPref.imageset/Keyboard-64.png b/MonitorControl/Assets.xcassets/KeyboardPref.imageset/Keyboard-64.png new file mode 100644 index 0000000000000000000000000000000000000000..7133271e7adb91dd82468e15ddeea349e994b0b6 GIT binary patch literal 2257 zcmc(g`9Bj39LHx=&Wc=*7DDBir#&gDmLo}ONzQuG$dL|DNR;xppAtD@jIm)2Iog~} za?E|qhHVVPu-tQOL*{%uf5r2Dy}qB%>-*dH_5J+t`CwyhDI=*O2><|Otgc_R-E-6b zMqG4H(Zp~r03gD(f!SN^t&x$DDJdymzkZ#aoz2V3W3$=m>FHD|wX?G`H8qt?CV&6_ z9gD^0=H`C+^5ygA&#SAeySuwhO-*z<{pZi0o12^8zI~gRm>3ussI08q-rnBW*eEC{ zSXfx->guYmuU}bN85|rO8XCgka6BHbqoZSFWTdF5=-01bTU%S@<>lSo-6bU@Q&UsT z&COL+RZB}tL?W@JrKPa2kVd2R_V!j+S0j_zxLz;^U|8T2+Z@}KCK*pCNg6^|Z21^(ll(Zx&B z3M#4^Cw272B@W9ei|vz?5fR;QyC{?b0QN0gT{W|REyC@p6d^&R#YpE3xb@y?8@CG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I$H`$@}74^$$cS8$z-Q2)&FyFgH4U4!kD$kZ7e8m4gkArx)<@wRF>LuBM z;aQAOUPk*G@40t1Z%2v;kC2;N(YM8^vaajXh#0{ZO!t907npxWoofe|kSqj)nwEv| z8s;}sXHOoS46eV3BP@a1EYx$T61im*$k(z@6~}SP)WIJ*X2< z7#RZ(ya%zyRCQSVOjnh%Eh1%%Dj8T5X5iXL79U;RupdkA*AWdKB;#gdK)-#S}x*JH~h31zSxHGbJQYgT~b6s&*(;&E;?u5e; hWPH{tV+ERvzWMK232ksr{QYAAGSV~CE!4L2|1ZH2&*uOD literal 0 HcmV?d00001 diff --git a/MonitorControl/Base.lproj/Main.storyboard b/MonitorControl/Base.lproj/Main.storyboard new file mode 100644 index 0000000..8385f84 --- /dev/null +++ b/MonitorControl/Base.lproj/Main.storyboard @@ -0,0 +1,379 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/MonitorControl/Base.lproj/MainMenu.xib b/MonitorControl/Base.lproj/MainMenu.xib index d55f9e9..a833942 100644 --- a/MonitorControl/Base.lproj/MainMenu.xib +++ b/MonitorControl/Base.lproj/MainMenu.xib @@ -1,8 +1,7 @@ - + - - + @@ -22,6 +21,12 @@ + + + + + + @@ -29,7 +34,7 @@ - + diff --git a/MonitorControl/Info.plist b/MonitorControl/Info.plist index 3edcac1..b8f87f2 100644 --- a/MonitorControl/Info.plist +++ b/MonitorControl/Info.plist @@ -17,9 +17,9 @@ CFBundlePackageType APPL CFBundleShortVersionString - 1.1 + 1.1.1 CFBundleVersion - 20 + 32 LSApplicationCategoryType public.app-category.utilities LSMinimumSystemVersion diff --git a/MonitorControl/Objects/ButtonCellView.swift b/MonitorControl/Objects/ButtonCellView.swift new file mode 100644 index 0000000..8f82322 --- /dev/null +++ b/MonitorControl/Objects/ButtonCellView.swift @@ -0,0 +1,35 @@ +// +// ButtonCellView.swift +// MonitorControl +// +// Created by Guillaume BRODER on 07/01/2018. +// Copyright © 2018 Mathew Kurian. All rights reserved. +// + +import Cocoa + +class ButtonCellView: NSTableCellView { + + @IBOutlet var button: NSButton! + var display: Display? + let prefs = UserDefaults.standard + + override func draw(_ dirtyRect: NSRect) { + super.draw(dirtyRect) + } + + @IBAction func buttonToggled(_ sender: NSButton) { + if let display = display { + switch sender.state { + case .on: + prefs.set(true, forKey: "\(display.identifier)-state") + case .off: + prefs.set(true, forKey: "\(display.identifier)-state") + default: + break + } + // TODO: Toggle enabled display state + print("Toggle enabled display state -> \(sender.state)") + } + } +} diff --git a/MonitorControl/Objects/Display.swift b/MonitorControl/Objects/Display.swift index 7d41321..8346c1b 100644 --- a/MonitorControl/Objects/Display.swift +++ b/MonitorControl/Objects/Display.swift @@ -3,7 +3,7 @@ // MonitorControl // // Created by Guillaume BRODER on 02/01/2018. -// Copyright © 2018 Mathew Kurian. All rights reserved. +// MIT Licensed. // import Cocoa @@ -13,5 +13,5 @@ struct Display { var identifier: CGDirectDisplayID var name: String var serial: String - var isBuiltIn: Bool = false + var isEnabled: Bool = true } diff --git a/MonitorControl/Prefs/DisplayPrefsViewController.swift b/MonitorControl/Prefs/DisplayPrefsViewController.swift new file mode 100644 index 0000000..c44478e --- /dev/null +++ b/MonitorControl/Prefs/DisplayPrefsViewController.swift @@ -0,0 +1,123 @@ +// +// DisplayPrefsViewController.swift +// MonitorControl +// +// Created by Guillaume BRODER on 07/01/2018. +// MIT Licensed. +// + +import Cocoa +import MASPreferences + +class DisplayPrefsViewController: NSViewController, MASPreferencesViewController, NSTableViewDataSource, NSTableViewDelegate { + + var viewIdentifier: String = "Display" + var toolbarItemLabel: String? = NSLocalizedString("Display", comment: "Shown in the main prefs window") + var toolbarItemImage: NSImage? = NSImage.init(named: .computer) + let prefs = UserDefaults.standard + + var displays: [Display] = [] + enum DisplayCell: String { + case checkbox + case name + case identifier + } + + @IBOutlet var allScreens: NSButton! + @IBOutlet var displayList: NSTableView! + + override func viewDidLoad() { + super.viewDidLoad() + + allScreens.state = prefs.bool(forKey: Utils.PrefKeys.allScreens.rawValue) ? .on : .off + + loadDisplayList() + } + + @IBAction func allScreensTouched(_ sender: NSButton) { + switch sender.state { + case .on: + prefs.set(true, forKey: Utils.PrefKeys.allScreens.rawValue) + case .off: + prefs.set(false, forKey: Utils.PrefKeys.allScreens.rawValue) + default: break + } + // TODO: Toggle allScreens state + print("Toggle allScreens state -> \(sender.state)") + } + + // MARK: - Table datasource + + func loadDisplayList() { + for screen in NSScreen.screens { + if let id = screen.deviceDescription[NSDeviceDescriptionKey.init("NSScreenNumber")] as? CGDirectDisplayID { + // Is Built In Screen (e.g. MBP/iMac Screen) + if CGDisplayIsBuiltin(id) != 0 { + let display = Display(identifier: id, name: "Mac built-in Display", serial: "", isEnabled: false) + displays.append(display) + continue + } + + // Does screen support EDID ? + var edid = EDID() + if !EDIDTest(id, &edid) { + continue + } + + let name = Utils.getDisplayName(forEdid: edid) + let serial = Utils.getDisplaySerial(forEdid: edid) + var isEnabled = true + if let enabled = prefs.object(forKey: "\(id)-state") as? Bool { + isEnabled = enabled + } + + let display = Display(identifier: id, name: name, serial: serial, isEnabled: isEnabled) + displays.append(display) + } + } + displayList.reloadData() + } + + func numberOfRows(in tableView: NSTableView) -> Int { + return displays.count + } + + // MARK: - Table delegate + + func tableView(_ tableView: NSTableView, viewFor tableColumn: NSTableColumn?, row: Int) -> NSView? { + var cellType = DisplayCell.checkbox + var checked = false + var text = "" + let display = displays[row] + + if tableColumn == tableView.tableColumns[0] { + // Checkbox + checked = display.isEnabled + } else if tableColumn == tableView.tableColumns[1] { + // Name + text = display.name + cellType = DisplayCell.name + } else if tableColumn == tableView.tableColumns[2] { + // Identifier + text = "\(display.identifier)" + cellType = DisplayCell.identifier + } + if cellType == DisplayCell.checkbox { + if let cell = tableView.makeView(withIdentifier: (tableColumn?.identifier)!, owner: nil) as? ButtonCellView { + cell.button.state = checked ? .on : .off + cell.display = display + if display.name == "Mac built-in Display" { + cell.button.isEnabled = false + } + return cell + } + } else { + if let cell = tableView.makeView(withIdentifier: (tableColumn?.identifier)!, owner: nil) as? NSTableCellView { + cell.textField?.stringValue = text + return cell + } + } + + return nil + } +} diff --git a/MonitorControl/Prefs/KeysPrefsViewController.swift b/MonitorControl/Prefs/KeysPrefsViewController.swift new file mode 100644 index 0000000..b157528 --- /dev/null +++ b/MonitorControl/Prefs/KeysPrefsViewController.swift @@ -0,0 +1,40 @@ +// +// KeysPrefsViewController.swift +// MonitorControl +// +// Created by Guillaume BRODER on 07/01/2018. +// MIT Licensed. +// + +import Cocoa +import MASPreferences + +class KeysPrefsViewController: NSViewController, MASPreferencesViewController { + + var viewIdentifier: String = "Keys" + var toolbarItemLabel: String? = NSLocalizedString("Keys", comment: "Shown in the main prefs window") + var toolbarItemImage: NSImage? = NSImage.init(named: NSImage.Name.init("KeyboardPref")) + let prefs = UserDefaults.standard + + @IBOutlet var listenFor: NSPopUpButton! + @IBOutlet var listenOn: NSPopUpButton! + + override func viewDidLoad() { + super.viewDidLoad() + + listenFor.selectItem(at: prefs.integer(forKey: Utils.PrefKeys.listenFor.rawValue)) + listenOn.selectItem(at: prefs.integer(forKey: Utils.PrefKeys.listenOn.rawValue)) + } + + @IBAction func listenForChanged(_ sender: NSPopUpButton) { + prefs.set(sender.selectedTag(), forKey: Utils.PrefKeys.listenFor.rawValue) + // TODO: Toggle keys listened for state + print("Toggle keys listened for state state -> \(sender.selectedItem?.title ?? "")") + } + + @IBAction func listenOnChanged(_ sender: NSPopUpButton) { + prefs.set(sender.selectedTag(), forKey: Utils.PrefKeys.listenOn.rawValue) + // TODO: Toggle keys listened on state + print("Toggle keys listened on state state -> \(sender.selectedItem?.title ?? "")") + } +} diff --git a/MonitorControl/Prefs/MainPrefsViewController.swift b/MonitorControl/Prefs/MainPrefsViewController.swift new file mode 100644 index 0000000..536a70c --- /dev/null +++ b/MonitorControl/Prefs/MainPrefsViewController.swift @@ -0,0 +1,52 @@ +// +// MainPrefsViewController.swift +// MonitorControl +// +// Created by Guillaume BRODER on 07/01/2018. +// MIT Licensed. +// + +import Cocoa +import MASPreferences + +class MainPrefsViewController: NSViewController, MASPreferencesViewController { + + var viewIdentifier: String = "Main" + var toolbarItemLabel: String? = NSLocalizedString("General", comment: "Shown in the main prefs window") + var toolbarItemImage: NSImage? = NSImage.init(named: .preferencesGeneral) + let prefs = UserDefaults.standard + + @IBOutlet var startAtLogin: NSButton! + @IBOutlet var startWhenExternal: NSButton! + + override func viewDidLoad() { + super.viewDidLoad() + + startAtLogin.state = prefs.bool(forKey: Utils.PrefKeys.startAtLogin.rawValue) ? .on : .off + startWhenExternal.state = prefs.bool(forKey: Utils.PrefKeys.startWhenExternal.rawValue) ? .on : .off + } + + @IBAction func startAtLoginClicked(_ sender: NSButton) { + switch sender.state { + case .on: + prefs.set(true, forKey: Utils.PrefKeys.startAtLogin.rawValue) + case .off: + prefs.set(false, forKey: Utils.PrefKeys.startAtLogin.rawValue) + default: break + } + // TODO: Toggle start at login state + print("Toggle start at login state -> \(sender.state)") + } + + @IBAction func startWhenExternalClicked(_ sender: NSButton) { + switch sender.state { + case .on: + prefs.set(true, forKey: Utils.PrefKeys.startWhenExternal.rawValue) + case .off: + prefs.set(false, forKey: Utils.PrefKeys.startWhenExternal.rawValue) + default: break + } + // TODO: Toggle start when external plugged in state + print("Toggle start when external plugged in state -> \(sender.state)") + } +} diff --git a/MonitorControl/Utils.swift b/MonitorControl/Utils.swift index 2827ff8..1e279b0 100644 --- a/MonitorControl/Utils.swift +++ b/MonitorControl/Utils.swift @@ -147,4 +147,25 @@ class Utils: NSObject { return getDescriptorString(edid, 0xFF) ?? NSLocalizedString("Unknown", comment: "") } + /// UserDefault Keys for the app prefs + enum PrefKeys: String { + /// Was the app launched once + case appAlreadyLaunched + + /// Does the app start at Login + case startAtLogin + + /// Does the app start when plugged to an external monitor + case startWhenExternal + + /// Keys listened for (Brightness/Volume) + case listenFor + + /// Keys listened on (mac or functions) + case listenOn + + /// Change Brightness/Volume for all screens + case allScreens + } + } diff --git a/MonitorControl/en.lproj/Localizable.strings b/MonitorControl/en.lproj/Localizable.strings index 50fff37..16031b9 100644 --- a/MonitorControl/en.lproj/Localizable.strings +++ b/MonitorControl/en.lproj/Localizable.strings @@ -22,6 +22,9 @@ /* Shown in menu */ "Volume" = "Volume"; +/* Shown in Preferences window */ +"Preferences" = "Preferences"; + /* Shown in the alert dialog */ "Ok" = "Ok"; @@ -30,3 +33,9 @@ /* Shown in the alert dialog */ "You need to enable MonitorControl in System Preferences > Security and Privacy > Accessibility for the keyboard shortcuts to work" = "You need to enable MonitorControl in System Preferences > Security and Privacy > Accessibility for the keyboard shortcuts to work"; + +/* Shown in the main prefs window */ +"General" = "General"; + +/* Shown in the main prefs window */ +"Keys" = "Keys"; diff --git a/MonitorControl/en.lproj/Main.strings b/MonitorControl/en.lproj/Main.strings new file mode 100644 index 0000000..12726cf --- /dev/null +++ b/MonitorControl/en.lproj/Main.strings @@ -0,0 +1,72 @@ + +/* Class = "NSButtonCell"; title = "Change Brightness/Volume for all screens"; ObjectID = "0Z7-PQ-Bl8"; */ +"0Z7-PQ-Bl8.title" = "Change Brightness/Volume for all screens"; + +/* Class = "NSTextFieldCell"; title = "Text Cell"; ObjectID = "2gr-xG-Byx"; */ +"2gr-xG-Byx.title" = "Text Cell"; + +/* Class = "NSTableColumn"; headerCell.title = "Enabled"; ObjectID = "8U8-ec-Zbv"; */ +"8U8-ec-Zbv.headerCell.title" = "Enabled"; + +/* Class = "NSMenuItem"; title = "Native Mac Keys"; ObjectID = "AiH-h3-2w5"; */ +"AiH-h3-2w5.title" = "Native Mac Keys"; + +/* Class = "NSTextFieldCell"; title = "Listen on"; ObjectID = "C3e-V0-Tn0"; */ +"C3e-V0-Tn0.title" = "Listen on"; + +/* Class = "NSTableColumn"; headerCell.title = "Display Name"; ObjectID = "CHc-s5-4MN"; */ +"CHc-s5-4MN.headerCell.title" = "Display Name"; + +/* Class = "NSTextFieldCell"; title = "Keys"; ObjectID = "Dcz-GG-1li"; */ +"Dcz-GG-1li.title" = "Keys"; + +/* Class = "NSTextFieldCell"; title = "Display"; ObjectID = "ExD-7P-6XI"; */ +"ExD-7P-6XI.title" = "Display"; + +/* Class = "NSTextFieldCell"; title = "Last check: "; ObjectID = "I3I-EP-Ev8"; */ +"I3I-EP-Ev8.title" = "Last check: "; + +/* Class = "NSMenuItem"; title = "Volume only"; ObjectID = "NLP-dU-Dam"; */ +"NLP-dU-Dam.title" = "Volume only"; + +/* Class = "NSButtonCell"; title = "Check for updates automatically"; ObjectID = "SCJ-AY-phi"; */ +"SCJ-AY-phi.title" = "Check for updates automatically"; + +/* Class = "NSButtonCell"; title = "Start MonitorControl at Login"; ObjectID = "UTh-SV-vAQ"; */ +"UTh-SV-vAQ.title" = "Start MonitorControl at Login"; + +/* Class = "NSTextFieldCell"; title = "Listen for"; ObjectID = "Vh8-06-U3K"; */ +"Vh8-06-U3K.title" = "Listen for"; + +/* Class = "NSButtonCell"; title = "Check for updates"; ObjectID = "Vi8-Ye-W28"; */ +"Vi8-Ye-W28.title" = "Check for updates"; + +/* Class = "NSMenuItem"; title = "Both Brightness & Volume"; ObjectID = "Vr4-xb-B4o"; */ +"Vr4-xb-B4o.title" = "Both Brightness & Volume"; + +/* Class = "NSButtonCell"; title = "Start when plugged to an external monitor"; ObjectID = "WJp-aA-2Af"; */ +"WJp-aA-2Af.title" = "Start when plugged to an external monitor"; + +/* Class = "NSTextFieldCell"; title = "Text Cell"; ObjectID = "Xje-0J-NNJ"; */ +"Xje-0J-NNJ.title" = "Text Cell"; + +/* Class = "NSTextFieldCell"; title = "Text Cell"; ObjectID = "as0-t3-Aub"; */ +"as0-t3-Aub.title" = "Text Cell"; + +/* Class = "NSTextFieldCell"; title = "Table View Cell"; ObjectID = "cUg-j2-8gt"; */ +"cUg-j2-8gt.title" = "Table View Cell"; + +/* Class = "NSMenuItem"; title = "Function Keys (F1, F2...)"; ObjectID = "dQm-ww-uhA"; */ +"dQm-ww-uhA.title" = "Function Keys (F1, F2...)"; + +/* Class = "NSTableColumn"; headerCell.title = "Display Id"; ObjectID = "dgp-q7-cBK"; */ +"dgp-q7-cBK.headerCell.title" = "Display Id"; + +/* Class = "NSMenuItem"; title = "Brightness only"; ObjectID = "hjz-0c-rvK"; */ +"hjz-0c-rvK.title" = "Brightness only"; + +/* Class = "NSTextFieldCell"; title = "Table View Cell"; ObjectID = "ldv-hu-9Hl"; */ +"ldv-hu-9Hl.title" = "Table View Cell"; + +/* Class = "NSTextFieldCell"; title = "General"; ObjectID = "ocE-Cc-2bi"; */ +"ocE-Cc-2bi.title" = "General"; diff --git a/MonitorControl/en.lproj/MainMenu.strings b/MonitorControl/en.lproj/MainMenu.strings index bcd1e86..0f25293 100644 --- a/MonitorControl/en.lproj/MainMenu.strings +++ b/MonitorControl/en.lproj/MainMenu.strings @@ -1,3 +1,6 @@ /* Class = "NSMenuItem"; title = "Quit"; ObjectID = "JTa-2I-AsI"; */ "JTa-2I-AsI.title" = "Quit"; + +/* Class = "NSMenuItem"; title = "Preferences..."; ObjectID = "SOS-eZ-uU5"; */ +"SOS-eZ-uU5.title" = "Preferences..."; diff --git a/MonitorControl/fr.lproj/Localizable.strings b/MonitorControl/fr.lproj/Localizable.strings index f7c0f73..4ea59ab 100644 --- a/MonitorControl/fr.lproj/Localizable.strings +++ b/MonitorControl/fr.lproj/Localizable.strings @@ -22,6 +22,9 @@ /* Shown in menu */ "Volume" = "Volume"; +/* Shown in Preferences window */ +"Preferences" = "Préférences"; + /* Shown in the alert dialog */ "Ok" = "Ok"; @@ -30,3 +33,9 @@ /* Shown in the alert dialog */ "You need to enable MonitorControl in System Preferences > Security and Privacy > Accessibility for the keyboard shortcuts to work" = "Vous devez activer MonitorControl dans Préférences Système > Sécurité et confidentialité > Accessibilité pour que les raccourcis clavier fonctionnes"; + +/* Shown in the main prefs window */ +"General" = "Général"; + +/* Shown in the main prefs window */ +"Keys" = "Touches"; diff --git a/MonitorControl/fr.lproj/Main.strings b/MonitorControl/fr.lproj/Main.strings new file mode 100644 index 0000000..4d0745e --- /dev/null +++ b/MonitorControl/fr.lproj/Main.strings @@ -0,0 +1,72 @@ + +/* Class = "NSButtonCell"; title = "Change Brightness/Volume for all screens"; ObjectID = "0Z7-PQ-Bl8"; */ +"0Z7-PQ-Bl8.title" = "Modifier Luminosité/Volume pour tout les écrans"; + +/* Class = "NSTextFieldCell"; title = "Text Cell"; ObjectID = "2gr-xG-Byx"; */ +"2gr-xG-Byx.title" = "Text Cell"; + +/* Class = "NSTableColumn"; headerCell.title = "Enabled"; ObjectID = "8U8-ec-Zbv"; */ +"8U8-ec-Zbv.headerCell.title" = "Activé"; + +/* Class = "NSMenuItem"; title = "Native Mac Keys"; ObjectID = "AiH-h3-2w5"; */ +"AiH-h3-2w5.title" = "Touches macOS Native"; + +/* Class = "NSTextFieldCell"; title = "Listen on"; ObjectID = "C3e-V0-Tn0"; */ +"C3e-V0-Tn0.title" = "Écouter sur"; + +/* Class = "NSTableColumn"; headerCell.title = "Display Name"; ObjectID = "CHc-s5-4MN"; */ +"CHc-s5-4MN.headerCell.title" = "Nom de l'écran"; + +/* Class = "NSTextFieldCell"; title = "Keys"; ObjectID = "Dcz-GG-1li"; */ +"Dcz-GG-1li.title" = "Touches"; + +/* Class = "NSTextFieldCell"; title = "Display"; ObjectID = "ExD-7P-6XI"; */ +"ExD-7P-6XI.title" = "Écrans"; + +/* Class = "NSTextFieldCell"; title = "Last check: "; ObjectID = "I3I-EP-Ev8"; */ +"I3I-EP-Ev8.title" = "Dernière vérification: "; + +/* Class = "NSMenuItem"; title = "Volume only"; ObjectID = "NLP-dU-Dam"; */ +"NLP-dU-Dam.title" = "Volume uniquement"; + +/* Class = "NSButtonCell"; title = "Check for updates automatically"; ObjectID = "SCJ-AY-phi"; */ +"SCJ-AY-phi.title" = "Vérifier les màj automatiquement"; + +/* Class = "NSButtonCell"; title = "Start MonitorControl at Login"; ObjectID = "UTh-SV-vAQ"; */ +"UTh-SV-vAQ.title" = "Lancer MonitorControl au démarrage"; + +/* Class = "NSTextFieldCell"; title = "Listen for"; ObjectID = "Vh8-06-U3K"; */ +"Vh8-06-U3K.title" = "Écouter pour"; + +/* Class = "NSButtonCell"; title = "Check for updates"; ObjectID = "Vi8-Ye-W28"; */ +"Vi8-Ye-W28.title" = "Vérifier les mis à jour"; + +/* Class = "NSMenuItem"; title = "Both Brightness & Volume"; ObjectID = "Vr4-xb-B4o"; */ +"Vr4-xb-B4o.title" = "Luminosité & Volume"; + +/* Class = "NSButtonCell"; title = "Start when plugged to an external monitor"; ObjectID = "WJp-aA-2Af"; */ +"WJp-aA-2Af.title" = "Lancer quand branché à un écran externe"; + +/* Class = "NSTextFieldCell"; title = "Text Cell"; ObjectID = "Xje-0J-NNJ"; */ +"Xje-0J-NNJ.title" = "Text Cell"; + +/* Class = "NSTextFieldCell"; title = "Text Cell"; ObjectID = "as0-t3-Aub"; */ +"as0-t3-Aub.title" = "Text Cell"; + +/* Class = "NSTextFieldCell"; title = "Table View Cell"; ObjectID = "cUg-j2-8gt"; */ +"cUg-j2-8gt.title" = "Table View Cell"; + +/* Class = "NSMenuItem"; title = "Function Keys (F1, F2...)"; ObjectID = "dQm-ww-uhA"; */ +"dQm-ww-uhA.title" = "Touches de fonctions (F1, F2...)"; + +/* Class = "NSTableColumn"; headerCell.title = "Display Id"; ObjectID = "dgp-q7-cBK"; */ +"dgp-q7-cBK.headerCell.title" = "Identifiant"; + +/* Class = "NSMenuItem"; title = "Brightness only"; ObjectID = "hjz-0c-rvK"; */ +"hjz-0c-rvK.title" = "Luminosité uniquement"; + +/* Class = "NSTextFieldCell"; title = "Table View Cell"; ObjectID = "ldv-hu-9Hl"; */ +"ldv-hu-9Hl.title" = "Table View Cell"; + +/* Class = "NSTextFieldCell"; title = "General"; ObjectID = "ocE-Cc-2bi"; */ +"ocE-Cc-2bi.title" = "Général"; diff --git a/MonitorControl/fr.lproj/MainMenu.strings b/MonitorControl/fr.lproj/MainMenu.strings index 41b2039..e59c734 100644 --- a/MonitorControl/fr.lproj/MainMenu.strings +++ b/MonitorControl/fr.lproj/MainMenu.strings @@ -1,3 +1,6 @@ /* Class = "NSMenuItem"; title = "Quit"; ObjectID = "JTa-2I-AsI"; */ "JTa-2I-AsI.title" = "Quitter"; + +/* Class = "NSMenuItem"; title = "Preferences..."; ObjectID = "SOS-eZ-uU5"; */ +"SOS-eZ-uU5.title" = "Préférences..."; diff --git a/Podfile b/Podfile index f9f0e86..4c88f13 100644 --- a/Podfile +++ b/Podfile @@ -1,10 +1,11 @@ # Podfile -plateform :osx, '10.11' +platform :osx, '10.11' target 'MonitorControl' do - use_frameworks! + use_frameworks! -pod 'MediaKeyTap', :git => 'https://github.com/the0neyouseek/MediaKeyTap.git' + pod 'MediaKeyTap', :git => 'https://github.com/the0neyouseek/MediaKeyTap.git' + pod 'MASPreferences' end diff --git a/Podfile.lock b/Podfile.lock index 162f63b..c5291fe 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -1,12 +1,24 @@ PODS: - - MediaKeyTap (1.0.0) + - MASPreferences (1.3) + - MediaKeyTap (2.1.0) DEPENDENCIES: - - MediaKeyTap + - MASPreferences + - MediaKeyTap (from `https://github.com/the0neyouseek/MediaKeyTap.git`) + +EXTERNAL SOURCES: + MediaKeyTap: + :git: https://github.com/the0neyouseek/MediaKeyTap.git + +CHECKOUT OPTIONS: + MediaKeyTap: + :commit: d02f865ea962d5811375ddd047525baf409fb2b0 + :git: https://github.com/the0neyouseek/MediaKeyTap.git SPEC CHECKSUMS: - MediaKeyTap: 92764246d2ce8bf4446c2457e8b180e0b88926a1 + MASPreferences: c08b8622dd17b47da87669e741efd7c92e970e8c + MediaKeyTap: b652877e9ae2d52ca4f5310fa5152945ad3f0798 -PODFILE CHECKSUM: 11c0e07cdb4651a81ff3269f5d50664df18716d4 +PODFILE CHECKSUM: 3404918793c88a6c1f56a30e54cf0d9afb0cfffb COCOAPODS: 1.3.1