Skip to content

Instantly share code, notes, and snippets.

@ianloic
Created September 16, 2011 00:46
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ianloic/1220902 to your computer and use it in GitHub Desktop.
Save ianloic/1220902 to your computer and use it in GitHub Desktop.
Tell the Rdio desktop app to search
/* Build this with:
* gcc desktopsearch.m -o desktopsearch -ObjC -framework Cocoa
*/
#include <Cocoa/Cocoa.h>
int main(int argc, char** argv) {
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
if (argc == 2) {
NSString* url = [NSString stringWithFormat: @"http://www.rdio.com/#/search/%s/",
argv[1]];
[[NSWorkspace sharedWorkspace]
openURLs:[[NSArray alloc] initWithObjects:[NSURL URLWithString:url],nil]
withAppBundleIdentifier:@"com.rdio.Desktop"
options:NSWorkspaceLaunchDefault
additionalEventParamDescriptor:NULL
launchIdentifiers:NULL];
} else {
printf("%s <search query>\n", argv[0]);
}
[pool release];
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment