Skip to content
This repository has been archived by the owner on Apr 30, 2022. It is now read-only.

Commit

Permalink
add preliminary support for Catalina (issue #3)
Browse files Browse the repository at this point in the history
  • Loading branch information
rpendleton committed Oct 3, 2020
1 parent 97409b8 commit 0d54c94
Show file tree
Hide file tree
Showing 8 changed files with 287 additions and 183 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ On a standard installation of macOS, pressing the playback control keys on an
Apple keyboard opens iTunes if no other media applications are open. The purpose
of this project is to patch this behavior such that Spotify is opened instead.

## :warning: Catalina support is experimental

This project hasn't worked since High Sierra. This branch is a work-in-progress
that adds support for Catalina, but the instructions and installer are outdated,
nor have I tested the changes thoroughly. If you want to try your luck, you can
use this branch to patch the `com.apple.mediaremoted` launch daemon instead of
`com.apple.rcd`.

## :warning: Compatibility

This is the README for the legacy version of the project. The legacy version is
Expand Down
69 changes: 36 additions & 33 deletions SpotifyRCD.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,7 @@
/* Begin PBXBuildFile section */
76491CB918E0BCB800803BC4 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 76491CB818E0BCB800803BC4 /* Cocoa.framework */; };
76491CC318E0BCB800803BC4 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 76491CC118E0BCB800803BC4 /* InfoPlist.strings */; };
7686988419D392BB00BBECD9 /* next.wav in Resources */ = {isa = PBXBuildFile; fileRef = 7686988019D392BB00BBECD9 /* next.wav */; };
7686988519D392BB00BBECD9 /* pause.wav in Resources */ = {isa = PBXBuildFile; fileRef = 7686988119D392BB00BBECD9 /* pause.wav */; };
7686988619D392BB00BBECD9 /* play.wav in Resources */ = {isa = PBXBuildFile; fileRef = 7686988219D392BB00BBECD9 /* play.wav */; };
7686988719D392BB00BBECD9 /* prev.wav in Resources */ = {isa = PBXBuildFile; fileRef = 7686988319D392BB00BBECD9 /* prev.wav */; };
76EF46C618E0C6480025394C /* NSAppleScript+SpotifyRCD.m in Sources */ = {isa = PBXBuildFile; fileRef = 76EF46C518E0C6480025394C /* NSAppleScript+SpotifyRCD.m */; };
76EF46C618E0C6480025394C /* MRDRemoteControlServer+SpotifyRCD.m in Sources */ = {isa = PBXBuildFile; fileRef = 76EF46C518E0C6480025394C /* MRDRemoteControlServer+SpotifyRCD.m */; };
76EF46C918E0C6660025394C /* JRSwizzle.m in Sources */ = {isa = PBXBuildFile; fileRef = 76EF46C818E0C6660025394C /* JRSwizzle.m */; };
/* End PBXBuildFile section */

Expand All @@ -26,12 +22,7 @@
76491CC018E0BCB800803BC4 /* SpotifyRCD-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "SpotifyRCD-Info.plist"; sourceTree = "<group>"; };
76491CC218E0BCB800803BC4 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
76491CC418E0BCB800803BC4 /* SpotifyRCD-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "SpotifyRCD-Prefix.pch"; sourceTree = "<group>"; };
7686988019D392BB00BBECD9 /* next.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; path = next.wav; sourceTree = "<group>"; };
7686988119D392BB00BBECD9 /* pause.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; path = pause.wav; sourceTree = "<group>"; };
7686988219D392BB00BBECD9 /* play.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; path = play.wav; sourceTree = "<group>"; };
7686988319D392BB00BBECD9 /* prev.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; path = prev.wav; sourceTree = "<group>"; };
76EF46C418E0C6480025394C /* NSAppleScript+SpotifyRCD.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSAppleScript+SpotifyRCD.h"; sourceTree = "<group>"; };
76EF46C518E0C6480025394C /* NSAppleScript+SpotifyRCD.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSAppleScript+SpotifyRCD.m"; sourceTree = "<group>"; };
76EF46C518E0C6480025394C /* MRDRemoteControlServer+SpotifyRCD.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "MRDRemoteControlServer+SpotifyRCD.m"; sourceTree = "<group>"; };
76EF46C718E0C6660025394C /* JRSwizzle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JRSwizzle.h; sourceTree = "<group>"; };
76EF46C818E0C6660025394C /* JRSwizzle.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JRSwizzle.m; sourceTree = "<group>"; };
/* End PBXFileReference section */
Expand Down Expand Up @@ -87,10 +78,8 @@
76491CBE18E0BCB800803BC4 /* SpotifyRCD */ = {
isa = PBXGroup;
children = (
7686987F19D392BB00BBECD9 /* Sounds */,
76491CBF18E0BCB800803BC4 /* Supporting Files */,
76EF46C418E0C6480025394C /* NSAppleScript+SpotifyRCD.h */,
76EF46C518E0C6480025394C /* NSAppleScript+SpotifyRCD.m */,
76EF46C518E0C6480025394C /* MRDRemoteControlServer+SpotifyRCD.m */,
);
path = SpotifyRCD;
sourceTree = "<group>";
Expand All @@ -107,18 +96,6 @@
name = "Supporting Files";
sourceTree = "<group>";
};
7686987F19D392BB00BBECD9 /* Sounds */ = {
isa = PBXGroup;
children = (
7686988019D392BB00BBECD9 /* next.wav */,
7686988119D392BB00BBECD9 /* pause.wav */,
7686988219D392BB00BBECD9 /* play.wav */,
7686988319D392BB00BBECD9 /* prev.wav */,
);
name = Sounds;
path = sounds;
sourceTree = "<group>";
};
/* End PBXGroup section */

/* Begin PBXNativeTarget section */
Expand All @@ -145,15 +122,16 @@
76491CAD18E0BCB800803BC4 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0510;
LastUpgradeCheck = 1140;
ORGANIZATIONNAME = "Inline-Studios";
};
buildConfigurationList = 76491CB018E0BCB800803BC4 /* Build configuration list for PBXProject "SpotifyRCD" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = 76491CAC18E0BCB800803BC4;
productRefGroup = 76491CB618E0BCB800803BC4 /* Products */;
Expand All @@ -170,11 +148,7 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
7686988719D392BB00BBECD9 /* prev.wav in Resources */,
76491CC318E0BCB800803BC4 /* InfoPlist.strings in Resources */,
7686988419D392BB00BBECD9 /* next.wav in Resources */,
7686988619D392BB00BBECD9 /* play.wav in Resources */,
7686988519D392BB00BBECD9 /* pause.wav in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand All @@ -186,7 +160,7 @@
buildActionMask = 2147483647;
files = (
76EF46C918E0C6660025394C /* JRSwizzle.m in Sources */,
76EF46C618E0C6480025394C /* NSAppleScript+SpotifyRCD.m in Sources */,
76EF46C618E0C6480025394C /* MRDRemoteControlServer+SpotifyRCD.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand All @@ -212,18 +186,32 @@
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
Expand All @@ -250,19 +238,32 @@
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = YES;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
Expand All @@ -282,6 +283,7 @@
GCC_PREFIX_HEADER = "SpotifyRCD/SpotifyRCD-Prefix.pch";
INFOPLIST_FILE = "SpotifyRCD/SpotifyRCD-Info.plist";
MACH_O_TYPE = mh_dylib;
PRODUCT_BUNDLE_IDENTIFIER = me.ryanp.mac.inject.SpotifyRCD;
PRODUCT_NAME = "$(TARGET_NAME)";
WRAPPER_EXTENSION = bundle;
};
Expand All @@ -295,6 +297,7 @@
GCC_PREFIX_HEADER = "SpotifyRCD/SpotifyRCD-Prefix.pch";
INFOPLIST_FILE = "SpotifyRCD/SpotifyRCD-Info.plist";
MACH_O_TYPE = mh_dylib;
PRODUCT_BUNDLE_IDENTIFIER = me.ryanp.mac.inject.SpotifyRCD;
PRODUCT_NAME = "$(TARGET_NAME)";
WRAPPER_EXTENSION = bundle;
};
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
41 changes: 38 additions & 3 deletions SpotifyRCD/JRSwizzle.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// JRSwizzle.h semver:1.0
// Copyright (c) 2007-2011 Jonathan 'Wolf' Rentzsch: http://rentzsch.com
// Some rights reserved: http://opensource.org/licenses/MIT
// JRSwizzle.h semver:1.1.0
// Copyright (c) 2007-2016 Jonathan 'Wolf' Rentzsch: http://rentzsch.com
// Some rights reserved: http://opensource.org/licenses/mit
// https://github.com/rentzsch/jrswizzle

#import <Foundation/Foundation.h>
Expand All @@ -10,4 +10,39 @@
+ (BOOL)jr_swizzleMethod:(SEL)origSel_ withMethod:(SEL)altSel_ error:(NSError**)error_;
+ (BOOL)jr_swizzleClassMethod:(SEL)origSel_ withClassMethod:(SEL)altSel_ error:(NSError**)error_;


/**
```
__block NSInvocation *invocation = nil;
invocation = [self jr_swizzleMethod:@selector(initWithCoder:) withBlock:^(id obj, NSCoder *coder) {
NSLog(@"before %@, coder %@", obj, coder);
[invocation setArgument:&coder atIndex:2];
[invocation invokeWithTarget:obj];
id ret = nil;
[invocation getReturnValue:&ret];
NSLog(@"after %@, coder %@", obj, coder);
return ret;
} error:nil];
```
*/
+ (NSInvocation*)jr_swizzleMethod:(SEL)origSel withBlock:(id)block error:(NSError**)error;

/**
```
__block NSInvocation *classInvocation = nil;
classInvocation = [self jr_swizzleClassMethod:@selector(test) withBlock:^() {
NSLog(@"before");
[classInvocation invoke];
NSLog(@"after");
} error:nil];
```
*/
+ (NSInvocation*)jr_swizzleClassMethod:(SEL)origSel withBlock:(id)block error:(NSError**)error;

@end
Loading

0 comments on commit 0d54c94

Please sign in to comment.