Reformat sandman Objective-C code

master
Curtis McEnroe 2018-11-30 17:16:59 -05:00
parent af2a4ef1f8
commit 70386c93f2
No known key found for this signature in database
GPG Key ID: CEA2F97ADCFCD77C
1 changed files with 23 additions and 22 deletions

View File

@ -40,33 +40,34 @@ int main(int argc, char *argv[]) {
pid_t pid = fork(); pid_t pid = fork();
if (pid < 0) err(EX_OSERR, "fork"); if (pid < 0) err(EX_OSERR, "fork");
if (!pid) { if (!pid) {
execvp(argv[1], &argv[1]); execvp(argv[1], &argv[1]);
err(EX_NOINPUT, "%s", argv[1]); err(EX_NOINPUT, "%s", argv[1]);
} }
NSWorkspace *workspace = [NSWorkspace sharedWorkspace]; [
NSNotificationCenter *center = [workspace notificationCenter]; [[NSWorkspace sharedWorkspace] notificationCenter]
NSOperationQueue *main = [NSOperationQueue mainQueue]; addObserverForName: NSWorkspaceWillSleepNotification
object: nil
[center addObserverForName:NSWorkspaceWillSleepNotification queue: [NSOperationQueue mainQueue]
object:nil usingBlock: ^(NSNotification *note) {
queue:main (void)note;
usingBlock:^(NSNotification *note) { int error = kill(pid, SIGTSTP);
(void)note; if (error) err(EX_UNAVAILABLE, "kill %d", pid);
int error = kill(pid, SIGTSTP); }
if (error) err(EX_UNAVAILABLE, "kill %d", pid); ];
}];
[
[center addObserverForName:NSWorkspaceDidWakeNotification [[NSWorkspace sharedWorkspace] notificationCenter]
object:nil addObserverForName: NSWorkspaceDidWakeNotification
queue:main object: nil
usingBlock:^(NSNotification *note) { queue: [NSOperationQueue mainQueue]
(void)note; usingBlock: ^(NSNotification *note) {
int error = kill(pid, SIGCONT); (void)note;
if (error) err(EX_UNAVAILABLE, "kill %d", pid); int error = kill(pid, SIGCONT);
}]; if (error) err(EX_UNAVAILABLE, "kill %d", pid);
}
];
[[NSApplication sharedApplication] run]; [[NSApplication sharedApplication] run];
} }