mirror of
				https://codeberg.org/dwl/dwl.git
				synced 2025-10-31 03:54:15 +00:00 
			
		
		
		
	feat: use level-0 keysym for keybindings
This commit is contained in:
		
							parent
							
								
									8653b27692
								
							
						
					
					
						commit
						75269267a7
					
				
							
								
								
									
										36
									
								
								config.def.h
									
									
									
									
									
								
							
							
						
						
									
										36
									
								
								config.def.h
									
									
									
									
									
								
							| @ -94,11 +94,11 @@ static const enum libinput_config_tap_button_map button_map = LIBINPUT_CONFIG_TA | ||||
| /* If you want to use the windows key for MODKEY, use WLR_MODIFIER_LOGO */ | ||||
| #define MODKEY WLR_MODIFIER_ALT | ||||
| 
 | ||||
| #define TAGKEYS(KEY,SKEY,TAG) \ | ||||
| #define TAGKEYS(KEY,TAG) \ | ||||
| 	{ MODKEY,                    KEY,            view,            {.ui = 1 << TAG} }, \ | ||||
| 	{ MODKEY|WLR_MODIFIER_CTRL,  KEY,            toggleview,      {.ui = 1 << TAG} }, \ | ||||
| 	{ MODKEY|WLR_MODIFIER_SHIFT, SKEY,           tag,             {.ui = 1 << TAG} }, \ | ||||
| 	{ MODKEY|WLR_MODIFIER_CTRL|WLR_MODIFIER_SHIFT,SKEY,toggletag, {.ui = 1 << TAG} } | ||||
| 	{ MODKEY|WLR_MODIFIER_SHIFT, KEY,            tag,             {.ui = 1 << TAG} }, \ | ||||
| 	{ MODKEY|WLR_MODIFIER_CTRL|WLR_MODIFIER_SHIFT,KEY,toggletag,  {.ui = 1 << TAG} } | ||||
| 
 | ||||
| /* helper for spawning shell commands in the pre dwm-5.0 fashion */ | ||||
| #define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } } | ||||
| @ -120,7 +120,7 @@ static const Key keys[] = { | ||||
| 	{ MODKEY,                    XKB_KEY_l,          setmfact,       {.f = +0.05} }, | ||||
| 	{ MODKEY,                    XKB_KEY_Return,     zoom,           {0} }, | ||||
| 	{ MODKEY,                    XKB_KEY_Tab,        view,           {0} }, | ||||
| 	{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_C,          killclient,     {0} }, | ||||
| 	{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_c,          killclient,     {0} }, | ||||
| 	{ MODKEY,                    XKB_KEY_t,          setlayout,      {.v = &layouts[0]} }, | ||||
| 	{ MODKEY,                    XKB_KEY_f,          setlayout,      {.v = &layouts[1]} }, | ||||
| 	{ MODKEY,                    XKB_KEY_m,          setlayout,      {.v = &layouts[2]} }, | ||||
| @ -128,25 +128,25 @@ static const Key keys[] = { | ||||
| 	{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_space,      togglefloating, {0} }, | ||||
| 	{ MODKEY,                    XKB_KEY_e,          togglefullscreen, {0} }, | ||||
| 	{ MODKEY,                    XKB_KEY_0,          view,           {.ui = ~0} }, | ||||
| 	{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_parenright, tag,            {.ui = ~0} }, | ||||
| 	{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_0, 		 tag,            {.ui = ~0} }, | ||||
| 	{ MODKEY,                    XKB_KEY_comma,      focusmon,       {.i = WLR_DIRECTION_LEFT} }, | ||||
| 	{ MODKEY,                    XKB_KEY_period,     focusmon,       {.i = WLR_DIRECTION_RIGHT} }, | ||||
| 	{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_less,       tagmon,         {.i = WLR_DIRECTION_LEFT} }, | ||||
| 	{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_greater,    tagmon,         {.i = WLR_DIRECTION_RIGHT} }, | ||||
| 	TAGKEYS(          XKB_KEY_1, XKB_KEY_exclam,                     0), | ||||
| 	TAGKEYS(          XKB_KEY_2, XKB_KEY_at,                         1), | ||||
| 	TAGKEYS(          XKB_KEY_3, XKB_KEY_numbersign,                 2), | ||||
| 	TAGKEYS(          XKB_KEY_4, XKB_KEY_dollar,                     3), | ||||
| 	TAGKEYS(          XKB_KEY_5, XKB_KEY_percent,                    4), | ||||
| 	TAGKEYS(          XKB_KEY_6, XKB_KEY_asciicircum,                5), | ||||
| 	TAGKEYS(          XKB_KEY_7, XKB_KEY_ampersand,                  6), | ||||
| 	TAGKEYS(          XKB_KEY_8, XKB_KEY_asterisk,                   7), | ||||
| 	TAGKEYS(          XKB_KEY_9, XKB_KEY_parenleft,                  8), | ||||
| 	{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_Q,          quit,           {0} }, | ||||
| 	{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_comma,      tagmon,         {.i = WLR_DIRECTION_LEFT} }, | ||||
| 	{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_period,     tagmon,         {.i = WLR_DIRECTION_RIGHT} }, | ||||
| 	TAGKEYS(          XKB_KEY_1,		0), | ||||
| 	TAGKEYS(          XKB_KEY_2,		1), | ||||
| 	TAGKEYS(          XKB_KEY_3,		2), | ||||
| 	TAGKEYS(          XKB_KEY_4,		3), | ||||
| 	TAGKEYS(          XKB_KEY_5,		4), | ||||
| 	TAGKEYS(          XKB_KEY_6,		5), | ||||
| 	TAGKEYS(          XKB_KEY_7,		6), | ||||
| 	TAGKEYS(          XKB_KEY_8,		7), | ||||
| 	TAGKEYS(          XKB_KEY_9,		8), | ||||
| 	{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_q,          quit,           {0} }, | ||||
| 
 | ||||
| 	/* Ctrl-Alt-Backspace and Ctrl-Alt-Fx used to be handled by X server */ | ||||
| 	{ WLR_MODIFIER_CTRL|WLR_MODIFIER_ALT,XKB_KEY_Terminate_Server, quit, {0} }, | ||||
| #define CHVT(n) { WLR_MODIFIER_CTRL|WLR_MODIFIER_ALT,XKB_KEY_XF86Switch_VT_##n, chvt, {.ui = (n)} } | ||||
| #define CHVT(n) { WLR_MODIFIER_CTRL|WLR_MODIFIER_ALT,XKB_KEY_F##n, chvt, {.ui = (n)} } | ||||
| 	CHVT(1), CHVT(2), CHVT(3), CHVT(4), CHVT(5), CHVT(6), | ||||
| 	CHVT(7), CHVT(8), CHVT(9), CHVT(10), CHVT(11), CHVT(12), | ||||
| }; | ||||
|  | ||||
							
								
								
									
										4
									
								
								dwl.c
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								dwl.c
									
									
									
									
									
								
							| @ -1379,8 +1379,8 @@ keypress(struct wl_listener *listener, void *data) | ||||
| 	uint32_t keycode = event->keycode + 8; | ||||
| 	/* Get a list of keysyms based on the keymap for this keyboard */ | ||||
| 	const xkb_keysym_t *syms; | ||||
| 	int nsyms = xkb_state_key_get_syms( | ||||
| 			kb->wlr_keyboard->xkb_state, keycode, &syms); | ||||
| 	int nsyms = xkb_keymap_key_get_syms_by_level( | ||||
| 		kb->wlr_keyboard->keymap, keycode, xkb_state_key_get_layout(kb->wlr_keyboard->xkb_state, keycode), 0, &syms); | ||||
| 
 | ||||
| 	int handled = 0; | ||||
| 	uint32_t mods = wlr_keyboard_get_modifiers(kb->wlr_keyboard); | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Federico Carbone
						Federico Carbone