Skip to content

Commit

Permalink
iTunes-AirPlay, System, music -> app_volume, 1.1.0
Browse files Browse the repository at this point in the history
AirPlay for iTunes was added in this update. Find it in the volume
screen of the iTunes player. System was also added. Gives the ability to
click keyboard arrow keys, space bar, and change the system volume.

When changing volume for Spotify for iTunes, it controls the app volume
instead.

Also, version 1.1.0.
  • Loading branch information
tyhoff committed Jan 3, 2015
1 parent 3a1bc60 commit cd88df1
Show file tree
Hide file tree
Showing 16 changed files with 54 additions and 21 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
sparkle/

# extra
archive

Expand Down
20 changes: 20 additions & 0 deletions SimonRemote.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@
2FD6924F18DD06CD00C8A1C9 /* System-volume_down.scpt in Resources */ = {isa = PBXBuildFile; fileRef = 2FD6924D18DD06CD00C8A1C9 /* System-volume_down.scpt */; };
2FD6925018DD06CD00C8A1C9 /* System-volume_up.scpt in Resources */ = {isa = PBXBuildFile; fileRef = 2FD6924E18DD06CD00C8A1C9 /* System-volume_up.scpt */; };
2FD6929318DFD57200C8A1C9 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2FD6929218DFD57200C8A1C9 /* SystemConfiguration.framework */; };
69121DED1A5601D8007C56B2 /* Spotify-volume_down.scpt in Resources */ = {isa = PBXBuildFile; fileRef = 69121DEB1A5601D8007C56B2 /* Spotify-volume_down.scpt */; };
69121DEE1A5601D8007C56B2 /* Spotify-volume_up.scpt in Resources */ = {isa = PBXBuildFile; fileRef = 69121DEC1A5601D8007C56B2 /* Spotify-volume_up.scpt */; };
69121DF11A5601E3007C56B2 /* iTunes-volume_down.scpt in Resources */ = {isa = PBXBuildFile; fileRef = 69121DEF1A5601E3007C56B2 /* iTunes-volume_down.scpt */; };
69121DF21A5601E3007C56B2 /* iTunes-volume_up.scpt in Resources */ = {isa = PBXBuildFile; fileRef = 69121DF01A5601E3007C56B2 /* iTunes-volume_up.scpt */; };
69BF9C6F1A5756CF00425055 /* System-mouse_click.scpt in Resources */ = {isa = PBXBuildFile; fileRef = 69BF9C6E1A5756CF00425055 /* System-mouse_click.scpt */; };
DD4F7C0913C30F9F00825C6E /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DD4F7C0813C30F9F00825C6E /* Cocoa.framework */; };
DD4F7C1513C30F9F00825C6E /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = DD4F7C1413C30F9F00825C6E /* main.m */; };
DD4F7C1C13C30F9F00825C6E /* ApplicationDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = DD4F7C1B13C30F9F00825C6E /* ApplicationDelegate.m */; };
Expand Down Expand Up @@ -146,6 +151,11 @@
2FD6924D18DD06CD00C8A1C9 /* System-volume_down.scpt */ = {isa = PBXFileReference; lastKnownFileType = file; name = "System-volume_down.scpt"; path = "SimonRemote/Scripts/System/System-volume_down.scpt"; sourceTree = "<group>"; };
2FD6924E18DD06CD00C8A1C9 /* System-volume_up.scpt */ = {isa = PBXFileReference; lastKnownFileType = file; name = "System-volume_up.scpt"; path = "SimonRemote/Scripts/System/System-volume_up.scpt"; sourceTree = "<group>"; };
2FD6929218DFD57200C8A1C9 /* SystemConfiguration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SystemConfiguration.framework; path = System/Library/Frameworks/SystemConfiguration.framework; sourceTree = SDKROOT; };
69121DEB1A5601D8007C56B2 /* Spotify-volume_down.scpt */ = {isa = PBXFileReference; lastKnownFileType = file; name = "Spotify-volume_down.scpt"; path = "simonremote/Scripts/Spotify/Spotify-volume_down.scpt"; sourceTree = "<group>"; };
69121DEC1A5601D8007C56B2 /* Spotify-volume_up.scpt */ = {isa = PBXFileReference; lastKnownFileType = file; name = "Spotify-volume_up.scpt"; path = "simonremote/Scripts/Spotify/Spotify-volume_up.scpt"; sourceTree = "<group>"; };
69121DEF1A5601E3007C56B2 /* iTunes-volume_down.scpt */ = {isa = PBXFileReference; lastKnownFileType = file; name = "iTunes-volume_down.scpt"; path = "simonremote/Scripts/iTunes/iTunes-volume_down.scpt"; sourceTree = "<group>"; };
69121DF01A5601E3007C56B2 /* iTunes-volume_up.scpt */ = {isa = PBXFileReference; lastKnownFileType = file; name = "iTunes-volume_up.scpt"; path = "simonremote/Scripts/iTunes/iTunes-volume_up.scpt"; sourceTree = "<group>"; };
69BF9C6E1A5756CF00425055 /* System-mouse_click.scpt */ = {isa = PBXFileReference; lastKnownFileType = file; name = "System-mouse_click.scpt"; path = "simonremote/Scripts/System/System-mouse_click.scpt"; sourceTree = "<group>"; };
DD4F7C0413C30F9F00825C6E /* SimonRemote.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SimonRemote.app; sourceTree = BUILT_PRODUCTS_DIR; };
DD4F7C0813C30F9F00825C6E /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; };
DD4F7C0B13C30F9F00825C6E /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; };
Expand Down Expand Up @@ -201,6 +211,8 @@
2F921E1918DA13EF006E2934 /* iTunes */ = {
isa = PBXGroup;
children = (
69121DEF1A5601E3007C56B2 /* iTunes-volume_down.scpt */,
69121DF01A5601E3007C56B2 /* iTunes-volume_up.scpt */,
2FAB73951906D88700F36112 /* iTunes-next.scpt */,
2FAB73961906D88700F36112 /* iTunes-previous.scpt */,
2F21FA871904C812002DD68B /* iTunes-disable_shuffle.scpt */,
Expand All @@ -216,6 +228,8 @@
2F921E1A18DA13F9006E2934 /* Spotify */ = {
isa = PBXGroup;
children = (
69121DEB1A5601D8007C56B2 /* Spotify-volume_down.scpt */,
69121DEC1A5601D8007C56B2 /* Spotify-volume_up.scpt */,
2FAB73911906D87900F36112 /* Spotify-next.scpt */,
2FAB73921906D87900F36112 /* Spotify-previous.scpt */,
2FAB738B19060B0C00F36112 /* Spotify-disable_shuffle.scpt */,
Expand Down Expand Up @@ -286,6 +300,7 @@
2FD6924C18DD065000C8A1C9 /* System */ = {
isa = PBXGroup;
children = (
69BF9C6E1A5756CF00425055 /* System-mouse_click.scpt */,
2FCFACA219119C8D00508B0A /* System-down.scpt */,
2FCFACA319119C8D00508B0A /* System-info.scpt */,
2FCFACA419119C8D00508B0A /* System-left.scpt */,
Expand Down Expand Up @@ -475,12 +490,14 @@
2FD6923E18DBEB0800C8A1C9 /* iTunes-playpause.scpt in Resources */,
2F921E3318DA52E7006E2934 /* PowerPoint-previous.scpt in Resources */,
2FD6925018DD06CD00C8A1C9 /* System-volume_up.scpt in Resources */,
69121DED1A5601D8007C56B2 /* Spotify-volume_down.scpt in Resources */,
2FCFACA819119C8D00508B0A /* System-down.scpt in Resources */,
2F921E2D18DA4E72006E2934 /* PowerPoint-start_slideshow.scpt in Resources */,
2F9B1D8C18D2B82700A41633 /* bottomright.png in Resources */,
2F80476A18D3FCB50078905C /* Spotify-play.scpt in Resources */,
2FCFACAD19119C8D00508B0A /* System-up.scpt in Resources */,
2F21FA8A1904C812002DD68B /* iTunes-enable_shuffle.scpt in Resources */,
69BF9C6F1A5756CF00425055 /* System-mouse_click.scpt in Resources */,
2FD6924018DCA70B00C8A1C9 /* iTunes-info.scpt in Resources */,
2F921E2E18DA4E72006E2934 /* PowerPoint-white_screen.scpt in Resources */,
2FCFACAB19119C8D00508B0A /* System-right.scpt in Resources */,
Expand All @@ -489,12 +506,14 @@
2FAB739E1906D8B200F36112 /* Keynote-info.scpt in Resources */,
2F9B1D8F18D2B82700A41633 /* StatusHighlighted.png in Resources */,
2FAB73A11906D8B200F36112 /* Keynote-start_slideshow.scpt in Resources */,
69121DF11A5601E3007C56B2 /* iTunes-volume_down.scpt in Resources */,
2FAB738E19060B0C00F36112 /* Spotify-enable_shuffle.scpt in Resources */,
2FD6924618DCD30500C8A1C9 /* Spotify-info.scpt in Resources */,
2F921E1718DA13DA006E2934 /* iTunes-play.scpt in Resources */,
2FAB73A01906D8B200F36112 /* Keynote-previous.scpt in Resources */,
2FCFACA919119C8D00508B0A /* System-info.scpt in Resources */,
2FAB73941906D87900F36112 /* Spotify-previous.scpt in Resources */,
69121DF21A5601E3007C56B2 /* iTunes-volume_up.scpt in Resources */,
2F9B1D9018D2B82700A41633 /* StatusHighlighted@2x.png in Resources */,
2F9B1D9118D2B82700A41633 /* MainMenu.xib in Resources */,
2F80475B18D3FC9F0078905C /* bottomleft.png in Resources */,
Expand All @@ -512,6 +531,7 @@
2FD6924F18DD06CD00C8A1C9 /* System-volume_down.scpt in Resources */,
2F80476F18D422F70078905C /* PreferenceWindow.xib in Resources */,
2FA264D6191C9D4200AF1175 /* dsa_pub.pem in Resources */,
69121DEE1A5601D8007C56B2 /* Spotify-volume_up.scpt in Resources */,
2FC01AA71922DCC7007D56F6 /* Status@2x.png in Resources */,
2FAB73981906D88700F36112 /* iTunes-previous.scpt in Resources */,
2F9B1D9218D2B82700A41633 /* Panel.xib in Resources */,
Expand Down
49 changes: 30 additions & 19 deletions SimonRemote/SRActionHandler.m
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ + (void) handleCommand:(NSString *)command forApplication:(NSString *)app
[SRRunner runScriptFromFile:@"iTunes-playpause"];

} else if (string_equal(command, @"volume_up")) {
[SRRunner runScriptFromFile:@"System-volume_up"];
[SRRunner runScriptFromFile:@"iTunes-volume_up"];

} else if (string_equal(command, @"volume_down")) {
[SRRunner runScriptFromFile:@"System-volume_down"];
[SRRunner runScriptFromFile:@"iTunes-volume_down"];

} else if (string_equal(command, @"enable_shuffle")) {
NSLog(@"enable_shufle ran\n");
Expand All @@ -53,6 +53,22 @@ + (void) handleCommand:(NSString *)command forApplication:(NSString *)app
NSLog(@"disable_shufle ran\n");
[SRRunner runScriptFromFile:@"iTunes-disable_shuffle"];
[NSThread sleepForTimeInterval:1.0f];

} else if([command hasPrefix:@"airplay_set-"]) {
// Written by https://github.com/inonprince
NSString* deviceName = nil;
deviceName = [command substringFromIndex:12];
NSString *script = @"set selecteddevice to \"%@\"\n"
"tell application \"iTunes\"\n"
"set apDevices to (get every AirPlay device whose available is true)\n"
"set apNames to (get name of every AirPlay device whose available is true)\n"
"set apChoices to {}\n"
"repeat with i from 1 to length of apNames\n"
"if item i of apNames is selecteddevice then set end of apChoices to item i of apDevices\n"
"end repeat\n"
"set current AirPlay devices to apChoices\n"
"end tell";
[SRRunner runScriptFromString:[NSString stringWithFormat:script, deviceName]];
}

/* Spotify */
Expand All @@ -74,10 +90,10 @@ + (void) handleCommand:(NSString *)command forApplication:(NSString *)app
[SRRunner runScriptFromFile:@"Spotify-playpause"];

} else if (string_equal(command, @"volume_up")) {
[SRRunner runScriptFromFile:@"System-volume_up"];
[SRRunner runScriptFromFile:@"Spotify-volume_up"];

} else if (string_equal(command, @"volume_down")) {
[SRRunner runScriptFromFile:@"System-volume_down"];
[SRRunner runScriptFromFile:@"Spotify-volume_down"];

} else if (string_equal(command, @"enable_shuffle")) {
[SRRunner runScriptFromFile:@"Spotify-enable_shuffle"];
Expand All @@ -88,7 +104,7 @@ + (void) handleCommand:(NSString *)command forApplication:(NSString *)app
} else if (string_equal(command, @"info")) {
[SRRunner runScriptFromFile:@"Spotify-info"];
}

/* PowerPoint */
} else if (string_equal(app, @"PowerPoint")) {

Expand Down Expand Up @@ -134,33 +150,27 @@ + (void) handleCommand:(NSString *)command forApplication:(NSString *)app
/* System */
} else if (string_equal(app, @"System")) {

if (string_equal(command, @"next")) {
if (string_equal(command, @"left")) {
[SRRunner runScriptFromFile:@"System-left"];

} else if (string_equal(command, @"previous")) {
} else if (string_equal(command, @"right")) {
[SRRunner runScriptFromFile:@"System-right"];

} else if (string_equal(command, @"previous")) {
} else if (string_equal(command, @"up")) {
[SRRunner runScriptFromFile:@"System-up"];

} else if (string_equal(command, @"previous")) {
} else if (string_equal(command, @"down")) {
[SRRunner runScriptFromFile:@"System-down"];

} else if (string_equal(command, @"previous")) {
} else if (string_equal(command, @"space")) {
[SRRunner runScriptFromFile:@"System-space"];

} else if (string_equal(command, @"previous")) {
} else if (string_equal(command, @"volume_up")) {
[SRRunner runScriptFromFile:@"System-volume_up"];

} else if (string_equal(command, @"previous")) {
} else if (string_equal(command, @"volume_down")) {
[SRRunner runScriptFromFile:@"System-volume_down"];

} else if (string_equal(command, @"previous")) {
[SRRunner runScriptFromFile:@"System-sleep"];

} else if (string_equal(command, @"previous")) {
[SRRunner runScriptFromFile:@"System-reboot"];

}
}
}
Expand All @@ -176,7 +186,8 @@ + (NSDictionary *) getInfoForApplication:(NSString *)app
} else if (string_equal(app, @"Keynote")) {
return [SRRunner runScriptFromFile:@"Keynote-info"];
} else if (string_equal(app, @"System")) {
return [SRRunner runScriptFromFile:@"System-info"];
// It doesn't return anything useful, so let's not put forth effort.
// return [SRRunner runScriptFromFile:@"System-info"];
}

return nil;
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified SimonRemote/Scripts/System/System-volume_down.scpt
Binary file not shown.
Binary file modified SimonRemote/Scripts/System/System-volume_up.scpt
Binary file not shown.
Binary file modified SimonRemote/Scripts/iTunes/iTunes-disable_shuffle.scpt
Binary file not shown.
Binary file modified SimonRemote/Scripts/iTunes/iTunes-enable_shuffle.scpt
Binary file not shown.
Binary file modified SimonRemote/Scripts/iTunes/iTunes-info.scpt
Binary file not shown.
Binary file not shown.
Binary file added SimonRemote/Scripts/iTunes/iTunes-volume_up.scpt
Binary file not shown.
4 changes: 2 additions & 2 deletions SimonRemote/SimonRemote-Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0.1</string>
<string>1.1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.0.1</string>
<string>1.1.0</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.utilities</string>
<key>LSMinimumSystemVersion</key>
Expand Down
Binary file added SimonRemote/oldStatusHighlighted.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added SimonRemote/oldStatusHighlighted@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit cd88df1

Please sign in to comment.