summary refs log tree commit diff
path: root/sandman.m
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--sandman.m45
1 files changed, 23 insertions, 22 deletions
diff --git a/sandman.m b/sandman.m
index 12a4817..7d2f56a 100644
--- a/sandman.m
+++ b/sandman.m
@@ -40,33 +40,34 @@ int main(int argc, char *argv[]) {
 
 	pid_t pid = fork();
 	if (pid < 0) err(EX_OSERR, "fork");
-
 	if (!pid) {
 		execvp(argv[1], &argv[1]);
 		err(EX_NOINPUT, "%s", argv[1]);
 	}
 
-	NSWorkspace *workspace = [NSWorkspace sharedWorkspace];
-	NSNotificationCenter *center = [workspace notificationCenter];
-	NSOperationQueue *main = [NSOperationQueue mainQueue];
-
-	[center addObserverForName:NSWorkspaceWillSleepNotification
-						object:nil
-						 queue:main
-					usingBlock:^(NSNotification *note) {
-						(void)note;
-						int error = kill(pid, SIGTSTP);
-						if (error) err(EX_UNAVAILABLE, "kill %d", pid);
-					}];
-
-	[center addObserverForName:NSWorkspaceDidWakeNotification
-						object:nil
-						 queue:main
-					usingBlock:^(NSNotification *note) {
-						(void)note;
-						int error = kill(pid, SIGCONT);
-						if (error) err(EX_UNAVAILABLE, "kill %d", pid);
-					}];
+	[
+		[[NSWorkspace sharedWorkspace] notificationCenter]
+		addObserverForName: NSWorkspaceWillSleepNotification
+		object: nil
+		queue: [NSOperationQueue mainQueue]
+		usingBlock: ^(NSNotification *note) {
+			(void)note;
+			int error = kill(pid, SIGTSTP);
+			if (error) err(EX_UNAVAILABLE, "kill %d", pid);
+		}
+	];
+	
+	[
+		[[NSWorkspace sharedWorkspace] notificationCenter]
+		addObserverForName: NSWorkspaceDidWakeNotification
+		object: nil
+		queue: [NSOperationQueue mainQueue]
+		usingBlock: ^(NSNotification *note) {
+			(void)note;
+			int error = kill(pid, SIGCONT);
+			if (error) err(EX_UNAVAILABLE, "kill %d", pid);
+		}
+	];
 
 	[[NSApplication sharedApplication] run];
 }
oe 2019-02-25Remove tag X macros againJune McEnroe 2019-02-25Add M-a to switch to hot or unread windowJune McEnroe 2019-02-25Refactor uiReadJune McEnroe 2019-02-24Scroll by full pages with PageUp/PageDownJune McEnroe 2019-02-23Clarify /window documentationJune McEnroe 2019-02-23Use first word of params in input commandsJune McEnroe 2019-02-23Add C-n and C-p key bindings to switch windowsJune McEnroe 2019-02-23Change example command to join #ascii.town on freenodeJune McEnroe 2019-02-23Call def_prog_mode after termNoFlowJune McEnroe 2019-02-22Move IRC formatting reset to C-sJune McEnroe 2019-02-22Disable terminal flow controlJune McEnroe 2019-02-22Bind up and down arrows to scrollJune McEnroe 2019-02-22Remove topic TODOJune McEnroe 2019-02-22Add /znc commandJune McEnroe 2019-02-22Update status line after scrolling and term eventsJune McEnroe 2019-02-22Reorganize input.cJune McEnroe 2019-02-22Fix name of <raw> window in man pageJune McEnroe 2019-02-22Rename global tags with angle bracketsJune McEnroe 2019-02-22Show status window while connectingJune McEnroe 2019-02-22Reorganize UI code for the umpteenth timeJune McEnroe 2019-02-21Replace "view" with "window"June McEnroe 2019-02-21Remove ROT13June McEnroe 2019-02-21Clean up man pageJune McEnroe 2019-01-26Draw UI before connectingJune McEnroe 2019-01-25Avoid unused variable warnings with getyxJune McEnroe 2019-01-25Add GNU/Linux build instructionsJune McEnroe