diff --git a/radiant-player-mac/AppDelegate.m b/radiant-player-mac/AppDelegate.m
index 3f0dbeee..a781a74d 100644
--- a/radiant-player-mac/AppDelegate.m
+++ b/radiant-player-mac/AppDelegate.m
@@ -70,6 +70,27 @@ - (void)receiveSleepNotification:(NSNotification*)notification
[self playPause:self];
}
+#pragma mark - screen locked/unlocked events
+
+- (void)RadiantScreenLocked {
+
+ if ([defaults boolForKey:@"toggleMusicOnScreenLock"])
+ {
+ if (currentPlaybackMode == MUSIC_PLAYING) {
+ [self playPause:self];
+ }
+ }
+}
+
+- (void)RadiantScreenUnlocked {
+ if ([defaults boolForKey:@"toggleMusicOnScreenLock"])
+ {
+ if (currentPlaybackMode == MUSIC_PAUSED) {
+ [self playPause:self];
+ }
+ }
+}
+
/**
* Application finished launching, we will register the event tap callback.
*/
@@ -254,6 +275,26 @@ - (void)applicationDidFinishLaunching:(NSNotification *)aNotification
// Register for machine sleep notifications
[[[NSWorkspace sharedWorkspace] notificationCenter] addObserver:self selector:@selector(receiveSleepNotification:) name:NSWorkspaceWillSleepNotification object:nil];
+
+ // Register screen locked/unlocked events
+ [[NSDistributedNotificationCenter defaultCenter] addObserver:self
+ selector:@selector(RadiantScreenLocked)
+ name:@"com.apple.screenIsLocked"
+ object:nil];
+
+ [[NSDistributedNotificationCenter defaultCenter] addObserver:self
+ selector:@selector(RadiantScreenUnlocked)
+ name:@"com.apple.screenIsUnlocked"
+ object:nil];
+
+ [[NSDistributedNotificationCenter defaultCenter] addObserver: self
+ selector: @selector(RadiantScreenLocked)
+ name: @"com.apple.sessionDidMoveOffConsole"
+ object: nil];
+ [[NSDistributedNotificationCenter defaultCenter] addObserver: self
+ selector: @selector(RadiantScreenUnlocked)
+ name: @"com.apple.sessionDidMoveOnConsole"
+ object: nil];
}
- (NSMutableDictionary *)styles
diff --git a/radiant-player-mac/Preferences.plist b/radiant-player-mac/Preferences.plist
index 9129904c..39c50979 100644
--- a/radiant-player-mac/Preferences.plist
+++ b/radiant-player-mac/Preferences.plist
@@ -56,5 +56,7 @@
WebKitDeveloperExtras
+ toggleMusicOnScreenLock
+
diff --git a/radiant-player-mac/Preferences/PreferencesWindowController.xib b/radiant-player-mac/Preferences/PreferencesWindowController.xib
index e9d46034..d8968603 100644
--- a/radiant-player-mac/Preferences/PreferencesWindowController.xib
+++ b/radiant-player-mac/Preferences/PreferencesWindowController.xib
@@ -1,8 +1,8 @@
-
+
-
+
@@ -17,13 +17,12 @@
-
+
-
+
-
@@ -31,9 +30,8 @@
-
+
-
@@ -87,9 +82,8 @@
-
+
-
@@ -122,9 +114,8 @@
-
+
-
@@ -132,9 +123,8 @@
-
+
-
@@ -142,9 +132,8 @@
-
+
-
@@ -152,9 +141,8 @@
-
+
-
@@ -162,9 +150,8 @@
-
+
-
@@ -206,9 +191,8 @@
-
+
-
@@ -229,9 +212,8 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
@@ -268,7 +277,6 @@
@@ -417,7 +417,6 @@ with moving the window or the player freezing
-
@@ -427,7 +426,6 @@ with moving the window or the player freezing
-
@@ -439,7 +437,6 @@ with moving the window or the player freezing
-
@@ -451,7 +448,6 @@ with moving the window or the player freezing
-
@@ -461,7 +457,6 @@ with moving the window or the player freezing
-
@@ -471,7 +466,6 @@ with moving the window or the player freezing
-
@@ -481,7 +475,6 @@ with moving the window or the player freezing
-
@@ -491,13 +484,11 @@ with moving the window or the player freezing
-
-
@@ -507,7 +498,6 @@ with moving the window or the player freezing
-
@@ -519,7 +509,6 @@ with moving the window or the player freezing
-
@@ -529,7 +518,6 @@ with moving the window or the player freezing
-
@@ -539,7 +527,6 @@ with moving the window or the player freezing
-
@@ -557,7 +544,6 @@ with moving the window or the player freezing
-
@@ -577,7 +563,6 @@ with moving the window or the player freezing
-
@@ -589,7 +574,6 @@ with moving the window or the player freezing
-
@@ -601,7 +585,6 @@ with moving the window or the player freezing
-
@@ -611,7 +594,6 @@ with moving the window or the player freezing
-
@@ -619,7 +601,6 @@ with moving the window or the player freezing
-
@@ -630,7 +611,6 @@ with moving the window or the player freezing
-
@@ -640,7 +620,6 @@ with moving the window or the player freezing
- Automatically love a track on Last.fm
@@ -654,7 +633,6 @@ when the track is rated "thumbs up"
-
@@ -662,7 +640,6 @@ when the track is rated "thumbs up"
-
@@ -686,7 +663,6 @@ when the track is rated "thumbs up"
-
@@ -696,7 +672,6 @@ when the track is rated "thumbs up"
-
@@ -708,7 +683,6 @@ when the track is rated "thumbs up"
-
@@ -726,7 +700,6 @@ when the track is rated "thumbs up"
-
@@ -738,7 +711,6 @@ when the track is rated "thumbs up"
-
@@ -748,7 +720,6 @@ when the track is rated "thumbs up"
-
@@ -756,7 +727,6 @@ when the track is rated "thumbs up"
-
@@ -766,7 +736,6 @@ when the track is rated "thumbs up"
-
@@ -776,7 +745,6 @@ when the track is rated "thumbs up"
-
@@ -786,7 +754,6 @@ when the track is rated "thumbs up"
-
@@ -794,7 +761,6 @@ when the track is rated "thumbs up"
-
@@ -803,7 +769,6 @@ when the track is rated "thumbs up"
-
@@ -813,7 +778,6 @@ when the track is rated "thumbs up"
-
@@ -825,7 +789,6 @@ when the track is rated "thumbs up"
- Required for some applications to work properly, like Adobe Fireworks, but will break Quick Look.
@@ -835,7 +798,6 @@ Changing this preference will require a restart of the application to take effec
-