mirror of
				https://github.com/labwc/labwc.git
				synced 2025-11-03 09:01:51 -05:00 
			
		
		
		
	Add action.c
This commit is contained in:
		
							parent
							
								
									1e342f8976
								
							
						
					
					
						commit
						7440919452
					
				
					 10 changed files with 30 additions and 28 deletions
				
			
		
							
								
								
									
										22
									
								
								src/action.c
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								src/action.c
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,22 @@
 | 
			
		|||
#include "labwc.h"
 | 
			
		||||
 | 
			
		||||
#include <strings.h>
 | 
			
		||||
 | 
			
		||||
void action(struct server *server, struct keybind *keybind)
 | 
			
		||||
{
 | 
			
		||||
	if (!keybind || !keybind->action)
 | 
			
		||||
		return;
 | 
			
		||||
	if (!strcasecmp(keybind->action, "Exit")) {
 | 
			
		||||
		wl_display_terminate(server->wl_display);
 | 
			
		||||
	} else if (!strcasecmp(keybind->action, "NextWindow")) {
 | 
			
		||||
		server->cycle_view = next_toplevel(view_front_toplevel(server));
 | 
			
		||||
	} else if (!strcasecmp(keybind->action, "Execute")) {
 | 
			
		||||
		if (!fork())
 | 
			
		||||
			execl("/bin/dmenu_run", "/bin/dmenu_run", (void *)NULL);
 | 
			
		||||
	} else if (!strcasecmp(keybind->action, "debug-views")) {
 | 
			
		||||
		dbg_show_views(server);
 | 
			
		||||
	} else {
 | 
			
		||||
		fprintf(stderr, "warn: action (%s) not supported\n",
 | 
			
		||||
			keybind->action);
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue