pause/unpause via SIGUSR1/SIGUSR2
This commit is contained in:
		
							parent
							
								
									d53ad1b376
								
							
						
					
					
						commit
						a378aa9b19
					
				| @ -148,7 +148,14 @@ The progress value can be set with a hint, too. | ||||
| =head1 MISCELLANEOUS | ||||
| 
 | ||||
| Dunst can be paused by sending a notification with a summary of "DUNST_COMMAND_PAUSE" | ||||
| and resumed with a summary of "DUNST_COMMAND_RESUME". | ||||
| and resumed with a summary of "DUNST_COMMAND_RESUME". Alternatively you can send SIGUSR1 and SIGUSR2 to pause and unpause respectivly. For Example: | ||||
| 
 | ||||
| =item killall -SIGUSR1 dunst # pause | ||||
| 
 | ||||
| =item killall -SIGUSR2 dunst # resume | ||||
| 
 | ||||
| =back | ||||
| 
 | ||||
| When paused dunst will not display any notifications but keep all notifications in a queue. | ||||
| This can for example be wrapped around a screen locker (i3lock, slock) to prevent flickering | ||||
| of notifications through the lock and to read all missed notifications after returning to the computer. | ||||
|  | ||||
							
								
								
									
										15
									
								
								dunst.c
									
									
									
									
									
								
							
							
						
						
									
										15
									
								
								dunst.c
									
									
									
									
									
								
							| @ -12,6 +12,7 @@ | ||||
| #include <fnmatch.h> | ||||
| #include <sys/time.h> | ||||
| #include <math.h> | ||||
| #include <signal.h> | ||||
| #include <X11/Xlib.h> | ||||
| #include <X11/XKBlib.h> | ||||
| #include <X11/Xatom.h> | ||||
| @ -108,6 +109,18 @@ void warn(const char *text, int urg); | ||||
| void init_shortcut(keyboard_shortcut * shortcut); | ||||
| KeySym string_to_mask(char *str); | ||||
| 
 | ||||
| void pause_signal_handler(int sig) | ||||
| { | ||||
|         if (sig == SIGUSR1) { | ||||
|                 pause_display = true; | ||||
|         } | ||||
|         if (sig == SIGUSR2) { | ||||
|                 pause_display = false; | ||||
|         } | ||||
| 
 | ||||
|         signal (sig, pause_signal_handler); | ||||
| } | ||||
| 
 | ||||
| static void print_notification(notification * n) | ||||
| { | ||||
|         printf("{\n"); | ||||
| @ -1714,6 +1727,8 @@ int main(int argc, char *argv[]) | ||||
| 
 | ||||
|         initdbus(); | ||||
|         setup(); | ||||
|         signal (SIGUSR1, pause_signal_handler); | ||||
|         signal (SIGUSR2, pause_signal_handler); | ||||
| 
 | ||||
|         if (deprecated_mod) | ||||
|                 warn("-mod is deprecated. Use \"-key mod+key\" instead\n", | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Sascha Kruse
						Sascha Kruse