diff options
| -rw-r--r-- | Low Battery Yup/DaemonLauncher.h | 1 | ||||
| -rw-r--r-- | Low Battery Yup/DaemonLauncher.m | 14 |
2 files changed, 15 insertions, 0 deletions
diff --git a/Low Battery Yup/DaemonLauncher.h b/Low Battery Yup/DaemonLauncher.h index a7c6ceb..586dbda 100644 --- a/Low Battery Yup/DaemonLauncher.h +++ b/Low Battery Yup/DaemonLauncher.h @@ -12,5 +12,6 @@ - (BOOL)launch; - (BOOL)quit; +- (BOOL)isRunning; @end diff --git a/Low Battery Yup/DaemonLauncher.m b/Low Battery Yup/DaemonLauncher.m index 78b7844..355e9fd 100644 --- a/Low Battery Yup/DaemonLauncher.m +++ b/Low Battery Yup/DaemonLauncher.m @@ -42,4 +42,18 @@ return NO; } +- (BOOL)isRunning +{ + NSArray *runningApplications = [[NSWorkspace sharedWorkspace] runningApplications]; + + for (int i = 0; i < [runningApplications count]; i++) { + if ([[[runningApplications objectAtIndex:i] bundleIdentifier] + isEqualToString:@"com.teddywing.Low-Battery-Yup-d"]) { + return YES; + } + } + + return NO; +} + @end |
