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
				
			
		| 
						 | 
				
			
			@ -1,5 +1,4 @@
 | 
			
		|||
#include "labwc.h"
 | 
			
		||||
#include "rcxml.h"
 | 
			
		||||
 | 
			
		||||
static void keyboard_handle_modifiers(struct wl_listener *listener, void *data)
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			@ -21,25 +20,6 @@ static void keyboard_handle_modifiers(struct wl_listener *listener, void *data)
 | 
			
		|||
		keyboard->server->seat, &keyboard->device->keyboard->modifiers);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void action(struct server *server, struct keybind *keybind)
 | 
			
		||||
{
 | 
			
		||||
	if (!keybind || !keybind->action)
 | 
			
		||||
		return;
 | 
			
		||||
	if (!strcmp(keybind->action, "exit")) {
 | 
			
		||||
		wl_display_terminate(server->wl_display);
 | 
			
		||||
	} else if (!strcmp(keybind->action, "cycle")) {
 | 
			
		||||
		server->cycle_view = next_toplevel(view_front_toplevel(server));
 | 
			
		||||
	} else if (!strcmp(keybind->action, "exec")) {
 | 
			
		||||
		if (!fork())
 | 
			
		||||
			execl("/bin/dmenu_run", "/bin/dmenu_run", (void *)NULL);
 | 
			
		||||
	} else if (!strcmp(keybind->action, "debug-views")) {
 | 
			
		||||
		dbg_show_views(server);
 | 
			
		||||
	} else {
 | 
			
		||||
		fprintf(stderr, "warn: action (%s) not supported\n",
 | 
			
		||||
			keybind->action);
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static bool handle_keybinding(struct server *server, uint32_t modifiers,
 | 
			
		||||
			      xkb_keysym_t sym)
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue