├── .gitignore ├── .travis.yml ├── LICENSE ├── MacMediaKeyForwarder.xcodeproj ├── project.pbxproj └── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ └── IDEWorkspaceChecks.plist ├── MacMediaKeyForwarder ├── AppDelegate.h ├── AppDelegate.m ├── Assets.xcassets │ ├── AppIcon.appiconset │ │ ├── Contents.json │ │ ├── appicon-1.png │ │ ├── appicon.png │ │ └── appicon2x.png │ └── Contents.json ├── Base.lproj │ └── MainMenu.xib ├── Frameworks │ └── GBLaunchAtLogin │ │ ├── GBLaunchAtLogin.h │ │ ├── GBLaunchAtLogin.m │ │ ├── LICENSE │ │ └── README.md ├── Info.plist ├── Spotify.h ├── appicon.png ├── appicon.pxm ├── da.lproj │ └── Localizable.strings ├── de.lproj │ └── Localizable.strings ├── en.lproj │ └── Localizable.strings ├── es.lproj │ └── Localizable.strings ├── fi.lproj │ └── Localizable.strings ├── fr.lproj │ └── Localizable.strings ├── hu.lproj │ └── Localizable.strings ├── iTunes.h ├── icon.png ├── icon.pxm ├── icon@2x.png ├── ja.lproj │ └── Localizable.strings ├── ko.lproj │ └── Localizable.strings ├── main.m ├── manualtest.txt ├── nl.lproj │ └── Localizable.strings ├── pl.lproj │ └── Localizable.strings ├── ru.lproj │ └── Localizable.strings └── zh-Hant.lproj │ └── Localizable.strings ├── README.md ├── security_a.png └── security_b.png /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 4 | 5 | ## Build generated 6 | build/ 7 | DerivedData/ 8 | 9 | ## Various settings 10 | *.pbxuser 11 | !default.pbxuser 12 | *.mode1v3 13 | !default.mode1v3 14 | *.mode2v3 15 | !default.mode2v3 16 | *.perspectivev3 17 | !default.perspectivev3 18 | xcuserdata/ 19 | 20 | ## Other 21 | *.moved-aside 22 | *.xccheckout 23 | *.xcscmblueprint 24 | 25 | ## Obj-C/Swift specific 26 | *.hmap 27 | *.ipa 28 | *.dSYM.zip 29 | *.dSYM 30 | 31 | # CocoaPods 32 | # 33 | # We recommend against adding the Pods directory to your .gitignore. However 34 | # you should judge for yourself, the pros and cons are mentioned at: 35 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 36 | # 37 | # Pods/ 38 | 39 | # Carthage 40 | # 41 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 42 | # Carthage/Checkouts 43 | 44 | Carthage/Build 45 | 46 | # fastlane 47 | # 48 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 49 | # screenshots whenever they are needed. 50 | # For more information about the recommended setup visit: 51 | # https://docs.fastlane.tools/best-practices/source-control/#source-control 52 | 53 | fastlane/report.xml 54 | fastlane/Preview.html 55 | fastlane/screenshots 56 | fastlane/test_output 57 | 58 | # Code Injection 59 | # 60 | # After new code Injection tools there's a generated folder /iOSInjectionProject 61 | # https://github.com/johnno1962/injectionforxcode 62 | 63 | iOSInjectionProject/ 64 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | branches: 2 | only: 3 | - master 4 | 5 | language: objective-c 6 | osx_image: xcode11 7 | 8 | script: 9 | - xcodebuild -project MacMediaKeyForwarder.xcodeproj -scheme "MacMediaKeyForwarder" build 10 | 11 | after_success: 12 | - bash <(curl -s https://codecov.io/bash) -J 'MacMediaKeyForwarder' 13 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | This is free and unencumbered software released into the public domain. 2 | 3 | Anyone is free to copy, modify, publish, use, compile, sell, or 4 | distribute this software, either in source code form or as a compiled 5 | binary, for any purpose, commercial or non-commercial, and by any 6 | means. 7 | 8 | In jurisdictions that recognize copyright laws, the author or authors 9 | of this software dedicate any and all copyright interest in the 10 | software to the public domain. We make this dedication for the benefit 11 | of the public at large and to the detriment of our heirs and 12 | successors. We intend this dedication to be an overt act of 13 | relinquishment in perpetuity of all present and future rights to this 14 | software under copyright law. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 20 | OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | For more information, please refer to 25 | -------------------------------------------------------------------------------- /MacMediaKeyForwarder.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 3333F8972198687500816A9F /* GBLaunchAtLogin.m in Sources */ = {isa = PBXBuildFile; fileRef = 3333F8942198687500816A9F /* GBLaunchAtLogin.m */; }; 11 | 336F744D1E07E136009BCC1B /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 336F744C1E07E136009BCC1B /* AppDelegate.m */; }; 12 | 336F74501E07E136009BCC1B /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 336F744F1E07E136009BCC1B /* main.m */; }; 13 | 336F74521E07E136009BCC1B /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 336F74511E07E136009BCC1B /* Assets.xcassets */; }; 14 | 336F74551E07E136009BCC1B /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 336F74531E07E136009BCC1B /* MainMenu.xib */; }; 15 | 336F74651E07E4F6009BCC1B /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 336F74641E07E4F6009BCC1B /* CoreAudio.framework */; }; 16 | 33CD48BF1F866DB7000C454F /* ScriptingBridge.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 33CD48BE1F866DB7000C454F /* ScriptingBridge.framework */; }; 17 | 33CD48CB1F867394000C454F /* icon.png in Resources */ = {isa = PBXBuildFile; fileRef = 33CD48C71F8671B6000C454F /* icon.png */; }; 18 | 33CD48CC1F867408000C454F /* icon@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 33CD48C91F86724F000C454F /* icon@2x.png */; }; 19 | 33E2CC3E21B1361E002F8094 /* CoreServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 33E2CC3D21B1361E002F8094 /* CoreServices.framework */; }; 20 | A5999C4C1FF3BB89009905E1 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = A5999C4E1FF3BB89009905E1 /* Localizable.strings */; }; 21 | AA3E49F621AAA0C500EEA78B /* appicon.png in Resources */ = {isa = PBXBuildFile; fileRef = AA3E49F521AAA0C500EEA78B /* appicon.png */; }; 22 | /* End PBXBuildFile section */ 23 | 24 | /* Begin PBXFileReference section */ 25 | 112AF55920263497006937BF /* de */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = de; path = de.lproj/Localizable.strings; sourceTree = ""; }; 26 | 2C9625F520295D9F00F0C47E /* es */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = es; path = es.lproj/Localizable.strings; sourceTree = ""; }; 27 | 330630112313ED7500ACFBFE /* ja */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ja; path = ja.lproj/Localizable.strings; sourceTree = ""; }; 28 | 330630122313ED8100ACFBFE /* fi */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = fi; path = fi.lproj/Localizable.strings; sourceTree = ""; }; 29 | 330630132313F6D400ACFBFE /* pl */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = pl; path = pl.lproj/Localizable.strings; sourceTree = ""; }; 30 | 330630142313F6DE00ACFBFE /* nl */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = nl; path = nl.lproj/Localizable.strings; sourceTree = ""; }; 31 | 3319A9E81E085353005DB79C /* LICENSE */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = LICENSE; sourceTree = SOURCE_ROOT; }; 32 | 3319A9E91E085353005DB79C /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = SOURCE_ROOT; }; 33 | 3333F8922198687500816A9F /* GBLaunchAtLogin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GBLaunchAtLogin.h; sourceTree = ""; }; 34 | 3333F8932198687500816A9F /* LICENSE */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = LICENSE; sourceTree = ""; }; 35 | 3333F8942198687500816A9F /* GBLaunchAtLogin.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GBLaunchAtLogin.m; sourceTree = ""; }; 36 | 3333F8952198687500816A9F /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = ""; }; 37 | 336F74481E07E136009BCC1B /* MacMediaKeyForwarder.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = MacMediaKeyForwarder.app; sourceTree = BUILT_PRODUCTS_DIR; }; 38 | 336F744B1E07E136009BCC1B /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 39 | 336F744C1E07E136009BCC1B /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 40 | 336F744F1E07E136009BCC1B /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 41 | 336F74511E07E136009BCC1B /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 42 | 336F74541E07E136009BCC1B /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = ""; }; 43 | 336F74561E07E136009BCC1B /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 44 | 336F74641E07E4F6009BCC1B /* CoreAudio.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreAudio.framework; path = System/Library/Frameworks/CoreAudio.framework; sourceTree = SDKROOT; }; 45 | 337268BF1F8BA311007284E3 /* Spotify.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Spotify.h; sourceTree = ""; }; 46 | 338A08AF2028840D001F1ED3 /* manualtest.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = manualtest.txt; sourceTree = ""; }; 47 | 3397086D21EB6B7B009F3857 /* hu */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = hu; path = hu.lproj/Localizable.strings; sourceTree = ""; }; 48 | 3397086E21EB6B8F009F3857 /* ru */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ru; path = ru.lproj/Localizable.strings; sourceTree = ""; }; 49 | 3397086F21EB6B9C009F3857 /* da */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = da; path = da.lproj/Localizable.strings; sourceTree = ""; }; 50 | 33B952841FD6E8C5003EE4CD /* .travis.yml */ = {isa = PBXFileReference; lastKnownFileType = text; path = .travis.yml; sourceTree = SOURCE_ROOT; }; 51 | 33CD48BE1F866DB7000C454F /* ScriptingBridge.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ScriptingBridge.framework; path = System/Library/Frameworks/ScriptingBridge.framework; sourceTree = SDKROOT; }; 52 | 33CD48C11F866DC6000C454F /* iTunes.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = iTunes.h; sourceTree = ""; }; 53 | 33CD48C71F8671B6000C454F /* icon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = icon.png; sourceTree = ""; }; 54 | 33CD48C91F86724F000C454F /* icon@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "icon@2x.png"; sourceTree = ""; }; 55 | 33E2CC3D21B1361E002F8094 /* CoreServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreServices.framework; path = System/Library/Frameworks/CoreServices.framework; sourceTree = SDKROOT; }; 56 | 84B350D923526D6100255450 /* fr */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = fr; path = fr.lproj/Localizable.strings; sourceTree = ""; }; 57 | A523261E2887DBBC001EA9B4 /* zh-Hant */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hant"; path = "zh-Hant.lproj/Localizable.strings"; sourceTree = ""; }; 58 | A5999C4D1FF3BB89009905E1 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Localizable.strings; sourceTree = ""; }; 59 | A5999C4F1FF3BB98009905E1 /* ko */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ko; path = ko.lproj/Localizable.strings; sourceTree = ""; }; 60 | AA3E49F521AAA0C500EEA78B /* appicon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = appicon.png; sourceTree = ""; }; 61 | /* End PBXFileReference section */ 62 | 63 | /* Begin PBXFrameworksBuildPhase section */ 64 | 336F74451E07E136009BCC1B /* Frameworks */ = { 65 | isa = PBXFrameworksBuildPhase; 66 | buildActionMask = 2147483647; 67 | files = ( 68 | 33E2CC3E21B1361E002F8094 /* CoreServices.framework in Frameworks */, 69 | 33CD48BF1F866DB7000C454F /* ScriptingBridge.framework in Frameworks */, 70 | 336F74651E07E4F6009BCC1B /* CoreAudio.framework in Frameworks */, 71 | ); 72 | runOnlyForDeploymentPostprocessing = 0; 73 | }; 74 | /* End PBXFrameworksBuildPhase section */ 75 | 76 | /* Begin PBXGroup section */ 77 | 3333F8912198687500816A9F /* GBLaunchAtLogin */ = { 78 | isa = PBXGroup; 79 | children = ( 80 | 3333F8922198687500816A9F /* GBLaunchAtLogin.h */, 81 | 3333F8932198687500816A9F /* LICENSE */, 82 | 3333F8942198687500816A9F /* GBLaunchAtLogin.m */, 83 | 3333F8952198687500816A9F /* README.md */, 84 | ); 85 | name = GBLaunchAtLogin; 86 | path = MacMediaKeyForwarder/Frameworks/GBLaunchAtLogin; 87 | sourceTree = ""; 88 | }; 89 | 336F743F1E07E136009BCC1B = { 90 | isa = PBXGroup; 91 | children = ( 92 | 336F744A1E07E136009BCC1B /* MacMediaKeyForwarder */, 93 | 336F74491E07E136009BCC1B /* Products */, 94 | 336F74631E07E4F6009BCC1B /* Frameworks */, 95 | ); 96 | sourceTree = ""; 97 | }; 98 | 336F74491E07E136009BCC1B /* Products */ = { 99 | isa = PBXGroup; 100 | children = ( 101 | 336F74481E07E136009BCC1B /* MacMediaKeyForwarder.app */, 102 | ); 103 | name = Products; 104 | sourceTree = ""; 105 | }; 106 | 336F744A1E07E136009BCC1B /* MacMediaKeyForwarder */ = { 107 | isa = PBXGroup; 108 | children = ( 109 | 33CD48C11F866DC6000C454F /* iTunes.h */, 110 | 337268BF1F8BA311007284E3 /* Spotify.h */, 111 | 336F744B1E07E136009BCC1B /* AppDelegate.h */, 112 | 336F744C1E07E136009BCC1B /* AppDelegate.m */, 113 | 336F744E1E07E136009BCC1B /* Supporting Files */, 114 | ); 115 | path = MacMediaKeyForwarder; 116 | sourceTree = ""; 117 | }; 118 | 336F744E1E07E136009BCC1B /* Supporting Files */ = { 119 | isa = PBXGroup; 120 | children = ( 121 | 33B952841FD6E8C5003EE4CD /* .travis.yml */, 122 | AA3E49F521AAA0C500EEA78B /* appicon.png */, 123 | 33CD48C71F8671B6000C454F /* icon.png */, 124 | 33CD48C91F86724F000C454F /* icon@2x.png */, 125 | 336F74511E07E136009BCC1B /* Assets.xcassets */, 126 | 336F74531E07E136009BCC1B /* MainMenu.xib */, 127 | 336F74561E07E136009BCC1B /* Info.plist */, 128 | 3319A9E81E085353005DB79C /* LICENSE */, 129 | 3319A9E91E085353005DB79C /* README.md */, 130 | 338A08AF2028840D001F1ED3 /* manualtest.txt */, 131 | 336F744F1E07E136009BCC1B /* main.m */, 132 | A5999C4E1FF3BB89009905E1 /* Localizable.strings */, 133 | ); 134 | name = "Supporting Files"; 135 | sourceTree = ""; 136 | }; 137 | 336F74631E07E4F6009BCC1B /* Frameworks */ = { 138 | isa = PBXGroup; 139 | children = ( 140 | 33E2CC3D21B1361E002F8094 /* CoreServices.framework */, 141 | 3333F8912198687500816A9F /* GBLaunchAtLogin */, 142 | 33CD48BE1F866DB7000C454F /* ScriptingBridge.framework */, 143 | 336F74641E07E4F6009BCC1B /* CoreAudio.framework */, 144 | ); 145 | name = Frameworks; 146 | sourceTree = ""; 147 | }; 148 | /* End PBXGroup section */ 149 | 150 | /* Begin PBXNativeTarget section */ 151 | 336F74471E07E136009BCC1B /* MacMediaKeyForwarder */ = { 152 | isa = PBXNativeTarget; 153 | buildConfigurationList = 336F74591E07E136009BCC1B /* Build configuration list for PBXNativeTarget "MacMediaKeyForwarder" */; 154 | buildPhases = ( 155 | 336F74441E07E136009BCC1B /* Sources */, 156 | 336F74451E07E136009BCC1B /* Frameworks */, 157 | 336F74461E07E136009BCC1B /* Resources */, 158 | ); 159 | buildRules = ( 160 | ); 161 | dependencies = ( 162 | ); 163 | name = MacMediaKeyForwarder; 164 | productName = "High Sierra Media Key Enabler"; 165 | productReference = 336F74481E07E136009BCC1B /* MacMediaKeyForwarder.app */; 166 | productType = "com.apple.product-type.application"; 167 | }; 168 | /* End PBXNativeTarget section */ 169 | 170 | /* Begin PBXProject section */ 171 | 336F74401E07E136009BCC1B /* Project object */ = { 172 | isa = PBXProject; 173 | attributes = { 174 | LastUpgradeCheck = 1010; 175 | ORGANIZATIONNAME = "Milan Toth"; 176 | TargetAttributes = { 177 | 336F74471E07E136009BCC1B = { 178 | CreatedOnToolsVersion = 8.2; 179 | ProvisioningStyle = Manual; 180 | SystemCapabilities = { 181 | com.apple.Sandbox = { 182 | enabled = 0; 183 | }; 184 | }; 185 | }; 186 | }; 187 | }; 188 | buildConfigurationList = 336F74431E07E136009BCC1B /* Build configuration list for PBXProject "MacMediaKeyForwarder" */; 189 | compatibilityVersion = "Xcode 3.2"; 190 | developmentRegion = English; 191 | hasScannedForEncodings = 0; 192 | knownRegions = ( 193 | English, 194 | en, 195 | Base, 196 | ko, 197 | de, 198 | es, 199 | hu, 200 | ru, 201 | da, 202 | ja, 203 | fi, 204 | pl, 205 | nl, 206 | fr, 207 | "zh-Hant", 208 | ); 209 | mainGroup = 336F743F1E07E136009BCC1B; 210 | productRefGroup = 336F74491E07E136009BCC1B /* Products */; 211 | projectDirPath = ""; 212 | projectRoot = ""; 213 | targets = ( 214 | 336F74471E07E136009BCC1B /* MacMediaKeyForwarder */, 215 | ); 216 | }; 217 | /* End PBXProject section */ 218 | 219 | /* Begin PBXResourcesBuildPhase section */ 220 | 336F74461E07E136009BCC1B /* Resources */ = { 221 | isa = PBXResourcesBuildPhase; 222 | buildActionMask = 2147483647; 223 | files = ( 224 | 336F74521E07E136009BCC1B /* Assets.xcassets in Resources */, 225 | A5999C4C1FF3BB89009905E1 /* Localizable.strings in Resources */, 226 | 33CD48CC1F867408000C454F /* icon@2x.png in Resources */, 227 | 336F74551E07E136009BCC1B /* MainMenu.xib in Resources */, 228 | AA3E49F621AAA0C500EEA78B /* appicon.png in Resources */, 229 | 33CD48CB1F867394000C454F /* icon.png in Resources */, 230 | ); 231 | runOnlyForDeploymentPostprocessing = 0; 232 | }; 233 | /* End PBXResourcesBuildPhase section */ 234 | 235 | /* Begin PBXSourcesBuildPhase section */ 236 | 336F74441E07E136009BCC1B /* Sources */ = { 237 | isa = PBXSourcesBuildPhase; 238 | buildActionMask = 2147483647; 239 | files = ( 240 | 3333F8972198687500816A9F /* GBLaunchAtLogin.m in Sources */, 241 | 336F74501E07E136009BCC1B /* main.m in Sources */, 242 | 336F744D1E07E136009BCC1B /* AppDelegate.m in Sources */, 243 | ); 244 | runOnlyForDeploymentPostprocessing = 0; 245 | }; 246 | /* End PBXSourcesBuildPhase section */ 247 | 248 | /* Begin PBXVariantGroup section */ 249 | 336F74531E07E136009BCC1B /* MainMenu.xib */ = { 250 | isa = PBXVariantGroup; 251 | children = ( 252 | 336F74541E07E136009BCC1B /* Base */, 253 | ); 254 | name = MainMenu.xib; 255 | sourceTree = ""; 256 | }; 257 | A5999C4E1FF3BB89009905E1 /* Localizable.strings */ = { 258 | isa = PBXVariantGroup; 259 | children = ( 260 | A5999C4D1FF3BB89009905E1 /* en */, 261 | A5999C4F1FF3BB98009905E1 /* ko */, 262 | 112AF55920263497006937BF /* de */, 263 | 2C9625F520295D9F00F0C47E /* es */, 264 | 3397086D21EB6B7B009F3857 /* hu */, 265 | 3397086E21EB6B8F009F3857 /* ru */, 266 | 3397086F21EB6B9C009F3857 /* da */, 267 | 330630112313ED7500ACFBFE /* ja */, 268 | 330630122313ED8100ACFBFE /* fi */, 269 | 330630132313F6D400ACFBFE /* pl */, 270 | 330630142313F6DE00ACFBFE /* nl */, 271 | 84B350D923526D6100255450 /* fr */, 272 | A523261E2887DBBC001EA9B4 /* zh-Hant */, 273 | ); 274 | name = Localizable.strings; 275 | sourceTree = ""; 276 | }; 277 | /* End PBXVariantGroup section */ 278 | 279 | /* Begin XCBuildConfiguration section */ 280 | 336F74571E07E136009BCC1B /* Debug */ = { 281 | isa = XCBuildConfiguration; 282 | buildSettings = { 283 | ALWAYS_SEARCH_USER_PATHS = NO; 284 | CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; 285 | CLANG_ANALYZER_NONNULL = YES; 286 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 287 | CLANG_CXX_LIBRARY = "libc++"; 288 | CLANG_ENABLE_MODULES = YES; 289 | CLANG_ENABLE_OBJC_ARC = YES; 290 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 291 | CLANG_WARN_BOOL_CONVERSION = YES; 292 | CLANG_WARN_COMMA = YES; 293 | CLANG_WARN_CONSTANT_CONVERSION = YES; 294 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 295 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 296 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 297 | CLANG_WARN_EMPTY_BODY = YES; 298 | CLANG_WARN_ENUM_CONVERSION = YES; 299 | CLANG_WARN_INFINITE_RECURSION = YES; 300 | CLANG_WARN_INT_CONVERSION = YES; 301 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 302 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 303 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 304 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 305 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 306 | CLANG_WARN_STRICT_PROTOTYPES = YES; 307 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 308 | CLANG_WARN_UNREACHABLE_CODE = YES; 309 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 310 | CODE_SIGN_IDENTITY = "-"; 311 | COPY_PHASE_STRIP = NO; 312 | DEBUG_INFORMATION_FORMAT = dwarf; 313 | ENABLE_STRICT_OBJC_MSGSEND = YES; 314 | ENABLE_TESTABILITY = YES; 315 | GCC_C_LANGUAGE_STANDARD = gnu99; 316 | GCC_DYNAMIC_NO_PIC = NO; 317 | GCC_NO_COMMON_BLOCKS = YES; 318 | GCC_OPTIMIZATION_LEVEL = 0; 319 | GCC_PREPROCESSOR_DEFINITIONS = ( 320 | "DEBUG=1", 321 | "$(inherited)", 322 | ); 323 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 324 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 325 | GCC_WARN_UNDECLARED_SELECTOR = YES; 326 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 327 | GCC_WARN_UNUSED_FUNCTION = YES; 328 | GCC_WARN_UNUSED_VARIABLE = YES; 329 | MACOSX_DEPLOYMENT_TARGET = 10.12; 330 | MTL_ENABLE_DEBUG_INFO = YES; 331 | ONLY_ACTIVE_ARCH = YES; 332 | SDKROOT = macosx; 333 | }; 334 | name = Debug; 335 | }; 336 | 336F74581E07E136009BCC1B /* Release */ = { 337 | isa = XCBuildConfiguration; 338 | buildSettings = { 339 | ALWAYS_SEARCH_USER_PATHS = NO; 340 | CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; 341 | CLANG_ANALYZER_NONNULL = YES; 342 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 343 | CLANG_CXX_LIBRARY = "libc++"; 344 | CLANG_ENABLE_MODULES = YES; 345 | CLANG_ENABLE_OBJC_ARC = YES; 346 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 347 | CLANG_WARN_BOOL_CONVERSION = YES; 348 | CLANG_WARN_COMMA = YES; 349 | CLANG_WARN_CONSTANT_CONVERSION = YES; 350 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 351 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 352 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 353 | CLANG_WARN_EMPTY_BODY = YES; 354 | CLANG_WARN_ENUM_CONVERSION = YES; 355 | CLANG_WARN_INFINITE_RECURSION = YES; 356 | CLANG_WARN_INT_CONVERSION = YES; 357 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 358 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 359 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 360 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 361 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 362 | CLANG_WARN_STRICT_PROTOTYPES = YES; 363 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 364 | CLANG_WARN_UNREACHABLE_CODE = YES; 365 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 366 | CODE_SIGN_IDENTITY = "-"; 367 | COPY_PHASE_STRIP = NO; 368 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 369 | ENABLE_NS_ASSERTIONS = NO; 370 | ENABLE_STRICT_OBJC_MSGSEND = YES; 371 | GCC_C_LANGUAGE_STANDARD = gnu99; 372 | GCC_NO_COMMON_BLOCKS = YES; 373 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 374 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 375 | GCC_WARN_UNDECLARED_SELECTOR = YES; 376 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 377 | GCC_WARN_UNUSED_FUNCTION = YES; 378 | GCC_WARN_UNUSED_VARIABLE = YES; 379 | MACOSX_DEPLOYMENT_TARGET = 10.12; 380 | MTL_ENABLE_DEBUG_INFO = NO; 381 | SDKROOT = macosx; 382 | }; 383 | name = Release; 384 | }; 385 | 336F745A1E07E136009BCC1B /* Debug */ = { 386 | isa = XCBuildConfiguration; 387 | buildSettings = { 388 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 389 | CLANG_ENABLE_OBJC_ARC = YES; 390 | CODE_SIGN_IDENTITY = "-"; 391 | CODE_SIGN_STYLE = Manual; 392 | COMBINE_HIDPI_IMAGES = YES; 393 | DEVELOPMENT_TEAM = ""; 394 | INFOPLIST_FILE = MacMediaKeyForwarder/Info.plist; 395 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; 396 | MACOSX_DEPLOYMENT_TARGET = 10.12; 397 | MARKETING_VERSION = 3.1; 398 | PRODUCT_BUNDLE_IDENTIFIER = com.milgra.hsmke; 399 | PRODUCT_NAME = "$(TARGET_NAME)"; 400 | PROVISIONING_PROFILE_SPECIFIER = ""; 401 | }; 402 | name = Debug; 403 | }; 404 | 336F745B1E07E136009BCC1B /* Release */ = { 405 | isa = XCBuildConfiguration; 406 | buildSettings = { 407 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 408 | CLANG_ENABLE_OBJC_ARC = YES; 409 | CODE_SIGN_IDENTITY = "-"; 410 | CODE_SIGN_STYLE = Manual; 411 | COMBINE_HIDPI_IMAGES = YES; 412 | DEVELOPMENT_TEAM = ""; 413 | INFOPLIST_FILE = MacMediaKeyForwarder/Info.plist; 414 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; 415 | MACOSX_DEPLOYMENT_TARGET = 10.12; 416 | MARKETING_VERSION = 3.1; 417 | PRODUCT_BUNDLE_IDENTIFIER = com.milgra.hsmke; 418 | PRODUCT_NAME = "$(TARGET_NAME)"; 419 | PROVISIONING_PROFILE_SPECIFIER = ""; 420 | }; 421 | name = Release; 422 | }; 423 | /* End XCBuildConfiguration section */ 424 | 425 | /* Begin XCConfigurationList section */ 426 | 336F74431E07E136009BCC1B /* Build configuration list for PBXProject "MacMediaKeyForwarder" */ = { 427 | isa = XCConfigurationList; 428 | buildConfigurations = ( 429 | 336F74571E07E136009BCC1B /* Debug */, 430 | 336F74581E07E136009BCC1B /* Release */, 431 | ); 432 | defaultConfigurationIsVisible = 0; 433 | defaultConfigurationName = Release; 434 | }; 435 | 336F74591E07E136009BCC1B /* Build configuration list for PBXNativeTarget "MacMediaKeyForwarder" */ = { 436 | isa = XCConfigurationList; 437 | buildConfigurations = ( 438 | 336F745A1E07E136009BCC1B /* Debug */, 439 | 336F745B1E07E136009BCC1B /* Release */, 440 | ); 441 | defaultConfigurationIsVisible = 0; 442 | defaultConfigurationName = Release; 443 | }; 444 | /* End XCConfigurationList section */ 445 | }; 446 | rootObject = 336F74401E07E136009BCC1B /* Project object */; 447 | } 448 | -------------------------------------------------------------------------------- /MacMediaKeyForwarder.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /MacMediaKeyForwarder.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /MacMediaKeyForwarder/AppDelegate.h: -------------------------------------------------------------------------------- 1 | 2 | #import 3 | 4 | @interface AppDelegate : NSObject 5 | 6 | @end 7 | 8 | -------------------------------------------------------------------------------- /MacMediaKeyForwarder/AppDelegate.m: -------------------------------------------------------------------------------- 1 | #import "AppDelegate.h" 2 | #import "GBLaunchAtLogin.h" 3 | #import "iTunes.h" 4 | #import "Spotify.h" 5 | #import 6 | #import 7 | 8 | typedef NS_ENUM(NSInteger, MediaKeysPrioritize) 9 | { 10 | // Normal behavior (without priority; send events to iTunes and Spotify if both are open) 11 | MediaKeysPrioritizeNone, 12 | // If both apps are open, prioritize iTunes over Spotify 13 | MediaKeysPrioritizeITunes, 14 | // If both apps are open, prioritize Spotify over iTunes 15 | MediaKeysPrioritizeSpotify 16 | }; 17 | 18 | typedef NS_ENUM(NSInteger, PauseState) 19 | { 20 | // pause app 21 | PauseStateNone, 22 | // pause app 23 | PauseStatePause, 24 | // pause app automatically when iTunes and Spotify is not running 25 | PauseStateAutomatic, 26 | }; 27 | 28 | typedef NS_ENUM(NSInteger, KeyHoldState) 29 | { 30 | KeyHoldStateNone, 31 | KeyHoldStateWaiting, 32 | KeyHoldStateHolding 33 | }; 34 | 35 | static NSString *kUserDefaultsPriorityOptionKey = @"user_priority_option"; 36 | static NSString *kUserDefaultsPauseOptionKey = @"user_pause_option"; 37 | static NSString *kUserDefaultsHideFromMenuBarOptionKey = @"user_hide_from_menu_bar_option"; 38 | 39 | PauseState pauseState; 40 | KeyHoldState keyHoldStatus; 41 | MediaKeysPrioritize mediaKeysPriority; 42 | 43 | @interface AppDelegate () 44 | { 45 | NSStatusItem* statusItem; 46 | CFMachPortRef eventPort; 47 | CFRunLoopSourceRef eventPortSource; 48 | NSMutableArray *priorityOptionItems; 49 | NSMutableArray *pauseOptionItems; 50 | NSMenuItem *startupItem; 51 | NSMenuItem *hideFromMenuBarItem; 52 | } 53 | 54 | @end 55 | 56 | @implementation AppDelegate 57 | 58 | static CGEventRef tapEventCallback(CGEventTapProxy proxy, CGEventType type, CGEventRef event, void *refcon) 59 | { 60 | @autoreleasepool 61 | { 62 | AppDelegate *self = (__bridge id)refcon; 63 | 64 | if(type == kCGEventTapDisabledByTimeout) 65 | { 66 | CGEventTapEnable(self->eventPort, TRUE); 67 | return event; 68 | } 69 | 70 | if(type == kCGEventTapDisabledByUserInput) 71 | { 72 | return event; 73 | } 74 | 75 | if(type != NX_SYSDEFINED ) 76 | { 77 | return event; 78 | } 79 | 80 | NSEvent *nsEvent = nil; 81 | @try 82 | { 83 | nsEvent = [NSEvent eventWithCGEvent:event]; 84 | } 85 | @catch (NSException * e) 86 | { 87 | return event; 88 | } 89 | 90 | if([nsEvent subtype] != 8) 91 | { 92 | return event; 93 | } 94 | 95 | int keyCode = (([nsEvent data1] & 0xFFFF0000) >> 16); 96 | 97 | if (keyCode != NX_KEYTYPE_PLAY && 98 | keyCode != NX_KEYTYPE_FAST && 99 | keyCode != NX_KEYTYPE_REWIND && 100 | keyCode != NX_KEYTYPE_PREVIOUS && 101 | keyCode != NX_KEYTYPE_NEXT) 102 | { 103 | return event; 104 | } 105 | 106 | iTunesApplication *iTunes = [SBApplication applicationWithBundleIdentifier:[self iTunesBundleIdentifier]]; 107 | SpotifyApplication *spotify = [SBApplication applicationWithBundleIdentifier:@"com.spotify.client"]; 108 | 109 | if ( pauseState == PauseStatePause ) 110 | { 111 | return event; 112 | } 113 | 114 | if ( pauseState == PauseStateAutomatic ) 115 | { 116 | if (![spotify isRunning ] && ![iTunes isRunning ] ) 117 | { 118 | return event; 119 | } 120 | } 121 | 122 | int keyFlags = ([nsEvent data1] & 0x0000FFFF); 123 | BOOL keyIsPressed = (((keyFlags & 0xFF00) >> 8)) == 0xA; 124 | 125 | if (keyIsPressed) 126 | { 127 | switch ( mediaKeysPriority ) 128 | { 129 | case MediaKeysPrioritizeITunes: 130 | { 131 | switch (keyCode) 132 | { 133 | case NX_KEYTYPE_PLAY: 134 | { 135 | [iTunes playpause]; 136 | break; 137 | } 138 | default: 139 | { 140 | if (keyHoldStatus == KeyHoldStateNone) 141 | { 142 | keyHoldStatus = KeyHoldStateWaiting; 143 | } 144 | else if (keyHoldStatus == KeyHoldStateWaiting) 145 | { 146 | keyHoldStatus = KeyHoldStateHolding; 147 | switch (keyCode) 148 | { 149 | case NX_KEYTYPE_NEXT: 150 | case NX_KEYTYPE_FAST: 151 | { 152 | [iTunes fastForward]; 153 | break; 154 | } 155 | case NX_KEYTYPE_PREVIOUS: 156 | case NX_KEYTYPE_REWIND: 157 | { 158 | [iTunes rewind]; 159 | break; 160 | } 161 | } 162 | } 163 | } 164 | } 165 | break; 166 | } 167 | case MediaKeysPrioritizeSpotify: 168 | { 169 | switch (keyCode) 170 | { 171 | case NX_KEYTYPE_PLAY: 172 | { 173 | [spotify playpause]; 174 | break; 175 | } 176 | case NX_KEYTYPE_NEXT: 177 | case NX_KEYTYPE_FAST: 178 | { 179 | [spotify nextTrack]; 180 | break; 181 | }; 182 | case NX_KEYTYPE_PREVIOUS: 183 | case NX_KEYTYPE_REWIND: 184 | { 185 | [spotify previousTrack]; 186 | break; 187 | } 188 | } 189 | break; 190 | } 191 | case MediaKeysPrioritizeNone: 192 | { 193 | switch (keyCode) 194 | { 195 | case NX_KEYTYPE_PLAY: 196 | { 197 | if ( [spotify isRunning ] ) [spotify playpause]; 198 | if ( [iTunes isRunning ] ) [iTunes playpause]; 199 | break; 200 | } 201 | case NX_KEYTYPE_NEXT: 202 | case NX_KEYTYPE_FAST: 203 | { 204 | if ( [spotify isRunning ] ) [spotify nextTrack]; 205 | if ( [iTunes isRunning ] ) [iTunes nextTrack]; 206 | break; 207 | } 208 | case NX_KEYTYPE_PREVIOUS: 209 | case NX_KEYTYPE_REWIND: 210 | { 211 | if ( [spotify isRunning ] ) [spotify previousTrack]; 212 | if ( [iTunes isRunning ] ) [iTunes backTrack]; 213 | break; 214 | } 215 | } 216 | break; 217 | } 218 | } 219 | } 220 | else 221 | { 222 | switch (keyHoldStatus) 223 | { 224 | case KeyHoldStateWaiting: 225 | { 226 | if (mediaKeysPriority == MediaKeysPrioritizeITunes) 227 | { 228 | switch (keyCode) 229 | { 230 | case NX_KEYTYPE_NEXT: 231 | case NX_KEYTYPE_FAST: 232 | { 233 | [iTunes nextTrack]; 234 | break; 235 | } 236 | case NX_KEYTYPE_PREVIOUS: 237 | case NX_KEYTYPE_REWIND: 238 | { 239 | [iTunes backTrack]; 240 | break; 241 | } 242 | } 243 | } 244 | break; 245 | } 246 | case KeyHoldStateHolding: 247 | { 248 | // Stop fast forwarding / rewinding 249 | 250 | if (mediaKeysPriority == MediaKeysPrioritizeITunes) 251 | { 252 | [iTunes resume]; 253 | } 254 | break; 255 | } 256 | case KeyHoldStateNone: 257 | { 258 | break; 259 | } 260 | } 261 | keyHoldStatus = KeyHoldStateNone; 262 | } 263 | 264 | // stop propagation 265 | 266 | return NULL; 267 | } 268 | } 269 | 270 | - (NSString *)iTunesBundleIdentifier { 271 | if ( @available(macOS 10.15, *) ) 272 | { 273 | return @"com.apple.music"; 274 | } 275 | else 276 | { 277 | return @"com.apple.iTunes"; 278 | } 279 | } 280 | 281 | - (void)applicationDidBecomeActive:(NSNotification *)notification 282 | { 283 | 284 | } 285 | 286 | - ( void ) applicationDidFinishLaunching : ( NSNotification*) theNotification 287 | { 288 | // init containers 289 | 290 | priorityOptionItems = [[NSMutableArray alloc] init]; 291 | pauseOptionItems = [[NSMutableArray alloc] init]; 292 | 293 | // init states 294 | 295 | pauseState = PauseStateNone; 296 | keyHoldStatus = KeyHoldStateNone; 297 | mediaKeysPriority = MediaKeysPrioritizeNone; 298 | 299 | NSNumber *option = [[NSUserDefaults standardUserDefaults] objectForKey:kUserDefaultsPriorityOptionKey]; 300 | if ( option ) 301 | { 302 | mediaKeysPriority = [option integerValue]; 303 | } 304 | 305 | option = [[NSUserDefaults standardUserDefaults] objectForKey:kUserDefaultsPauseOptionKey]; 306 | if ( option ) 307 | { 308 | pauseState = [option integerValue]; 309 | } 310 | 311 | // Version string 312 | 313 | NSDictionary *bundleInfo = [[NSBundle mainBundle] infoDictionary]; 314 | NSString *versionString = [NSString stringWithFormat:@"Version %@ (build %@)", 315 | bundleInfo[@"CFBundleShortVersionString"], 316 | bundleInfo[@"CFBundleVersion"] ]; 317 | 318 | NSMenu *menu = [ [ NSMenu alloc ] init ]; 319 | [ menu setDelegate : self ]; 320 | [ menu addItemWithTitle : versionString action : nil keyEquivalent : @"" ]; 321 | [ menu addItem : [ NSMenuItem separatorItem ] ]; // A thin grey line 322 | 323 | [pauseOptionItems addObject:[ menu addItemWithTitle: NSLocalizedString(@"Pause", @"Pause") action : @selector(manualPause) keyEquivalent : @"" ]]; 324 | [pauseOptionItems addObject:[ menu addItemWithTitle: NSLocalizedString(@"Pause if no player is running", @"Pause if no player is running") action : @selector(autoPause) keyEquivalent : @"" ]]; 325 | 326 | [ menu addItem : [ NSMenuItem separatorItem ] ]; // A thin grey line 327 | 328 | [priorityOptionItems addObject:[ menu addItemWithTitle: NSLocalizedString(@"Send events to both players", @"Send events to both players") action : @selector(prioritizeNone) keyEquivalent : @"" ]]; 329 | [priorityOptionItems addObject:[ menu addItemWithTitle: NSLocalizedString(@"Prioritize iTunes", @"Prioritize iTunes") action : @selector(prioritizeITunes) keyEquivalent : @"" ]]; 330 | [priorityOptionItems addObject:[ menu addItemWithTitle: NSLocalizedString(@"Prioritize Spotify", @"Prioritize Spotify") action : @selector(prioritizeSpotify) keyEquivalent : @"" ]]; 331 | 332 | [ menu addItem : [ NSMenuItem separatorItem ] ]; // A thin grey line 333 | 334 | startupItem = [ menu addItemWithTitle:NSLocalizedString(@"Open at login", @"Open at login") action:@selector(toggleStartupItem) keyEquivalent:@""]; 335 | hideFromMenuBarItem = [ menu addItemWithTitle:NSLocalizedString(@"Hide from menu bar", @"Hide from menu bar") action:@selector(hideFromMenuBar) keyEquivalent:@""]; 336 | [ menu addItem : [ NSMenuItem separatorItem ] ]; // A thin grey line 337 | 338 | [ menu addItem : [ NSMenuItem separatorItem ] ]; // A thin grey line 339 | 340 | [ menu addItemWithTitle : NSLocalizedString(@"Donate if you like the app", @"Donate if you like the app") action : @selector(support) keyEquivalent : @"" ]; 341 | [ menu addItemWithTitle : NSLocalizedString(@"Check for updates", @"Check for updates") action : @selector(update) keyEquivalent : @"" ]; 342 | [ menu addItemWithTitle : NSLocalizedString(@"Quit", @"Quit") action : @selector(terminate) keyEquivalent : @"" ]; 343 | 344 | NSImage* image = [ NSImage imageNamed : @"icon" ]; 345 | [ image setTemplate : YES ]; 346 | 347 | statusItem = [ [ NSStatusBar systemStatusBar ] statusItemWithLength : NSVariableStatusItemLength ]; 348 | [ statusItem setToolTip : @"Mac Media Key Forwarder" ]; 349 | [ statusItem setMenu : menu ]; 350 | [ statusItem setImage : image ]; 351 | [ statusItem setBehavior : NSStatusItemBehaviorRemovalAllowed ]; 352 | if ([self shouldHideFromMenuBar]) { 353 | [ statusItem setVisible : NO ]; 354 | } else { 355 | [ statusItem setVisible : YES ]; 356 | } 357 | 358 | [self updateStartupItemState]; 359 | [self updatePauseState]; 360 | [self updateOptionState]; 361 | 362 | eventPort = CGEventTapCreate( kCGSessionEventTap, kCGHeadInsertEventTap, kCGEventTapOptionDefault, CGEventMaskBit(NX_SYSDEFINED), tapEventCallback, (__bridge void * _Nullable)(self)); 363 | if ( eventPort == NULL ) 364 | { 365 | eventPort = CGEventTapCreate( kCGSessionEventTap, kCGHeadInsertEventTap, kCGEventTapOptionDefault, NX_SYSDEFINEDMASK, tapEventCallback, (__bridge void * _Nullable)(self)); 366 | } 367 | 368 | if ( eventPort != NULL ) 369 | { 370 | 371 | // Check if permission is granted to send AppleEvents to the running app target, and prompt if not set 372 | if ( @available(macOS 10.14, *) ) 373 | { 374 | 375 | iTunesApplication *iTunes = [SBApplication applicationWithBundleIdentifier:[self iTunesBundleIdentifier]]; 376 | SpotifyApplication *spotify = [SBApplication applicationWithBundleIdentifier:@"com.spotify.client"]; 377 | 378 | if ( spotify != nil ) 379 | { 380 | NSAppleEventDescriptor *targetAppEventDescriptor = [NSAppleEventDescriptor descriptorWithBundleIdentifier:@"com.spotify.client"]; 381 | AEDeterminePermissionToAutomateTarget([targetAppEventDescriptor aeDesc], typeWildCard, typeWildCard, true); 382 | } 383 | 384 | if ( iTunes != nil ) 385 | { 386 | NSAppleEventDescriptor *targetAppEventDescriptor = [NSAppleEventDescriptor descriptorWithBundleIdentifier:[self iTunesBundleIdentifier]]; 387 | AEDeterminePermissionToAutomateTarget([targetAppEventDescriptor aeDesc], typeWildCard, typeWildCard, true); 388 | } 389 | } 390 | 391 | eventPortSource = CFMachPortCreateRunLoopSource( kCFAllocatorSystemDefault, eventPort, 0 ); 392 | 393 | [self startEventSession]; 394 | 395 | } 396 | else 397 | { 398 | 399 | NSAlert *alert = [[NSAlert alloc] init]; 400 | [alert setMessageText:@"Error"]; 401 | [alert setInformativeText:@"Cannot start event listening. Please add Mac Media Key Forwarder to the \"Security & Privacy\" pane in System Preferences. Check \"Accessibility\" and \"Automation\" under the \"Privacy\" tab."]; 402 | [alert addButtonWithTitle:@"Ok"]; 403 | [alert runModal]; 404 | 405 | exit(0); 406 | 407 | } 408 | 409 | } 410 | 411 | - (BOOL)applicationShouldHandleReopen:(NSApplication *)theApplication hasVisibleWindows:(BOOL)flag 412 | { 413 | if ([self shouldHideFromMenuBar]) { 414 | [self setHideFromMenuBar:NO]; 415 | [statusItem setVisible: YES]; 416 | } 417 | 418 | return YES; 419 | } 420 | 421 | - ( void ) startEventSession 422 | { 423 | if (pauseState != PauseStatePause && !CFRunLoopContainsSource(CFRunLoopGetCurrent(), eventPortSource, kCFRunLoopCommonModes)) { 424 | CFRunLoopAddSource( CFRunLoopGetCurrent(), eventPortSource, kCFRunLoopCommonModes ); 425 | CFRunLoopRun(); 426 | } 427 | } 428 | 429 | - ( void ) stopEventSession 430 | { 431 | if (CFRunLoopContainsSource(CFRunLoopGetCurrent(), eventPortSource, kCFRunLoopCommonModes)) { 432 | CFRunLoopRemoveSource( CFRunLoopGetCurrent(), eventPortSource, kCFRunLoopCommonModes ); 433 | CFRunLoopStop(CFRunLoopGetCurrent()); 434 | } 435 | } 436 | 437 | - ( void ) terminate 438 | { 439 | [ NSApp terminate : nil ]; 440 | } 441 | 442 | - ( void ) support 443 | { 444 | [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString: @"https://paypal.me/milgra"]]; 445 | } 446 | 447 | - ( void ) update 448 | { 449 | [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString: @"http://milgra.com/mac-media-key-forwarder.html"]]; 450 | } 451 | 452 | 453 | #pragma mark - App priorization 454 | 455 | - (void)prioritizeNone 456 | { 457 | mediaKeysPriority = MediaKeysPrioritizeNone; 458 | [[NSUserDefaults standardUserDefaults] setObject:@(mediaKeysPriority) forKey:kUserDefaultsPriorityOptionKey]; 459 | [self updateOptionState]; 460 | } 461 | 462 | - (void)prioritizeITunes 463 | { 464 | mediaKeysPriority = MediaKeysPrioritizeITunes; 465 | [[NSUserDefaults standardUserDefaults] setObject:@(mediaKeysPriority) forKey:kUserDefaultsPriorityOptionKey]; 466 | [self updateOptionState]; 467 | } 468 | 469 | - (void)prioritizeSpotify 470 | { 471 | mediaKeysPriority = MediaKeysPrioritizeSpotify; 472 | [[NSUserDefaults standardUserDefaults] setObject:@(mediaKeysPriority) forKey:kUserDefaultsPriorityOptionKey]; 473 | [self updateOptionState]; 474 | } 475 | 476 | - (void)manualPause 477 | { 478 | if ( pauseState != PauseStatePause ) 479 | { 480 | pauseState = PauseStatePause; 481 | [self stopEventSession]; 482 | } 483 | else 484 | { 485 | pauseState = PauseStateNone; 486 | [self startEventSession]; 487 | } 488 | 489 | [[NSUserDefaults standardUserDefaults] setObject:@(pauseState) forKey:kUserDefaultsPauseOptionKey]; 490 | [self updatePauseState]; 491 | } 492 | 493 | - (void)autoPause 494 | { 495 | if ( pauseState != PauseStateAutomatic ) 496 | { 497 | pauseState = PauseStateAutomatic; 498 | } 499 | else 500 | { 501 | pauseState = PauseStateNone; 502 | } 503 | [[NSUserDefaults standardUserDefaults] setObject:@(pauseState) forKey:kUserDefaultsPauseOptionKey]; 504 | [self updatePauseState]; 505 | 506 | [self startEventSession]; 507 | } 508 | 509 | #pragma mark - Startup Item 510 | - (void)toggleStartupItem { 511 | if ( [GBLaunchAtLogin isLoginItem] ) { 512 | [GBLaunchAtLogin removeAppFromLoginItems]; 513 | } 514 | else { 515 | [GBLaunchAtLogin addAppAsLoginItem]; 516 | } 517 | 518 | [self updateStartupItemState]; 519 | } 520 | 521 | - (void)hideFromMenuBar 522 | { 523 | [self setHideFromMenuBar:YES]; 524 | 525 | if ([GBLaunchAtLogin isLoginItem] == NO) { 526 | [GBLaunchAtLogin addAppAsLoginItem]; 527 | } 528 | 529 | [statusItem setVisible: NO]; 530 | } 531 | 532 | - (void)setHideFromMenuBar:(BOOL)hidden 533 | { 534 | [[NSUserDefaults standardUserDefaults] setBool:hidden forKey:kUserDefaultsHideFromMenuBarOptionKey]; 535 | } 536 | 537 | - (BOOL)shouldHideFromMenuBar 538 | { 539 | return [[NSUserDefaults standardUserDefaults] boolForKey:kUserDefaultsHideFromMenuBarOptionKey]; 540 | } 541 | 542 | #pragma mark - UI refresh 543 | 544 | - (void)updateOptionState 545 | { 546 | // Verify if a choice was selected, otherwise mark "None" as the default 547 | 548 | NSNumber *option = [[NSUserDefaults standardUserDefaults] valueForKey:kUserDefaultsPriorityOptionKey]; 549 | if ( option ) 550 | { 551 | mediaKeysPriority = [option integerValue]; 552 | } 553 | 554 | // Mark with a tick the selected item from priority options 555 | 556 | for ( NSUInteger index = 0, num = priorityOptionItems.count; index < num; index++ ) 557 | { 558 | NSMenuItem *item = priorityOptionItems[index]; 559 | [item setState:( index == mediaKeysPriority ? NSControlStateValueOn : NSControlStateValueOff )]; 560 | } 561 | } 562 | 563 | - (void)updatePauseState 564 | { 565 | NSMenuItem *item0 = pauseOptionItems[0]; 566 | NSMenuItem *item1 = pauseOptionItems[1]; 567 | 568 | [item0 setState: pauseState == PauseStatePause ? NSControlStateValueOn : NSControlStateValueOff]; 569 | [item1 setState: pauseState == PauseStateAutomatic ? NSControlStateValueOn : NSControlStateValueOff]; 570 | } 571 | 572 | - (void)updateStartupItemState { 573 | [startupItem setState: [GBLaunchAtLogin isLoginItem] ? NSControlStateValueOn : NSControlStateValueOff]; 574 | } 575 | 576 | - (void)menuWillOpen:(NSMenu *)menu 577 | { 578 | [self updateStartupItemState]; 579 | } 580 | 581 | 582 | @end 583 | 584 | 585 | 586 | 587 | 588 | 589 | -------------------------------------------------------------------------------- /MacMediaKeyForwarder/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "16x16", 5 | "idiom" : "mac", 6 | "filename" : "appicon.png", 7 | "scale" : "1x" 8 | }, 9 | { 10 | "size" : "16x16", 11 | "idiom" : "mac", 12 | "filename" : "appicon2x.png", 13 | "scale" : "2x" 14 | }, 15 | { 16 | "idiom" : "mac", 17 | "size" : "32x32", 18 | "scale" : "1x" 19 | }, 20 | { 21 | "idiom" : "mac", 22 | "size" : "32x32", 23 | "scale" : "2x" 24 | }, 25 | { 26 | "idiom" : "mac", 27 | "size" : "128x128", 28 | "scale" : "1x" 29 | }, 30 | { 31 | "idiom" : "mac", 32 | "size" : "128x128", 33 | "scale" : "2x" 34 | }, 35 | { 36 | "idiom" : "mac", 37 | "size" : "256x256", 38 | "scale" : "1x" 39 | }, 40 | { 41 | "idiom" : "mac", 42 | "size" : "256x256", 43 | "scale" : "2x" 44 | }, 45 | { 46 | "size" : "512x512", 47 | "idiom" : "mac", 48 | "filename" : "appicon-1.png", 49 | "scale" : "1x" 50 | }, 51 | { 52 | "idiom" : "mac", 53 | "size" : "512x512", 54 | "scale" : "2x" 55 | } 56 | ], 57 | "info" : { 58 | "version" : 1, 59 | "author" : "xcode" 60 | } 61 | } -------------------------------------------------------------------------------- /MacMediaKeyForwarder/Assets.xcassets/AppIcon.appiconset/appicon-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/milgra/macmediakeyforwarder/d6ff53a2fe966f509d6e3ea5a085e6a55038116e/MacMediaKeyForwarder/Assets.xcassets/AppIcon.appiconset/appicon-1.png -------------------------------------------------------------------------------- /MacMediaKeyForwarder/Assets.xcassets/AppIcon.appiconset/appicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/milgra/macmediakeyforwarder/d6ff53a2fe966f509d6e3ea5a085e6a55038116e/MacMediaKeyForwarder/Assets.xcassets/AppIcon.appiconset/appicon.png -------------------------------------------------------------------------------- /MacMediaKeyForwarder/Assets.xcassets/AppIcon.appiconset/appicon2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/milgra/macmediakeyforwarder/d6ff53a2fe966f509d6e3ea5a085e6a55038116e/MacMediaKeyForwarder/Assets.xcassets/AppIcon.appiconset/appicon2x.png -------------------------------------------------------------------------------- /MacMediaKeyForwarder/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /MacMediaKeyForwarder/Base.lproj/MainMenu.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /MacMediaKeyForwarder/Frameworks/GBLaunchAtLogin/GBLaunchAtLogin.h: -------------------------------------------------------------------------------- 1 | // 2 | // GBLaunchAtLogin.h 3 | // GBLaunchAtLogin 4 | // 5 | // Created by Luka Mirosevic on 04/03/2013. 6 | // Copyright (c) 2013 Goonbee. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface GBLaunchAtLogin : NSObject 12 | 13 | +(BOOL)isLoginItem; 14 | +(void)addAppAsLoginItem; 15 | +(void)removeAppFromLoginItems; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /MacMediaKeyForwarder/Frameworks/GBLaunchAtLogin/GBLaunchAtLogin.m: -------------------------------------------------------------------------------- 1 | // 2 | // GBLaunchAtLogin.m 3 | // GBLaunchAtLogin 4 | // 5 | // Created by Luka Mirosevic on 04/03/2013. 6 | // Copyright (c) 2013 Goonbee. All rights reserved. 7 | // 8 | // Credit where credit is due, most of this code is borrowed from somewhere and is just being wrapped into a convenient ObjC library here. I don't remember the original source so if you are, or know, the author please let me know. 9 | 10 | #import "GBLaunchAtLogin.h" 11 | 12 | @implementation GBLaunchAtLogin 13 | 14 | +(BOOL)isLoginItem { 15 | NSString *appPath = [[NSBundle mainBundle] bundlePath]; 16 | 17 | // This will retrieve the path for the application 18 | // For example, /Applications/test.app 19 | CFURLRef url = (__bridge CFURLRef)[NSURL fileURLWithPath:appPath]; 20 | 21 | // Create a reference to the shared file list. 22 | LSSharedFileListRef loginItems = LSSharedFileListCreate(NULL, kLSSharedFileListSessionLoginItems, NULL); 23 | 24 | if (loginItems) { 25 | UInt32 seedValue; 26 | //Retrieve the list of Login Items and cast them to a NSArray so that it will be easier to iterate. 27 | NSArray *loginItemsArray = (NSArray *)CFBridgingRelease(LSSharedFileListCopySnapshot(loginItems, &seedValue)); 28 | for (int i=0 ; i<[loginItemsArray count]; i++) { 29 | LSSharedFileListItemRef itemRef = (__bridge LSSharedFileListItemRef)loginItemsArray[i]; 30 | //Resolve the item with URL 31 | if (LSSharedFileListItemResolve(itemRef, 0, (CFURLRef *)&url, NULL) == noErr) { 32 | NSString *urlPath = [(__bridge NSURL *)url path]; 33 | if ([urlPath compare:appPath] == NSOrderedSame) { 34 | return YES; 35 | } 36 | } 37 | } 38 | } 39 | 40 | return NO; 41 | } 42 | 43 | +(void)addAppAsLoginItem { 44 | NSString *appPath = [[NSBundle mainBundle] bundlePath]; 45 | 46 | // This will retrieve the path for the application 47 | // For example, /Applications/test.app 48 | CFURLRef url = (__bridge CFURLRef)[NSURL fileURLWithPath:appPath]; 49 | 50 | // Create a reference to the shared file list. 51 | // We are adding it to the current user only. 52 | // If we want to add it all users, use 53 | // kLSSharedFileListGlobalLoginItems instead of 54 | //kLSSharedFileListSessionLoginItems 55 | LSSharedFileListRef loginItems = LSSharedFileListCreate(NULL, kLSSharedFileListSessionLoginItems, NULL); 56 | if (loginItems) { 57 | //Insert an item to the list. 58 | LSSharedFileListItemRef item = LSSharedFileListInsertItemURL(loginItems, kLSSharedFileListItemLast, NULL, NULL, url, NULL, NULL); 59 | if (item) { 60 | CFRelease(item); 61 | } 62 | } 63 | 64 | CFRelease(loginItems); 65 | } 66 | 67 | +(void)removeAppFromLoginItems { 68 | NSString *appPath = [[NSBundle mainBundle] bundlePath]; 69 | 70 | // This will retrieve the path for the application 71 | // For example, /Applications/test.app 72 | CFURLRef url = (__bridge CFURLRef)[NSURL fileURLWithPath:appPath]; 73 | 74 | // Create a reference to the shared file list. 75 | LSSharedFileListRef loginItems = LSSharedFileListCreate(NULL, kLSSharedFileListSessionLoginItems, NULL); 76 | 77 | if (loginItems) { 78 | UInt32 seedValue; 79 | //Retrieve the list of Login Items and cast them to 80 | // a NSArray so that it will be easier to iterate. 81 | NSArray *loginItemsArray = (NSArray *)CFBridgingRelease(LSSharedFileListCopySnapshot(loginItems, &seedValue)); 82 | for (int i=0 ; i<[loginItemsArray count]; i++) { 83 | LSSharedFileListItemRef itemRef = (__bridge LSSharedFileListItemRef)loginItemsArray[i]; 84 | //Resolve the item with URL 85 | if (LSSharedFileListItemResolve(itemRef, 0, (CFURLRef *)&url, NULL) == noErr) { 86 | NSString *urlPath = [(__bridge NSURL *)url path]; 87 | if ([urlPath compare:appPath] == NSOrderedSame) { 88 | LSSharedFileListItemRemove(loginItems, itemRef); 89 | } 90 | } 91 | } 92 | } 93 | } 94 | 95 | @end 96 | -------------------------------------------------------------------------------- /MacMediaKeyForwarder/Frameworks/GBLaunchAtLogin/LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. -------------------------------------------------------------------------------- /MacMediaKeyForwarder/Frameworks/GBLaunchAtLogin/README.md: -------------------------------------------------------------------------------- 1 | GBLaunchAtLogin 2 | ============ 3 | 4 | Add your app as a login item on Mac OS X. 5 | 6 | Usage 7 | ------------ 8 | 9 | Make your app launch at login: 10 | 11 | ```objective-c 12 | [GBLaunchAtLogin addAppAsLoginItem]; 13 | ``` 14 | 15 | Check if the app has been added as a login item: 16 | 17 | ```objective-c 18 | [GBLaunchAtLogin isLoginItem]; //Returns: YES or NO 19 | ``` 20 | 21 | Remove app from login items: 22 | 23 | ```objective-c 24 | [GBLaunchAtLogin removeAppFromLoginItems]; 25 | ``` 26 | 27 | Don't forget to import header first. 28 | 29 | ```objective-c 30 | #import 31 | ``` 32 | 33 | Integration 34 | ------------ 35 | 36 | 1. Add GBLaunchAtLogin as a subproject (by dragging the .xcodeproj file from Finder into the Xcode Project Navigator, or using the "Add Files" menu) 37 | 2. Add project dependency to your target (in "Target Dependencies" under "Build Phases") 38 | 3. Link library to your target (in "Link Binary With Libraries" under "Build Phases") 39 | 40 | Copyright & License 41 | ------------ 42 | 43 | Copyright 2013 Luka Mirosevic 44 | 45 | Licensed under the Apache License, Version 2.0 (the "License"); you may not use this work except in compliance with the License. You may obtain a copy of the License in the LICENSE file, or at: 46 | 47 | http://www.apache.org/licenses/LICENSE-2.0 48 | 49 | Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. 50 | 51 | [![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/lmirosevic/gblaunchatlogin/trend.png)](https://bitdeli.com/free "Bitdeli Badge") 52 | -------------------------------------------------------------------------------- /MacMediaKeyForwarder/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | $(MARKETING_VERSION) 19 | CFBundleVersion 20 | 1 21 | LSMinimumSystemVersion 22 | $(MACOSX_DEPLOYMENT_TARGET) 23 | LSUIElement 24 | 25 | NSAppleEventsUsageDescription 26 | 27 | NSHumanReadableCopyright 28 | 2017. Milan Toth. No rights reserved. 29 | NSMainNibFile 30 | MainMenu 31 | NSPrincipalClass 32 | NSApplication 33 | 34 | 35 | -------------------------------------------------------------------------------- /MacMediaKeyForwarder/Spotify.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Spotify.h 3 | */ 4 | 5 | #import 6 | #import 7 | 8 | 9 | @class SpotifyApplication, SpotifyTrack, SpotifyApplication; 10 | 11 | enum SpotifyEPlS { 12 | SpotifyEPlSStopped = 'kPSS', 13 | SpotifyEPlSPlaying = 'kPSP', 14 | SpotifyEPlSPaused = 'kPSp' 15 | }; 16 | typedef enum SpotifyEPlS SpotifyEPlS; 17 | 18 | 19 | 20 | /* 21 | * Spotify Suite 22 | */ 23 | 24 | // The Spotify application. 25 | @interface SpotifyApplication : SBApplication 26 | 27 | @property (copy, readonly) SpotifyTrack *currentTrack; // The current playing track. 28 | @property NSInteger soundVolume; // The sound output volume (0 = minimum, 100 = maximum) 29 | @property (readonly) SpotifyEPlS playerState; // Is Spotify stopped, paused, or playing? 30 | @property double playerPosition; // The player’s position within the currently playing track in seconds. 31 | @property (readonly) BOOL repeatingEnabled; // Is repeating enabled in the current playback context? 32 | @property BOOL repeating; // Is repeating on or off? 33 | @property (readonly) BOOL shufflingEnabled; // Is shuffling enabled in the current playback context? 34 | @property BOOL shuffling; // Is shuffling on or off? 35 | 36 | - (void) nextTrack; // Skip to the next track. 37 | - (void) previousTrack; // Skip to the previous track. 38 | - (void) playpause; // Toggle play/pause. 39 | - (void) pause; // Pause playback. 40 | - (void) play; // Resume playback. 41 | - (void) playTrack:(NSString *)x inContext:(NSString *)inContext; // Start playback of a track in the given context. 42 | 43 | @end 44 | 45 | // A Spotify track. 46 | @interface SpotifyTrack : SBObject 47 | 48 | @property (copy, readonly) NSString *artist; // The artist of the track. 49 | @property (copy, readonly) NSString *album; // The album of the track. 50 | @property (readonly) NSInteger discNumber; // The disc number of the track. 51 | @property (readonly) NSInteger duration; // The length of the track in seconds. 52 | @property (readonly) NSInteger playedCount; // The number of times this track has been played. 53 | @property (readonly) NSInteger trackNumber; // The index of the track in its album. 54 | @property (readonly) BOOL starred; // Is the track starred? 55 | @property (readonly) NSInteger popularity; // How popular is this track? 0-100 56 | - (NSString *) id; // The ID of the item. 57 | @property (copy, readonly) NSString *name; // The name of the track. 58 | @property (copy, readonly) NSString *artworkUrl; // The URL of the track%apos;s album cover. 59 | @property (copy, readonly) NSImage *artwork; // The property is deprecated and will never be set. Use the 'artwork url' instead. 60 | @property (copy, readonly) NSString *albumArtist; // That album artist of the track. 61 | @property (copy) NSString *spotifyUrl; // The URL of the track. 62 | 63 | 64 | @end 65 | 66 | 67 | 68 | /* 69 | * Standard Suite 70 | */ 71 | 72 | // The application's top level scripting object. 73 | @interface SpotifyApplication (StandardSuite) 74 | 75 | @property (copy, readonly) NSString *name; // The name of the application. 76 | @property (readonly) BOOL frontmost; // Is this the frontmost (active) application? 77 | @property (copy, readonly) NSString *version; // The version of the application. 78 | 79 | @end 80 | 81 | -------------------------------------------------------------------------------- /MacMediaKeyForwarder/appicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/milgra/macmediakeyforwarder/d6ff53a2fe966f509d6e3ea5a085e6a55038116e/MacMediaKeyForwarder/appicon.png -------------------------------------------------------------------------------- /MacMediaKeyForwarder/appicon.pxm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/milgra/macmediakeyforwarder/d6ff53a2fe966f509d6e3ea5a085e6a55038116e/MacMediaKeyForwarder/appicon.pxm -------------------------------------------------------------------------------- /MacMediaKeyForwarder/da.lproj/Localizable.strings: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | Localizable.strings 4 | HighSierraMediaKeyEnabler 5 | 6 | Created by Sungho Lee on 2017. 12. 27.. 7 | Copyright © 2017년 Milan Toth. All rights reserved. 8 | */ 9 | 10 | "Send events to both players" = "Send handling til begge afspillere"; 11 | "Open at login" = "Åbn ved login"; 12 | "Prioritize iTunes" = "Prioriter iTunes"; 13 | "Prioritize Spotify" = "Prioriter Spotify"; 14 | "Pause" = "Pause"; 15 | "Pause if no player is running" = "Pause hvis ingen afspiller kører"; 16 | "Donate if you like the app" = "Doner hvis du synes om appen"; 17 | "Check for updates" = "Søg efter opdateringer"; 18 | "Quit" = "Afslut"; 19 | -------------------------------------------------------------------------------- /MacMediaKeyForwarder/de.lproj/Localizable.strings: -------------------------------------------------------------------------------- 1 | /* 2 | Localizable.strings 3 | MacMediaKeyForwarder 4 | 5 | Created by maciboy on 2018. 02. 03.. 6 | Copyright © 2018년 Milan Toth. All rights reserved. 7 | */ 8 | 9 | "Send events to both players" = "Eingaben an beide Player senden"; 10 | "Open at login" = "Beim Start öffnen"; 11 | "Prioritize iTunes" = "iTunes priorisieren"; 12 | "Prioritize Spotify" = "Spotify priorisieren"; 13 | "Pause" = "Pausieren"; 14 | "Pause if no player is running" = "Pausieren, wenn kein Player geöffnet ist"; 15 | "Donate if you like the app" = "Spenden"; 16 | "Check for updates" = "Nach Updates suchen"; 17 | "Quit" = "Beenden"; 18 | -------------------------------------------------------------------------------- /MacMediaKeyForwarder/en.lproj/Localizable.strings: -------------------------------------------------------------------------------- 1 | /* 2 | Localizable.strings 3 | MacMediaKeyForwarder 4 | 5 | Created by Sungho Lee on 2017. 12. 27.. 6 | Copyright © 2017년 Milan Toth. All rights reserved. 7 | */ 8 | 9 | "Send events to both players" = "Send events to both players"; 10 | "Open at login" = "Open at login"; 11 | "Prioritize iTunes" = "Prioritize iTunes"; 12 | "Prioritize Spotify" = "Prioritize Spotify"; 13 | "Pause" = "Pause"; 14 | "Pause if no player is running" = "Pause if no player is running"; 15 | "Donate if you like the app" = "Donate if you like the app"; 16 | "Check for updates" = "Check for updates"; 17 | "Quit" = "Quit"; 18 | "OK" = "OK"; 19 | "Cancel" = "Cancel"; 20 | -------------------------------------------------------------------------------- /MacMediaKeyForwarder/es.lproj/Localizable.strings: -------------------------------------------------------------------------------- 1 | /* 2 | Localizable.strings 3 | MacMediaKeyForwarder 4 | 5 | Created by Sungho Lee on 2017. 12. 27.. 6 | Copyright © 2017년 Milan Toth. All rights reserved. 7 | */ 8 | 9 | "Send events to both players" = "Enviar eventos a ambos reproductores"; 10 | "Open at login" = "Abrir al iniciar sesión"; 11 | "Prioritize iTunes" = "Dar prioridad a iTunes"; 12 | "Prioritize Spotify" = "Dar prioridad a Spotify"; 13 | "Pause" = "Pausar"; 14 | "Pause if no player is running" = "Pausar si ningún reproductor se está ejecutando"; 15 | "Donate if you like the app" = "Dona si te gusta la app"; 16 | "Check for updates" = "Verificar actualizaciones"; 17 | "Quit" = "Salir"; 18 | -------------------------------------------------------------------------------- /MacMediaKeyForwarder/fi.lproj/Localizable.strings: -------------------------------------------------------------------------------- 1 | /* 2 | Localizable.strings 3 | MacMediaKeyForwarder 4 | 5 | Created by Sungho Lee on 2017. 12. 27.. 6 | Copyright © 2017년 Milan Toth. All rights reserved. 7 | */ 8 | 9 | "Send events to both players" = "Ohjaa molempia soittimia"; 10 | "Open at login" = "Avaa sisäänkirjautuessa"; 11 | "Hide from menu bar" = "Piilota valikkoriviltä"; 12 | "Prioritize iTunes" = "iTunes etusijalla"; 13 | "Prioritize Spotify" = "Spotify etusijalla"; 14 | "Pause" = "Tauko"; 15 | "Pause if no player is running" = "Tauko soittimien ollessa kiinni"; 16 | "Donate if you like the app" = "Lahjoita, jos pidät sovelluksesta"; 17 | "Check for updates" = "Tarkista päivitykset"; 18 | "Quit" = "Sulje"; 19 | "OK" = "OK"; 20 | "Cancel" = "Peruuta"; 21 | -------------------------------------------------------------------------------- /MacMediaKeyForwarder/fr.lproj/Localizable.strings: -------------------------------------------------------------------------------- 1 | "Send events to both players" = "Envoyer les événements aux deux lecteurs"; 2 | "Open at login" = "Lancer au démarrage"; 3 | "Hide from menu bar" = "Masquer l'icône dans la barre"; 4 | "Prioritize iTunes" = "Privilégier iTunes"; 5 | "Prioritize Spotify" = "Privilégier Spotify"; 6 | "Pause" = "Pause"; 7 | "Pause if no player is running" = "Mettre en pause si aucun lecteur n'est ouvert"; 8 | "Donate if you like the app" = "Faire un don si vous aimez l'application"; 9 | "Check for updates" = "Vérifier les mises à jour"; 10 | "Quit" = "Quitter"; 11 | "OK" = "OK"; 12 | "Cancel" = "Annuler"; 13 | -------------------------------------------------------------------------------- /MacMediaKeyForwarder/hu.lproj/Localizable.strings: -------------------------------------------------------------------------------- 1 | /* 2 | Localizable.strings 3 | HighSierraMediaKeyEnabler 4 | 5 | Created by Sungho Lee on 2017. 12. 27.. 6 | Copyright © 2017년 Milan Toth. All rights reserved. 7 | */ 8 | 9 | "Send events to both players" = "Események küldése mindkét lejátszónak"; 10 | "Open at login" = "Automatikus megnyitás bejelentkezéskor"; 11 | "Prioritize iTunes" = "Az iTunes fontosabb"; 12 | "Prioritize Spotify" = "A Spotify fontosabb"; 13 | "Pause" = "Szünet"; 14 | "Pause if no player is running" = "Szüneteltetés ha nem fut lejátszó"; 15 | "Donate if you like the app" = "Adományozz ha tetszik az app"; 16 | "Check for updates" = "Frissítések keresése"; 17 | "Quit" = "Kilépés"; 18 | -------------------------------------------------------------------------------- /MacMediaKeyForwarder/iTunes.h: -------------------------------------------------------------------------------- 1 | /* 2 | * iTunes.h 3 | */ 4 | 5 | #import 6 | #import 7 | 8 | 9 | @class iTunesApplication, iTunesItem, iTunesAirPlayDevice, iTunesArtwork, iTunesEncoder, iTunesEQPreset, iTunesPlaylist, iTunesAudioCDPlaylist, iTunesLibraryPlaylist, iTunesRadioTunerPlaylist, iTunesSource, iTunesSubscriptionPlaylist, iTunesTrack, iTunesAudioCDTrack, iTunesFileTrack, iTunesSharedTrack, iTunesURLTrack, iTunesUserPlaylist, iTunesFolderPlaylist, iTunesVisual, iTunesWindow, iTunesBrowserWindow, iTunesEQWindow, iTunesMiniplayerWindow, iTunesPlaylistWindow, iTunesVideoWindow; 10 | 11 | enum iTunesEKnd { 12 | iTunesEKndTrackListing = 'kTrk' /* a basic listing of tracks within a playlist */, 13 | iTunesEKndAlbumListing = 'kAlb' /* a listing of a playlist grouped by album */, 14 | iTunesEKndCdInsert = 'kCDi' /* a printout of the playlist for jewel case inserts */ 15 | }; 16 | typedef enum iTunesEKnd iTunesEKnd; 17 | 18 | enum iTunesEnum { 19 | iTunesEnumStandard = 'lwst' /* Standard PostScript error handling */, 20 | iTunesEnumDetailed = 'lwdt' /* print a detailed report of PostScript errors */ 21 | }; 22 | typedef enum iTunesEnum iTunesEnum; 23 | 24 | enum iTunesEPlS { 25 | iTunesEPlSStopped = 'kPSS', 26 | iTunesEPlSPlaying = 'kPSP', 27 | iTunesEPlSPaused = 'kPSp', 28 | iTunesEPlSFastForwarding = 'kPSF', 29 | iTunesEPlSRewinding = 'kPSR' 30 | }; 31 | typedef enum iTunesEPlS iTunesEPlS; 32 | 33 | enum iTunesERpt { 34 | iTunesERptOff = 'kRpO', 35 | iTunesERptOne = 'kRp1', 36 | iTunesERptAll = 'kAll' 37 | }; 38 | typedef enum iTunesERpt iTunesERpt; 39 | 40 | enum iTunesEShM { 41 | iTunesEShMSongs = 'kShS', 42 | iTunesEShMAlbums = 'kShA', 43 | iTunesEShMGroupings = 'kShG' 44 | }; 45 | typedef enum iTunesEShM iTunesEShM; 46 | 47 | enum iTunesEVSz { 48 | iTunesEVSzSmall = 'kVSS', 49 | iTunesEVSzMedium = 'kVSM', 50 | iTunesEVSzLarge = 'kVSL' 51 | }; 52 | typedef enum iTunesEVSz iTunesEVSz; 53 | 54 | enum iTunesESrc { 55 | iTunesESrcLibrary = 'kLib', 56 | iTunesESrcIPod = 'kPod', 57 | iTunesESrcAudioCD = 'kACD', 58 | iTunesESrcMP3CD = 'kMCD', 59 | iTunesESrcRadioTuner = 'kTun', 60 | iTunesESrcSharedLibrary = 'kShd', 61 | iTunesESrcITunesStore = 'kITS', 62 | iTunesESrcUnknown = 'kUnk' 63 | }; 64 | typedef enum iTunesESrc iTunesESrc; 65 | 66 | enum iTunesESrA { 67 | iTunesESrAAlbums = 'kSrL' /* albums only */, 68 | iTunesESrAAll = 'kAll' /* all text fields */, 69 | iTunesESrAArtists = 'kSrR' /* artists only */, 70 | iTunesESrAComposers = 'kSrC' /* composers only */, 71 | iTunesESrADisplayed = 'kSrV' /* visible text fields */, 72 | iTunesESrASongs = 'kSrS' /* song names only */ 73 | }; 74 | typedef enum iTunesESrA iTunesESrA; 75 | 76 | enum iTunesESpK { 77 | iTunesESpKNone = 'kNon', 78 | iTunesESpKBooks = 'kSpA', 79 | iTunesESpKFolder = 'kSpF', 80 | iTunesESpKGenius = 'kSpG', 81 | iTunesESpKITunesU = 'kSpU', 82 | iTunesESpKLibrary = 'kSpL', 83 | iTunesESpKMovies = 'kSpI', 84 | iTunesESpKMusic = 'kSpZ', 85 | iTunesESpKPodcasts = 'kSpP', 86 | iTunesESpKPurchasedMusic = 'kSpM', 87 | iTunesESpKTVShows = 'kSpT' 88 | }; 89 | typedef enum iTunesESpK iTunesESpK; 90 | 91 | enum iTunesEMdK { 92 | iTunesEMdKAlertTone = 'kMdL' /* alert tone track */, 93 | iTunesEMdKAudiobook = 'kMdA' /* audiobook track */, 94 | iTunesEMdKBook = 'kMdB' /* book track */, 95 | iTunesEMdKHomeVideo = 'kVdH' /* home video track */, 96 | iTunesEMdKITunesU = 'kMdI' /* iTunes U track */, 97 | iTunesEMdKMovie = 'kVdM' /* movie track */, 98 | iTunesEMdKSong = 'kMdS' /* music track */, 99 | iTunesEMdKMusicVideo = 'kVdV' /* music video track */, 100 | iTunesEMdKPodcast = 'kMdP' /* podcast track */, 101 | iTunesEMdKRingtone = 'kMdR' /* ringtone track */, 102 | iTunesEMdKTVShow = 'kVdT' /* TV show track */, 103 | iTunesEMdKVoiceMemo = 'kMdO' /* voice memo track */, 104 | iTunesEMdKUnknown = 'kUnk' 105 | }; 106 | typedef enum iTunesEMdK iTunesEMdK; 107 | 108 | enum iTunesEVdK { 109 | iTunesEVdKNone = 'kNon' /* not a video or unknown video kind */, 110 | iTunesEVdKHomeVideo = 'kVdH' /* home video track */, 111 | iTunesEVdKMovie = 'kVdM' /* movie track */, 112 | iTunesEVdKMusicVideo = 'kVdV' /* music video track */, 113 | iTunesEVdKTVShow = 'kVdT' /* TV show track */ 114 | }; 115 | typedef enum iTunesEVdK iTunesEVdK; 116 | 117 | enum iTunesERtK { 118 | iTunesERtKUser = 'kRtU' /* user-specified rating */, 119 | iTunesERtKComputed = 'kRtC' /* iTunes-computed rating */ 120 | }; 121 | typedef enum iTunesERtK iTunesERtK; 122 | 123 | enum iTunesEAPD { 124 | iTunesEAPDComputer = 'kAPC', 125 | iTunesEAPDAirPortExpress = 'kAPX', 126 | iTunesEAPDAppleTV = 'kAPT', 127 | iTunesEAPDAirPlayDevice = 'kAPO', 128 | iTunesEAPDUnknown = 'kAPU' 129 | }; 130 | typedef enum iTunesEAPD iTunesEAPD; 131 | 132 | enum iTunesEClS { 133 | iTunesEClSUnknown = 'kUnk', 134 | iTunesEClSPurchased = 'kPur', 135 | iTunesEClSMatched = 'kMat', 136 | iTunesEClSUploaded = 'kUpl', 137 | iTunesEClSIneligible = 'kRej', 138 | iTunesEClSRemoved = 'kRem', 139 | iTunesEClSError = 'kErr', 140 | iTunesEClSDuplicate = 'kDup', 141 | iTunesEClSSubscription = 'kSub', 142 | iTunesEClSNoLongerAvailable = 'kRev', 143 | iTunesEClSNotUploaded = 'kUpP' 144 | }; 145 | typedef enum iTunesEClS iTunesEClS; 146 | 147 | @protocol iTunesGenericMethods 148 | 149 | - (void) printPrintDialog:(BOOL)printDialog withProperties:(NSDictionary *)withProperties kind:(iTunesEKnd)kind theme:(NSString *)theme; // Print the specified object(s) 150 | - (void) close; // Close an object 151 | - (void) delete; // Delete an element from an object 152 | - (SBObject *) duplicateTo:(SBObject *)to; // Duplicate one or more object(s) 153 | - (BOOL) exists; // Verify if an object exists 154 | - (void) open; // Open the specified object(s) 155 | - (void) save; // Save the specified object(s) 156 | - (void) playOnce:(BOOL)once; // play the current track or the specified track or file. 157 | - (void) select; // select the specified object(s) 158 | 159 | @end 160 | 161 | 162 | 163 | /* 164 | * iTunes Suite 165 | */ 166 | 167 | // The application program 168 | @interface iTunesApplication : SBApplication 169 | 170 | - (SBElementArray *) AirPlayDevices; 171 | - (SBElementArray *) browserWindows; 172 | - (SBElementArray *) encoders; 173 | - (SBElementArray *) EQPresets; 174 | - (SBElementArray *) EQWindows; 175 | - (SBElementArray *) miniplayerWindows; 176 | - (SBElementArray *) playlists; 177 | - (SBElementArray *) playlistWindows; 178 | - (SBElementArray *) sources; 179 | - (SBElementArray *) tracks; 180 | - (SBElementArray *) videoWindows; 181 | - (SBElementArray *) visuals; 182 | - (SBElementArray *) windows; 183 | 184 | @property (readonly) BOOL AirPlayEnabled; // is AirPlay currently enabled? 185 | @property (readonly) BOOL converting; // is a track currently being converted? 186 | @property (copy) NSArray *currentAirPlayDevices; // the currently selected AirPlay device(s) 187 | @property (copy) iTunesEncoder *currentEncoder; // the currently selected encoder (MP3, AIFF, WAV, etc.) 188 | @property (copy) iTunesEQPreset *currentEQPreset; // the currently selected equalizer preset 189 | @property (copy, readonly) iTunesPlaylist *currentPlaylist; // the playlist containing the currently targeted track 190 | @property (copy, readonly) NSString *currentStreamTitle; // the name of the current song in the playing stream (provided by streaming server) 191 | @property (copy, readonly) NSString *currentStreamURL; // the URL of the playing stream or streaming web site (provided by streaming server) 192 | @property (copy, readonly) iTunesTrack *currentTrack; // the current targeted track 193 | @property (copy) iTunesVisual *currentVisual; // the currently selected visual plug-in 194 | @property BOOL EQEnabled; // is the equalizer enabled? 195 | @property BOOL fixedIndexing; // true if all AppleScript track indices should be independent of the play order of the owning playlist. 196 | @property BOOL frontmost; // is iTunes the frontmost application? 197 | @property BOOL fullScreen; // are visuals displayed using the entire screen? 198 | @property (copy, readonly) NSString *name; // the name of the application 199 | @property BOOL mute; // has the sound output been muted? 200 | @property double playerPosition; // the player’s position within the currently playing track in seconds. 201 | @property (readonly) iTunesEPlS playerState; // is iTunes stopped, paused, or playing? 202 | @property (copy, readonly) SBObject *selection; // the selection visible to the user 203 | @property BOOL shuffleEnabled; // are songs played in random order? 204 | @property iTunesEShM shuffleMode; // the playback shuffle mode 205 | @property iTunesERpt songRepeat; // the playback repeat mode 206 | @property NSInteger soundVolume; // the sound output volume (0 = minimum, 100 = maximum) 207 | @property (copy, readonly) NSString *version; // the version of iTunes 208 | @property BOOL visualsEnabled; // are visuals currently being displayed? 209 | @property iTunesEVSz visualSize; // the size of the displayed visual 210 | 211 | - (void) printPrintDialog:(BOOL)printDialog withProperties:(NSDictionary *)withProperties kind:(iTunesEKnd)kind theme:(NSString *)theme; // Print the specified object(s) 212 | - (void) run; // Run iTunes 213 | - (void) quit; // Quit iTunes 214 | - (iTunesTrack *) add:(NSArray *)x to:(SBObject *)to; // add one or more files to a playlist 215 | - (void) backTrack; // reposition to beginning of current track or go to previous track if already at start of current track 216 | - (iTunesTrack *) convert:(NSArray *)x; // convert one or more files or tracks 217 | - (void) eject; // eject the specified iPod 218 | - (void) fastForward; // skip forward in a playing track 219 | - (void) nextTrack; // advance to the next track in the current playlist 220 | - (void) pause; // pause playback 221 | - (void) playOnce:(BOOL)once; // play the current track or the specified track or file. 222 | - (void) playpause; // toggle the playing/paused state of the current track 223 | - (void) previousTrack; // return to the previous track in the current playlist 224 | - (void) resume; // disable fast forward/rewind and resume playback, if playing. 225 | - (void) rewind; // skip backwards in a playing track 226 | - (void) stop; // stop playback 227 | - (void) subscribe:(NSString *)x; // subscribe to a podcast feed 228 | - (void) update; // update the specified iPod 229 | - (void) updateAllPodcasts; // update all subscribed podcast feeds 230 | - (void) updatePodcast; // update podcast feed 231 | - (void) openLocation:(NSString *)x; // Opens a Music Store or audio stream URL 232 | 233 | @end 234 | 235 | // an item 236 | @interface iTunesItem : SBObject 237 | 238 | @property (copy, readonly) SBObject *container; // the container of the item 239 | - (NSInteger) id; // the id of the item 240 | @property (readonly) NSInteger index; // The index of the item in internal application order. 241 | @property (copy) NSString *name; // the name of the item 242 | @property (copy, readonly) NSString *persistentID; // the id of the item as a hexadecimal string. This id does not change over time. 243 | @property (copy) NSDictionary *properties; // every property of the item 244 | 245 | - (void) download; // download a cloud track or playlist, or a podcast episode 246 | - (void) reveal; // reveal and select a track or playlist 247 | 248 | @end 249 | 250 | // an AirPlay device 251 | @interface iTunesAirPlayDevice : iTunesItem 252 | 253 | @property (readonly) BOOL active; // is the device currently being played to? 254 | @property (readonly) BOOL available; // is the device currently available? 255 | @property (readonly) iTunesEAPD kind; // the kind of the device 256 | @property (copy, readonly) NSString *networkAddress; // the network (MAC) address of the device 257 | - (BOOL) protected; // is the device password- or passcode-protected? 258 | @property BOOL selected; // is the device currently selected? 259 | @property (readonly) BOOL supportsAudio; // does the device support audio playback? 260 | @property (readonly) BOOL supportsVideo; // does the device support video playback? 261 | @property NSInteger soundVolume; // the output volume for the device (0 = minimum, 100 = maximum) 262 | 263 | 264 | @end 265 | 266 | // a piece of art within a track or playlist 267 | @interface iTunesArtwork : iTunesItem 268 | 269 | @property (copy) NSImage *data; // data for this artwork, in the form of a picture 270 | @property (copy) NSString *objectDescription; // description of artwork as a string 271 | @property (readonly) BOOL downloaded; // was this artwork downloaded by iTunes? 272 | @property (copy, readonly) NSNumber *format; // the data format for this piece of artwork 273 | @property NSInteger kind; // kind or purpose of this piece of artwork 274 | @property (copy) NSData *rawData; // data for this artwork, in original format 275 | 276 | 277 | @end 278 | 279 | // converts a track to a specific file format 280 | @interface iTunesEncoder : iTunesItem 281 | 282 | @property (copy, readonly) NSString *format; // the data format created by the encoder 283 | 284 | 285 | @end 286 | 287 | // equalizer preset configuration 288 | @interface iTunesEQPreset : iTunesItem 289 | 290 | @property double band1; // the equalizer 32 Hz band level (-12.0 dB to +12.0 dB) 291 | @property double band2; // the equalizer 64 Hz band level (-12.0 dB to +12.0 dB) 292 | @property double band3; // the equalizer 125 Hz band level (-12.0 dB to +12.0 dB) 293 | @property double band4; // the equalizer 250 Hz band level (-12.0 dB to +12.0 dB) 294 | @property double band5; // the equalizer 500 Hz band level (-12.0 dB to +12.0 dB) 295 | @property double band6; // the equalizer 1 kHz band level (-12.0 dB to +12.0 dB) 296 | @property double band7; // the equalizer 2 kHz band level (-12.0 dB to +12.0 dB) 297 | @property double band8; // the equalizer 4 kHz band level (-12.0 dB to +12.0 dB) 298 | @property double band9; // the equalizer 8 kHz band level (-12.0 dB to +12.0 dB) 299 | @property double band10; // the equalizer 16 kHz band level (-12.0 dB to +12.0 dB) 300 | @property (readonly) BOOL modifiable; // can this preset be modified? 301 | @property double preamp; // the equalizer preamp level (-12.0 dB to +12.0 dB) 302 | @property BOOL updateTracks; // should tracks which refer to this preset be updated when the preset is renamed or deleted? 303 | 304 | 305 | @end 306 | 307 | // a list of songs/streams 308 | @interface iTunesPlaylist : iTunesItem 309 | 310 | - (SBElementArray *) tracks; 311 | - (SBElementArray *) artworks; 312 | 313 | @property (copy) NSString *objectDescription; // the description of the playlist 314 | @property BOOL disliked; // is this playlist disliked? 315 | @property (readonly) NSInteger duration; // the total length of all songs (in seconds) 316 | @property (copy) NSString *name; // the name of the playlist 317 | @property BOOL loved; // is this playlist loved? 318 | @property (copy, readonly) iTunesPlaylist *parent; // folder which contains this playlist (if any) 319 | @property BOOL shuffle; // play the songs in this playlist in random order? (obsolete; always false) 320 | @property (readonly) NSInteger size; // the total size of all songs (in bytes) 321 | @property iTunesERpt songRepeat; // playback repeat mode (obsolete; always off) 322 | @property (readonly) iTunesESpK specialKind; // special playlist kind 323 | @property (copy, readonly) NSString *time; // the length of all songs in MM:SS format 324 | @property (readonly) BOOL visible; // is this playlist visible in the Source list? 325 | 326 | - (void) moveTo:(SBObject *)to; // Move playlist(s) to a new location 327 | - (iTunesTrack *) searchFor:(NSString *)for_ only:(iTunesESrA)only; // search a playlist for tracks matching the search string. Identical to entering search text in the Search field in iTunes. 328 | 329 | @end 330 | 331 | // a playlist representing an audio CD 332 | @interface iTunesAudioCDPlaylist : iTunesPlaylist 333 | 334 | - (SBElementArray *) audioCDTracks; 335 | 336 | @property (copy) NSString *artist; // the artist of the CD 337 | @property BOOL compilation; // is this CD a compilation album? 338 | @property (copy) NSString *composer; // the composer of the CD 339 | @property NSInteger discCount; // the total number of discs in this CD’s album 340 | @property NSInteger discNumber; // the index of this CD disc in the source album 341 | @property (copy) NSString *genre; // the genre of the CD 342 | @property NSInteger year; // the year the album was recorded/released 343 | 344 | 345 | @end 346 | 347 | // the master music library playlist 348 | @interface iTunesLibraryPlaylist : iTunesPlaylist 349 | 350 | - (SBElementArray *) fileTracks; 351 | - (SBElementArray *) URLTracks; 352 | - (SBElementArray *) sharedTracks; 353 | 354 | 355 | @end 356 | 357 | // the radio tuner playlist 358 | @interface iTunesRadioTunerPlaylist : iTunesPlaylist 359 | 360 | - (SBElementArray *) URLTracks; 361 | 362 | 363 | @end 364 | 365 | // a music source (music library, CD, device, etc.) 366 | @interface iTunesSource : iTunesItem 367 | 368 | - (SBElementArray *) audioCDPlaylists; 369 | - (SBElementArray *) libraryPlaylists; 370 | - (SBElementArray *) playlists; 371 | - (SBElementArray *) radioTunerPlaylists; 372 | - (SBElementArray *) subscriptionPlaylists; 373 | - (SBElementArray *) userPlaylists; 374 | 375 | @property (readonly) long long capacity; // the total size of the source if it has a fixed size 376 | @property (readonly) long long freeSpace; // the free space on the source if it has a fixed size 377 | @property (readonly) iTunesESrc kind; 378 | 379 | - (void) eject; // eject the specified iPod 380 | - (void) update; // update the specified iPod 381 | 382 | @end 383 | 384 | // a subscription playlist from Apple Music 385 | @interface iTunesSubscriptionPlaylist : iTunesPlaylist 386 | 387 | - (SBElementArray *) fileTracks; 388 | - (SBElementArray *) URLTracks; 389 | 390 | 391 | @end 392 | 393 | // playable audio source 394 | @interface iTunesTrack : iTunesItem 395 | 396 | - (SBElementArray *) artworks; 397 | 398 | @property (copy) NSString *album; // the album name of the track 399 | @property (copy) NSString *albumArtist; // the album artist of the track 400 | @property BOOL albumDisliked; // is the album for this track disliked? 401 | @property BOOL albumLoved; // is the album for this track loved? 402 | @property NSInteger albumRating; // the rating of the album for this track (0 to 100) 403 | @property (readonly) iTunesERtK albumRatingKind; // the rating kind of the album rating for this track 404 | @property (copy) NSString *artist; // the artist/source of the track 405 | @property (readonly) NSInteger bitRate; // the bit rate of the track (in kbps) 406 | @property double bookmark; // the bookmark time of the track in seconds 407 | @property BOOL bookmarkable; // is the playback position for this track remembered? 408 | @property NSInteger bpm; // the tempo of this track in beats per minute 409 | @property (copy) NSString *category; // the category of the track 410 | @property (readonly) iTunesEClS cloudStatus; // the iCloud status of the track 411 | @property (copy) NSString *comment; // freeform notes about the track 412 | @property BOOL compilation; // is this track from a compilation album? 413 | @property (copy) NSString *composer; // the composer of the track 414 | @property (readonly) NSInteger databaseID; // the common, unique ID for this track. If two tracks in different playlists have the same database ID, they are sharing the same data. 415 | @property (copy, readonly) NSDate *dateAdded; // the date the track was added to the playlist 416 | @property (copy) NSString *objectDescription; // the description of the track 417 | @property NSInteger discCount; // the total number of discs in the source album 418 | @property NSInteger discNumber; // the index of the disc containing this track on the source album 419 | @property BOOL disliked; // is this track disliked? 420 | @property (copy, readonly) NSString *downloaderAppleID; // the Apple ID of the person who downloaded this track 421 | @property (copy, readonly) NSString *downloaderName; // the name of the person who downloaded this track 422 | @property (readonly) double duration; // the length of the track in seconds 423 | @property BOOL enabled; // is this track checked for playback? 424 | @property (copy) NSString *episodeID; // the episode ID of the track 425 | @property NSInteger episodeNumber; // the episode number of the track 426 | @property (copy) NSString *EQ; // the name of the EQ preset of the track 427 | @property double finish; // the stop time of the track in seconds 428 | @property BOOL gapless; // is this track from a gapless album? 429 | @property (copy) NSString *genre; // the music/audio genre (category) of the track 430 | @property (copy) NSString *grouping; // the grouping (piece) of the track. Generally used to denote movements within a classical work. 431 | @property (copy, readonly) NSString *kind; // a text description of the track 432 | @property (copy) NSString *longDescription; 433 | @property BOOL loved; // is this track loved? 434 | @property (copy) NSString *lyrics; // the lyrics of the track 435 | @property iTunesEMdK mediaKind; // the media kind of the track 436 | @property (copy, readonly) NSDate *modificationDate; // the modification date of the content of this track 437 | @property (copy) NSString *movement; // the movement name of the track 438 | @property NSInteger movementCount; // the total number of movements in the work 439 | @property NSInteger movementNumber; // the index of the movement in the work 440 | @property NSInteger playedCount; // number of times this track has been played 441 | @property (copy) NSDate *playedDate; // the date and time this track was last played 442 | @property (copy, readonly) NSString *purchaserAppleID; // the Apple ID of the person who purchased this track 443 | @property (copy, readonly) NSString *purchaserName; // the name of the person who purchased this track 444 | @property NSInteger rating; // the rating of this track (0 to 100) 445 | @property (readonly) iTunesERtK ratingKind; // the rating kind of this track 446 | @property (copy, readonly) NSDate *releaseDate; // the release date of this track 447 | @property (readonly) NSInteger sampleRate; // the sample rate of the track (in Hz) 448 | @property NSInteger seasonNumber; // the season number of the track 449 | @property BOOL shufflable; // is this track included when shuffling? 450 | @property NSInteger skippedCount; // number of times this track has been skipped 451 | @property (copy) NSDate *skippedDate; // the date and time this track was last skipped 452 | @property (copy) NSString *show; // the show name of the track 453 | @property (copy) NSString *sortAlbum; // override string to use for the track when sorting by album 454 | @property (copy) NSString *sortArtist; // override string to use for the track when sorting by artist 455 | @property (copy) NSString *sortAlbumArtist; // override string to use for the track when sorting by album artist 456 | @property (copy) NSString *sortName; // override string to use for the track when sorting by name 457 | @property (copy) NSString *sortComposer; // override string to use for the track when sorting by composer 458 | @property (copy) NSString *sortShow; // override string to use for the track when sorting by show name 459 | @property (readonly) long long size; // the size of the track (in bytes) 460 | @property double start; // the start time of the track in seconds 461 | @property (copy, readonly) NSString *time; // the length of the track in MM:SS format 462 | @property NSInteger trackCount; // the total number of tracks on the source album 463 | @property NSInteger trackNumber; // the index of the track on the source album 464 | @property BOOL unplayed; // is this track unplayed? 465 | @property iTunesEVdK videoKind; // kind of video track 466 | @property NSInteger volumeAdjustment; // relative volume adjustment of the track (-100% to 100%) 467 | @property (copy) NSString *work; // the work name of the track 468 | @property NSInteger year; // the year the track was recorded/released 469 | 470 | 471 | @end 472 | 473 | // a track on an audio CD 474 | @interface iTunesAudioCDTrack : iTunesTrack 475 | 476 | @property (copy, readonly) NSURL *location; // the location of the file represented by this track 477 | 478 | 479 | @end 480 | 481 | // a track representing an audio file (MP3, AIFF, etc.) 482 | @interface iTunesFileTrack : iTunesTrack 483 | 484 | @property (copy) NSURL *location; // the location of the file represented by this track 485 | 486 | - (void) refresh; // update file track information from the current information in the track’s file 487 | 488 | @end 489 | 490 | // a track residing in a shared library 491 | @interface iTunesSharedTrack : iTunesTrack 492 | 493 | 494 | @end 495 | 496 | // a track representing a network stream 497 | @interface iTunesURLTrack : iTunesTrack 498 | 499 | @property (copy) NSString *address; // the URL for this track 500 | 501 | 502 | @end 503 | 504 | // custom playlists created by the user 505 | @interface iTunesUserPlaylist : iTunesPlaylist 506 | 507 | - (SBElementArray *) fileTracks; 508 | - (SBElementArray *) URLTracks; 509 | - (SBElementArray *) sharedTracks; 510 | 511 | @property BOOL shared; // is this playlist shared? 512 | @property (readonly) BOOL smart; // is this a Smart Playlist? 513 | @property (readonly) BOOL genius; // is this a Genius Playlist? 514 | 515 | 516 | @end 517 | 518 | // a folder that contains other playlists 519 | @interface iTunesFolderPlaylist : iTunesUserPlaylist 520 | 521 | 522 | @end 523 | 524 | // a visual plug-in 525 | @interface iTunesVisual : iTunesItem 526 | 527 | 528 | @end 529 | 530 | // any window 531 | @interface iTunesWindow : iTunesItem 532 | 533 | @property NSRect bounds; // the boundary rectangle for the window 534 | @property (readonly) BOOL closeable; // does the window have a close button? 535 | @property (readonly) BOOL collapseable; // does the window have a collapse button? 536 | @property BOOL collapsed; // is the window collapsed? 537 | @property BOOL fullScreen; // is the window full screen? 538 | @property NSPoint position; // the upper left position of the window 539 | @property (readonly) BOOL resizable; // is the window resizable? 540 | @property BOOL visible; // is the window visible? 541 | @property (readonly) BOOL zoomable; // is the window zoomable? 542 | @property BOOL zoomed; // is the window zoomed? 543 | 544 | 545 | @end 546 | 547 | // the main iTunes window 548 | @interface iTunesBrowserWindow : iTunesWindow 549 | 550 | @property (copy, readonly) SBObject *selection; // the selected songs 551 | @property (copy) iTunesPlaylist *view; // the playlist currently displayed in the window 552 | 553 | 554 | @end 555 | 556 | // the iTunes equalizer window 557 | @interface iTunesEQWindow : iTunesWindow 558 | 559 | 560 | @end 561 | 562 | // the miniplayer window 563 | @interface iTunesMiniplayerWindow : iTunesWindow 564 | 565 | 566 | @end 567 | 568 | // a sub-window showing a single playlist 569 | @interface iTunesPlaylistWindow : iTunesWindow 570 | 571 | @property (copy, readonly) SBObject *selection; // the selected songs 572 | @property (copy, readonly) iTunesPlaylist *view; // the playlist displayed in the window 573 | 574 | 575 | @end 576 | 577 | // the video window 578 | @interface iTunesVideoWindow : iTunesWindow 579 | 580 | 581 | @end 582 | 583 | -------------------------------------------------------------------------------- /MacMediaKeyForwarder/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/milgra/macmediakeyforwarder/d6ff53a2fe966f509d6e3ea5a085e6a55038116e/MacMediaKeyForwarder/icon.png -------------------------------------------------------------------------------- /MacMediaKeyForwarder/icon.pxm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/milgra/macmediakeyforwarder/d6ff53a2fe966f509d6e3ea5a085e6a55038116e/MacMediaKeyForwarder/icon.pxm -------------------------------------------------------------------------------- /MacMediaKeyForwarder/icon@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/milgra/macmediakeyforwarder/d6ff53a2fe966f509d6e3ea5a085e6a55038116e/MacMediaKeyForwarder/icon@2x.png -------------------------------------------------------------------------------- /MacMediaKeyForwarder/ja.lproj/Localizable.strings: -------------------------------------------------------------------------------- 1 | "Send events to both players" = "両方のプレーヤーを操作"; 2 | "Open at login" = "ログイン時に起動"; 3 | "Prioritize iTunes" = "iTunesを優先"; 4 | "Prioritize Spotify" = "Spotifyを優先"; 5 | "Pause" = "一時動作停止"; 6 | "Pause if no player is running" = "プレーヤー未起動時に動作停止"; 7 | "Donate if you like the app" = "アプリを気に入ったら寄付"; 8 | "Check for updates" = "アップデートをチェック"; 9 | "Quit" = "終了"; 10 | "OK" = "OK"; 11 | "Cancel" = "キャンセル"; 12 | -------------------------------------------------------------------------------- /MacMediaKeyForwarder/ko.lproj/Localizable.strings: -------------------------------------------------------------------------------- 1 | /* 2 | Localizable.strings 3 | MacMediaKeyForwarder 4 | 5 | Created by Sungho Lee on 2017. 12. 27.. 6 | Copyright © 2017년 Milan Toth. All rights reserved. 7 | */ 8 | 9 | "Send events to both players" = "iTunes, Spotify에 모두 이벤트 보내기"; 10 | "Open at login" = "부팅시 자동 실행"; 11 | "Prioritize iTunes" = "iTunes에 우선권 부여"; 12 | "Prioritize Spotify" = "Spotify에 우선권 부여"; 13 | "Pause" = "일시정지 (macOS 기본값 사용)"; 14 | "Pause if no player is running" = "iTunes 또는 Spotify가 열려있지 않으면 일시정지"; 15 | "Donate if you like the app" = "이 앱이 마음에 들면 기부해주세요!"; 16 | "Check for updates" = "업데이트 확인"; 17 | "Quit" = "종료"; 18 | -------------------------------------------------------------------------------- /MacMediaKeyForwarder/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // 4 | // Created by Milan Toth on 2016. 12. 19.. 5 | // Copyright © 2016. Milan Toth. All rights reserved. 6 | // 7 | 8 | #import 9 | 10 | int main(int argc, const char * argv[]) { 11 | return NSApplicationMain(argc, argv); 12 | } 13 | -------------------------------------------------------------------------------- /MacMediaKeyForwarder/manualtest.txt: -------------------------------------------------------------------------------- 1 | Start with clean install ( delete app and com.milgra.hmske.plist from ~/Library/Preferences ) 2 | 3 | Default state : 4 | - check menu : 5 | - pause items should be disabled 6 | - send events to both players should be selected 7 | - check if app controls itunes/spotify individually and both running. 8 | - app shouldn't start music players automatically. 9 | 10 | iTunes state : 11 | - select Prioritize iTunes from the menu 12 | - check if app starts up iTunes automatically 13 | - check if play/pause/prev/next is working 14 | - check if fast forward/rewind is working 15 | - restart app and check if prioritize iTunes remains selected 16 | 17 | Spotify state : 18 | - select Prioritize Spotify from the menu 19 | - check if app starts up Spotify automatically 20 | - check if play/pause/prev/next is working 21 | - check if fast forward/rewind is working 22 | - restart app and check if prioritize Spotify remains selected 23 | 24 | Pause state : 25 | - select pause from the menu 26 | - app shouldn't forward events to player 27 | - macOS default media key behaviour should happen ( try it with a youtube video in safari ) 28 | 29 | Auto-Pause state : 30 | - select pause if no player is running from the menu 31 | - close iTunes and Spotify 32 | - app shouldn't forward events to player 33 | - macOS default media key behaviour should happen 34 | - open iTunes or Spotify 35 | - app should behave based on the selected priority option 36 | -------------------------------------------------------------------------------- /MacMediaKeyForwarder/nl.lproj/Localizable.strings: -------------------------------------------------------------------------------- 1 | /* 2 | Localizable.strings 3 | MacMediaKeyForwarder 4 | 5 | Created by Sebastiaan Pasma on 2019. 08. 16.. 6 | Copyright © 2017년 Milan Toth. All rights reserved. 7 | */ 8 | 9 | "Send events to both players" = "Stuur events naar beide spelers"; 10 | "Open at login" = "Openen bij inloggen"; 11 | "Prioritize iTunes" = "Prioriteer iTunes"; 12 | "Prioritize Spotify" = "Prioriteer Spotify"; 13 | "Pause" = "Pauze"; 14 | "Pause if no player is running" = "Pauzeren als er geen speler geopend is"; 15 | "Donate if you like the app" = "Doneren"; 16 | "Check for updates" = "Controleer op updates"; 17 | "Quit" = "Afsluiten"; 18 | "OK" = "OK"; 19 | "Cancel" = "Annuleren"; 20 | -------------------------------------------------------------------------------- /MacMediaKeyForwarder/pl.lproj/Localizable.strings: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | Localizable.strings 4 | HighSierraMediaKeyEnabler 5 | 6 | Created by Sungho Lee on 2017. 12. 27.. 7 | Copyright © 2017년 Milan Toth. All rights reserved. 8 | */ 9 | 10 | "Send events to both players" = "Wyślij zdarzenie do obu odtwarzaczy"; 11 | "Open at login" = "Otwórz przy zalogowaniu"; 12 | "Prioritize iTunes" = "Priorytetyzuj iTunes"; 13 | "Prioritize Spotify" = "Priorytetyzuj Spotify"; 14 | "Pause" = "Pauza"; 15 | "Pause if no player is running" = "Zapauzuj, jeśli żaden odtwarzacz nie jest uruchomiony"; 16 | "Donate if you like the app" = "Wesprzyj, jeśli lubisz tę aplikację"; 17 | "Check for updates" = "Sprawdź uaktualnienia"; 18 | "Quit" = "Wyjdź"; 19 | "OK" = "OK"; 20 | "Cancel" = "Anuluj"; 21 | -------------------------------------------------------------------------------- /MacMediaKeyForwarder/ru.lproj/Localizable.strings: -------------------------------------------------------------------------------- 1 | /* 2 | Localizable.strings 3 | HighSierraMediaKeyEnabler 4 | 5 | Created by e1ectron on 2018. 02. 12.. 6 | Copyright © 2018년 Milan Toth. All rights reserved. 7 | */ 8 | 9 | "Send events to both players" = "Отправлять события на оба плеера"; 10 | "Prioritize iTunes" = "Предпочитать iTunes"; 11 | "Prioritize Spotify" = "Предпочитать Spotify"; 12 | "Pause" = "Пауза"; 13 | "Pause if no player is running" = "Пауза, если ни один плеер не запущен"; 14 | "Donate if you like the app" = "Поддержать разработку"; 15 | "Check for updates" = "Проверить обновления"; 16 | "Quit" = "Завершить"; 17 | -------------------------------------------------------------------------------- /MacMediaKeyForwarder/zh-Hant.lproj/Localizable.strings: -------------------------------------------------------------------------------- 1 | "Send events to both players" = "同時控制 iTunes 及 Spotify"; 2 | "Open at login" = "登入時開啟"; 3 | "Hide from menu bar" = "從選單列中隱藏"; 4 | "Prioritize iTunes" = "iTunes 優先"; 5 | "Prioritize Spotify" = "Spotify 優先"; 6 | "Pause" = "暫停"; 7 | "Pause if no player is running" = "無播放器執行時暫停"; 8 | "Donate if you like the app" = "如果喜歡這款應用歡迎贊助"; 9 | "Check for updates" = "檢查更新"; 10 | "Quit" = "結束"; 11 | "OK" = "OK"; 12 | "Cancel" = "取消"; 13 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Mac Media Key Forwarder [![Build Status](https://travis-ci.org/milgra/macmediakeyforwarder.svg?branch=master)](https://travis-ci.org/milgra/macmediakeyforwarder#) 2 | 3 | Mac Media Key Forwarder for [iTunes](https://www.apple.com/itunes/) and [Spotify](http://www.spotify.com). 4 | 5 | ## For the latest version and bugfixes use quentinlesceller's fork : https://github.com/quentinlesceller/macmediakeyforwarder/releases 6 | 7 | Forwards media keys to iTunes or Spotify directly. 8 | 9 | You can prioritize which app you would like to control or you can go with the default behaviour which controls the running app. 10 | 11 | The app runs in the menu bar. 12 | 13 | Download the compiled application from my [Releases](https://github.com/milgra/macmediakeyforwarder/releases). 14 | 15 | If you want even more control over what you want to control you should try [beardedspice](http://beardedspice.github.io). 16 | 17 | **Issues you should know about** 18 | 19 | The app listens on the event tap for key events. This causes problems in some rare cases, like 20 | - when changing search engine in Safari's preferences window 21 | - when trying to allow third-party kernel extensions 22 | 23 | In these cases simply pause Mac Media Key Forwarder from it's menu. 24 | 25 | **Installation & MacOS Mojave Compatibility** 26 | 27 | The app itself is compatible with Mojave, but you need to add it as trusted application in order to make it function properly. 28 | 29 | You can do this with these steps: 30 | 1. Go to **System Preferences** > **Security & Privacy** 31 | 2. Open the **Privacy** tab, and look for **Accessibility** in the left list 32 | 3. Turn on the checkbox for **MacMediaKeyForwarder.app** in the right list 33 | 2. Look for **Automation** in the left list 34 | 3. Turn on the checkbox for **iTunes.app** and **Spotifiy.app** under **MacMediaKeyForwarder.app** in the right list 35 | 4. Run the app again 36 | 37 | ![Security Setting](security_a.png) 38 | 39 | ![Security Setting](security_b.png) 40 | 41 | **Other milgra utilities you might be interested in** 42 | 43 | [mac audio keepalive](https://github.com/milgra/macaudiokeepalive) 44 | 45 | [airpods sound quality fixer](https://github.com/milgra/airpodssoundqualityfixer) 46 | 47 | [fat fingers keyboard for iphone](https://github.com/milgra/fatfingerskeyboard) 48 | 49 | --- 50 | 51 | **Contributors :** 52 | * Michael Dorner ([@michaeldorner](http://github.com/michaeldorner)) 53 | * Matt Chaput ([@mchaput](http://github.com/mchaput)) 54 | * Ben Kropf ([@ben-kropf](http://github.com/ben-kropf)) 55 | * Alejandro Iván ([@alejandroivan](http://github.com/alejandroivan)) 56 | * Sungho Lee ([@sh1217sh](http://github.com/sh1217sh)) 57 | * Björn Büschke ([@maciboy](http://github.com/maciboy)) 58 | * Sergei Solovev ([@e1ectron](http://github.com/e1ectron)) 59 | * Munkácsi Márk ([@munkacsimark](http://github.com/munkacsimark)) 60 | * Irvin Lim ([@irvinlim](https://github.com/irvinlim)) 61 | * Simon Seku ([@SimonSeku](https://github.com/SimonSeku)) 62 | * Dave Nicolson ([@dnicolson](https://github.com/dnicolson)) 63 | * teemue ([@teemue](https://github.com/teemue)) 64 | * takamu ([@takamu](https://github.com/takamu)) 65 | * Alex ([@sashoism](https://github.com/sashoism)) 66 | * Sebastiaan Pasma ([@spasma](https://github.com/spasma)) 67 | * WiktorBuczko ([@WiktorBuczko](https://github.com/WiktorBuczko)) 68 | * Andy White ([@arcwhite](https://github.com/arcwhite)) 69 | * xjbeta ([@xjbeta](https://github.com/xjbeta)) 70 | * Jules Coynel ([@jcoynel](https://github.com/jcoynel)) 71 | 72 | Thank you!!! 73 | 74 | --- 75 | 76 | *What's new in version 3.1 :* 77 | - Ability to hide the menu icon 78 | - French translation 79 | 80 | *What's new in version 3.0 :* 81 | - Catalina compatibility 82 | 83 | *What's new in version 2.8 :* 84 | - Polish localization 85 | - Fixed broken Japanese, Finnish, Dutch localization 86 | 87 | *What's new in version 2.7 :* 88 | - Dutch localization 89 | 90 | *What's new in version 2.6 :* 91 | - Enabled undocking status bar item 92 | 93 | *What's new in version 2.5 :* 94 | - Finnish, Japanese localization 95 | - Modified Accessibility Instructions 96 | 97 | *What's new in version 2.3 :* 98 | - Korean, Danish, Russian and Hungarian localization is linked back to the project ( they got lost somewhere :( ) 99 | 100 | *What's new in version 2.2 :* 101 | - MacOS Mojave 10.14.2 fix, showing notification pop-up if tap cannot be created 102 | 103 | *What's new in version 2.1 :* 104 | - app brings up permission popups if permission is not granted for Accessibility and Automation Target 105 | 106 | What's new in version 2.0 : 107 | - app renamed to Mac Media Key Forwarder 108 | - Hungarian localization 109 | - updated icon 110 | - Open At Login state is checked every time the menu is opened so it shows an updated state 111 | - added installation steps to readme because increased MacOS security made it more confusing 112 | - added event-tap related issues to readme because it can cause head scratches in some special cases 113 | 114 | What's new in version 1.9 : 115 | - added open at login menu option 116 | - German localization update 117 | - Korean localization update 118 | 119 | What's new in version 1.8 : 120 | - added pause menu option 121 | - added pause automatically menu option : if no music player is running macOS default behavior is used and keys are forwarded to currently active media player 122 | - Russian localization 123 | - German localization 124 | - Spanish localization 125 | - fixed headphone button issue 126 | - added macOS Sierra compatibility if you want explicit music player control there 127 | 128 | What's new in version 1.7 : 129 | - fast forward/rewind is possible when iTunes is selected explicitly 130 | - Korean localization 131 | - rumors say that it works with TouchBar 132 | 133 | What's new in version 1.6 : 134 | - increased compatibility with external keyboards 135 | 136 | What's new in version 1.5 : 137 | - now you can explicitly prioritize iTunes or Spotify 138 | - play button now starts up iTunes or Spotify if they are not running aaaand explicitly selected 139 | 140 | What's new in version 1.4 : 141 | - memory leak fixed 142 | 143 | What's new in version 1.3 : 144 | - previousTrack replaced with backTrack in case of iTunes for a better experience 145 | 146 | What's new in version 1.2 : 147 | - new icon 148 | - source code is super tight now 149 | - developer id signed, its a trusted app now 150 | 151 | --- 152 | -------------------------------------------------------------------------------- /security_a.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/milgra/macmediakeyforwarder/d6ff53a2fe966f509d6e3ea5a085e6a55038116e/security_a.png -------------------------------------------------------------------------------- /security_b.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/milgra/macmediakeyforwarder/d6ff53a2fe966f509d6e3ea5a085e6a55038116e/security_b.png --------------------------------------------------------------------------------