diff options
| -rw-r--r-- | event.c | 4 | ||||
| -rw-r--r-- | sandman.1 | 12 | ||||
| -rw-r--r-- | sandman.m | 14 | 
3 files changed, 8 insertions, 22 deletions
| @@ -120,6 +120,7 @@ noreturn void eventLoop(void) {  	};  	sigaction(SIGCHLD, &action, NULL);  	sigaction(SIGINT, &action, NULL); +	sigaction(SIGHUP, &action, NULL);  	struct sigaction curses;  	sigaction(SIGWINCH, &action, &curses); @@ -130,6 +131,7 @@ noreturn void eventLoop(void) {  	for (;;) {  		if (sig[SIGCHLD]) childWait(); +		if (sig[SIGHUP]) ircFmt("QUIT :zzz\r\n");  		if (sig[SIGINT]) {  			signal(SIGINT, SIG_DFL);  			ircFmt("QUIT :Goodbye\r\n"); @@ -139,7 +141,7 @@ noreturn void eventLoop(void) {  			uiRead();  			uiDraw();  		} -		sig[SIGCHLD] = sig[SIGINT] = sig[SIGWINCH] = 0; +		sig[SIGCHLD] = sig[SIGHUP] = sig[SIGINT] = sig[SIGWINCH] = 0;  		struct pollfd fds[3] = {  			{ .events = POLLIN, .fd = irc }, @@ -16,14 +16,10 @@ is a utility for Darwin systems.  It runs the  .Ar command  as a child process -and sends it -.Dv SIGTSTP -and -.Dv SIGCONT -signals -when the system goes to sleep -and wakes from sleep, -respectively. +and sends it the +.Dv SIGHUP +signal +when the system goes to sleep.  .  .Sh EXIT STATUS  .Nm @@ -59,19 +59,7 @@ int main(int argc, char *argv[]) {  		queue: nil  		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: nil -		usingBlock: ^(NSNotification *note) { -			(void)note; -			int error = kill(pid, SIGCONT); +			int error = kill(pid, SIGHUP);  			if (error) err(EX_UNAVAILABLE, "kill %d", pid);  		}  	]; | 
