diff config.h @ 6:0968b3739b8d

apply keymodes patch
author paulo@thepaulopc
date Sun, 12 Jun 2011 14:32:54 -0700
parents a54de16f8277
children 162accc5d36d
line diff
     1.1 --- a/config.h	Wed Jan 27 23:28:29 2010 -0800
     1.2 +++ b/config.h	Sun Jun 12 14:32:54 2011 -0700
     1.3 @@ -46,79 +46,15 @@
     1.4  #define MASTER			650		/* per thousand */
     1.5  #define NMASTER			1		/* clients in master area */
     1.6  
     1.7 +#define COMMANDMODE             1
     1.8 +#define INSERTMODE              2
     1.9 +
    1.10  /* key definitions */
    1.11  #define MODKEY			Mod4Mask
    1.12  #define KEYS \
    1.13  static Key key[] = { \
    1.14  	/* modifier			key		function	argument */ \
    1.15 -	{ MODKEY|ShiftMask,		XK_Return,	spawn,		{ .cmd = "/home/paulo/bin/myterm.sh" } }, \
    1.16 -	{ MODKEY,			XK_backslash,	spawn,		{ .cmd = "/home/paulo/bin/myterm.sh -e /home/paulo/bin/viclip.sh" } }, \
    1.17 -	{ MODKEY,			XK_n,		pushdown,	{ 0 } }, \
    1.18 -	{ MODKEY,			XK_p,		pushup,	{ 0 } }, \
    1.19 -	{ MODKEY,			XK_Tab,		focusnext,	{ 0 } }, \
    1.20 -	{ MODKEY|ShiftMask,		XK_Tab,		focusprev,	{ 0 } }, \
    1.21 -	{ MODKEY,			XK_Return,	zoom,		{ 0 } }, \
    1.22 -	{ MODKEY,			XK_g,		resizemaster,	{ .i = 15 } }, \
    1.23 -	{ MODKEY,			XK_s,		resizemaster,	{ .i = -15 } }, \
    1.24 -	{ MODKEY,			XK_i,		incnmaster,	{ .i = 1 } }, \
    1.25 -	{ MODKEY,			XK_d,		incnmaster,	{ .i = -1 } }, \
    1.26 -	{ MODKEY|ShiftMask,		XK_grave,		tag,		{ .i = -1 } }, \
    1.27 -	{ MODKEY|ShiftMask,		XK_1,		tag,		{ .i = 0 } }, \
    1.28 -	{ MODKEY|ShiftMask,		XK_2,		tag,		{ .i = 1 } }, \
    1.29 -	{ MODKEY|ShiftMask,		XK_3,		tag,		{ .i = 2 } }, \
    1.30 -	{ MODKEY|ShiftMask,		XK_4,		tag,		{ .i = 3 } }, \
    1.31 -	{ MODKEY|ShiftMask,		XK_5,		tag,		{ .i = 4 } }, \
    1.32 -	{ MODKEY|ShiftMask,		XK_6,		tag,		{ .i = 5 } }, \
    1.33 -	{ MODKEY|ShiftMask,		XK_7,		tag,		{ .i = 6 } }, \
    1.34 -	{ MODKEY|ShiftMask,		XK_8,		tag,		{ .i = 7 } }, \
    1.35 -	{ MODKEY|ShiftMask,		XK_9,		tag,		{ .i = 8 } }, \
    1.36 -	{ MODKEY|ShiftMask,		XK_0,		tag,		{ .i = 9 } }, \
    1.37 -	{ MODKEY|ControlMask|ShiftMask,	XK_1,		toggletag,	{ .i = 0 } }, \
    1.38 -	{ MODKEY|ControlMask|ShiftMask,	XK_2,		toggletag,	{ .i = 1 } }, \
    1.39 -	{ MODKEY|ControlMask|ShiftMask,	XK_3,		toggletag,	{ .i = 2 } }, \
    1.40 -	{ MODKEY|ControlMask|ShiftMask,	XK_4,		toggletag,	{ .i = 3 } }, \
    1.41 -	{ MODKEY|ControlMask|ShiftMask,	XK_5,		toggletag,	{ .i = 4 } }, \
    1.42 -	{ MODKEY|ControlMask|ShiftMask,	XK_6,		toggletag,	{ .i = 5 } }, \
    1.43 -	{ MODKEY|ControlMask|ShiftMask,	XK_7,		toggletag,	{ .i = 6 } }, \
    1.44 -	{ MODKEY|ControlMask|ShiftMask,	XK_8,		toggletag,	{ .i = 7 } }, \
    1.45 -	{ MODKEY|ControlMask|ShiftMask,	XK_9,		toggletag,	{ .i = 8 } }, \
    1.46 -	{ MODKEY|ControlMask|ShiftMask,	XK_0,		toggletag,	{ .i = 9 } }, \
    1.47 -	{ MODKEY|ShiftMask,		XK_c,		killclient,	{ 0 } }, \
    1.48 -	{ MODKEY,			XK_space,	setlayout,	{ .i = -1 } }, \
    1.49 -	{ MODKEY|ShiftMask,			XK_space,	setlayout,	{ .i = -2 } }, \
    1.50 -	{ MODKEY,			XK_F1,	setlayout,	{ .i = 0 } }, \
    1.51 -	{ MODKEY,			XK_F2,	setlayout,	{ .i = 1 } }, \
    1.52 -	{ MODKEY,			XK_F3,	setlayout,	{ .i = 2 } }, \
    1.53 -	{ MODKEY,			XK_F4,	setlayout,	{ .i = 3 } }, \
    1.54 -	{ MODKEY,			XK_F5,	setlayout,	{ .i = 4 } }, \
    1.55 -	{ MODKEY,			XK_F6,	setlayout,	{ .i = 5 } }, \
    1.56 -	{ MODKEY,			XK_F7,	setlayout,	{ .i = 6 } }, \
    1.57 -	{ MODKEY|ControlMask,		XK_space,	toggleversatile,{ 0 } }, \
    1.58 -	{ MODKEY,			XK_grave,		view,		{ .i = -1 } }, \
    1.59 -	{ MODKEY,			XK_1,		view,		{ .i = 0 } }, \
    1.60 -	{ MODKEY,			XK_2,		view,		{ .i = 1 } }, \
    1.61 -	{ MODKEY,			XK_3,		view,		{ .i = 2 } }, \
    1.62 -	{ MODKEY,			XK_4,		view,		{ .i = 3 } }, \
    1.63 -	{ MODKEY,			XK_5,		view,		{ .i = 4 } }, \
    1.64 -	{ MODKEY,			XK_6,		view,		{ .i = 5 } }, \
    1.65 -	{ MODKEY,			XK_7,		view,		{ .i = 6 } }, \
    1.66 -	{ MODKEY,			XK_8,		view,		{ .i = 7 } }, \
    1.67 -	{ MODKEY,			XK_9,		view,		{ .i = 8 } }, \
    1.68 -	{ MODKEY,			XK_0,		view,		{ .i = 9 } }, \
    1.69 -	{ MODKEY,			XK_minus,		next_view,		{ .i = -1 } }, \
    1.70 -	{ MODKEY,			XK_equal,		next_view,		{ .i = 1 } }, \
    1.71 -	{ MODKEY,			XK_BackSpace,		last_view,		{ 0 } }, \
    1.72 -	{ MODKEY|ControlMask,		XK_1,		toggleview,	{ .i = 0 } }, \
    1.73 -	{ MODKEY|ControlMask,		XK_2,		toggleview,	{ .i = 1 } }, \
    1.74 -	{ MODKEY|ControlMask,		XK_3,		toggleview,	{ .i = 2 } }, \
    1.75 -	{ MODKEY|ControlMask,		XK_4,		toggleview,	{ .i = 3 } }, \
    1.76 -	{ MODKEY|ControlMask,		XK_5,		toggleview,	{ .i = 4 } }, \
    1.77 -	{ MODKEY|ControlMask,		XK_6,		toggleview,	{ .i = 5 } }, \
    1.78 -	{ MODKEY|ControlMask,		XK_7,		toggleview,	{ .i = 6 } }, \
    1.79 -	{ MODKEY|ControlMask,		XK_8,		toggleview,	{ .i = 7 } }, \
    1.80 -	{ MODKEY|ControlMask,		XK_9,		toggleview,	{ .i = 8 } }, \
    1.81 -	{ MODKEY|ControlMask,		XK_0,		toggleview,	{ .i = 9 } }, \
    1.82 -	{ MODKEY|ShiftMask,		XK_q,		quit,		{ 0 } }, \
    1.83 +	{ MODKEY,			XK_Escape,	setkeymode,	{ .i = COMMANDMODE } }, \
    1.84  	{ MODKEY,		XK_h,		moveresize,		"-25x 0y 0w 0h" }, \
    1.85  	{ MODKEY,		XK_l,		moveresize,		"25x 0y 0w 0h" }, \
    1.86  	{ MODKEY,		XK_j,		moveresize,		"0x 25y 0w 0h" }, \
    1.87 @@ -134,3 +70,87 @@
    1.88  };
    1.89  
    1.90  #define MAX_TASKS		13		/* max number of apps in taskbar */
    1.91 +
    1.92 +#define CMDKEYS \
    1.93 +static Key cmdkeys[] = { \
    1.94 +	/* modifier		keys		function		argument */ \
    1.95 +	{ 0,		XK_Escape,		clearcmd,		{ 0 } }, \
    1.96 +	{ ControlMask,		XK_c,		clearcmd,		{ 0 } }, \
    1.97 +	{ MODKEY|ShiftMask,		XK_x,		killclient,	{ 0 } }, \
    1.98 +	{ MODKEY|ShiftMask,		XK_q,		quit,		{ 0 } }, \
    1.99 +	{ 0,		XK_i,		setkeymode,		{ .i = INSERTMODE } }, \
   1.100 +	{ 0,		XK_o,		spawn,		{ .cmd = "/home/paulo/bin/myterm.sh" } }, \
   1.101 +	{ ShiftMask,		XK_o,		spawn_insert,		{ .cmd = "/home/paulo/bin/myterm.sh" } }, \
   1.102 +	{ 0,			XK_backslash,	spawn,		{ .cmd = "/home/paulo/bin/myterm.sh -e /home/paulo/bin/viclip.sh" } }, \
   1.103 +	{ ShiftMask,			XK_backslash,	spawn_insert,		{ .cmd = "/home/paulo/bin/myterm.sh -e /home/paulo/bin/viclip.sh" } }, \
   1.104 +	{ 0,			XK_n,		pushdown,	{ 0 } }, \
   1.105 +	{ ShiftMask,		XK_n,		pushup,	{ 0 } }, \
   1.106 +	{ 0,			XK_j,		focusnext,	{ 0 } }, \
   1.107 +	{ 0,			XK_k,		focusprev,	{ 0 } }, \
   1.108 +	{ 0,			XK_Return,	zoom,		{ 0 } }, \
   1.109 +	{ ShiftMask,			XK_Return,	zoom_insert,		{ 0 } }, \
   1.110 +	{ 0,			XK_m,		resizemaster,	{ .i = 15 } }, \
   1.111 +	{ ShiftMask,		XK_m,		resizemaster,	{ .i = -15 } }, \
   1.112 +	{ 0,			XK_d,		incnmaster,	{ .i = 1 } }, \
   1.113 +	{ ShiftMask,		XK_d,		incnmaster,	{ .i = -1 } }, \
   1.114 +	{ 0,			XK_v,		next_view,		{ .i = 1 } }, \
   1.115 +	{ ShiftMask,			XK_v,		next_view,		{ .i = -1 } }, \
   1.116 +	{ 0,			XK_BackSpace,		last_view,		{ 0 } }, \
   1.117 +	{ 0,			XK_l,		setlayout,		{ .i = -1 } }, \
   1.118 +	{ ShiftMask,			XK_l,		setlayout,		{ .i = -2 } }, \
   1.119 +};
   1.120 +
   1.121 +#define COMMANDS \
   1.122 +static Command commands[] = { \
   1.123 +	/* modifier (4 keys)		keysyms (4 keys)		function		argument */ \
   1.124 +	{ {0, 0, 0, 0},		{XK_grave, XK_v, 0, 0},		view,		{ .i = -1 } }, \
   1.125 +	{ {0, 0, 0, 0},		{XK_1, XK_v, 0, 0},		view,		{ .i = 0 } }, \
   1.126 +	{ {0, 0, 0, 0},		{XK_2, XK_v, 0, 0},		view,		{ .i = 1 } }, \
   1.127 +	{ {0, 0, 0, 0},		{XK_3, XK_v, 0, 0},		view,		{ .i = 2 } }, \
   1.128 +	{ {0, 0, 0, 0},		{XK_4, XK_v, 0, 0},		view,		{ .i = 3 } }, \
   1.129 +	{ {0, 0, 0, 0},		{XK_5, XK_v, 0, 0},		view,		{ .i = 4 } }, \
   1.130 +	{ {0, 0, 0, 0},		{XK_6, XK_v, 0, 0},		view,		{ .i = 5 } }, \
   1.131 +	{ {0, 0, 0, 0},		{XK_7, XK_v, 0, 0},		view,		{ .i = 6 } }, \
   1.132 +	{ {0, 0, 0, 0},		{XK_8, XK_v, 0, 0},		view,		{ .i = 7 } }, \
   1.133 +	{ {0, 0, 0, 0},		{XK_9, XK_v, 0, 0},		view,		{ .i = 8 } }, \
   1.134 +	{ {0, 0, 0, 0},		{XK_0, XK_v, 0, 0},		view,		{ .i = 9 } }, \
   1.135 +	{ {0, ShiftMask, 0, 0},		{XK_grave, XK_v, 0, 0},		toggleversatile,		{ 0 } }, \
   1.136 +	{ {0, ShiftMask, 0, 0},		{XK_1, XK_v, 0, 0},		toggleview,		{ .i = 0 } }, \
   1.137 +	{ {0, ShiftMask, 0, 0},		{XK_2, XK_v, 0, 0},		toggleview,		{ .i = 1 } }, \
   1.138 +	{ {0, ShiftMask, 0, 0},		{XK_3, XK_v, 0, 0},		toggleview,		{ .i = 2 } }, \
   1.139 +	{ {0, ShiftMask, 0, 0},		{XK_4, XK_v, 0, 0},		toggleview,		{ .i = 3 } }, \
   1.140 +	{ {0, ShiftMask, 0, 0},		{XK_5, XK_v, 0, 0},		toggleview,		{ .i = 4 } }, \
   1.141 +	{ {0, ShiftMask, 0, 0},		{XK_6, XK_v, 0, 0},		toggleview,		{ .i = 5 } }, \
   1.142 +	{ {0, ShiftMask, 0, 0},		{XK_7, XK_v, 0, 0},		toggleview,		{ .i = 6 } }, \
   1.143 +	{ {0, ShiftMask, 0, 0},		{XK_8, XK_v, 0, 0},		toggleview,		{ .i = 7 } }, \
   1.144 +	{ {0, ShiftMask, 0, 0},		{XK_9, XK_v, 0, 0},		toggleview,		{ .i = 8 } }, \
   1.145 +	{ {0, ShiftMask, 0, 0},		{XK_0, XK_v, 0, 0},		toggleview,		{ .i = 9 } }, \
   1.146 +	{ {0, 0, 0, 0},		{XK_1, XK_l, 0, 0},		setlayout,		{ .i = 0 } }, \
   1.147 +	{ {0, 0, 0, 0},		{XK_2, XK_l, 0, 0},		setlayout,		{ .i = 1 } }, \
   1.148 +	{ {0, 0, 0, 0},		{XK_3, XK_l, 0, 0},		setlayout,		{ .i = 2 } }, \
   1.149 +	{ {0, 0, 0, 0},		{XK_4, XK_l, 0, 0},		setlayout,		{ .i = 3 } }, \
   1.150 +	{ {0, 0, 0, 0},		{XK_5, XK_l, 0, 0},		setlayout,		{ .i = 4 } }, \
   1.151 +	{ {0, 0, 0, 0},		{XK_6, XK_l, 0, 0},		setlayout,		{ .i = 5 } }, \
   1.152 +	{ {0, 0, 0, 0},		{XK_7, XK_l, 0, 0},		setlayout,		{ .i = 6 } }, \
   1.153 +	{ {0, 0, 0, 0},		{XK_grave, XK_t, 0, 0},		tag,		{ .i = -1 } }, \
   1.154 +	{ {0, 0, 0, 0},		{XK_1, XK_t, 0, 0},		tag,		{ .i = 0 } }, \
   1.155 +	{ {0, 0, 0, 0},		{XK_2, XK_t, 0, 0},		tag,		{ .i = 1 } }, \
   1.156 +	{ {0, 0, 0, 0},		{XK_3, XK_t, 0, 0},		tag,		{ .i = 2 } }, \
   1.157 +	{ {0, 0, 0, 0},		{XK_4, XK_t, 0, 0},		tag,		{ .i = 3 } }, \
   1.158 +	{ {0, 0, 0, 0},		{XK_5, XK_t, 0, 0},		tag,		{ .i = 4 } }, \
   1.159 +	{ {0, 0, 0, 0},		{XK_6, XK_t, 0, 0},		tag,		{ .i = 5 } }, \
   1.160 +	{ {0, 0, 0, 0},		{XK_7, XK_t, 0, 0},		tag,		{ .i = 6 } }, \
   1.161 +	{ {0, 0, 0, 0},		{XK_8, XK_t, 0, 0},		tag,		{ .i = 7 } }, \
   1.162 +	{ {0, 0, 0, 0},		{XK_9, XK_t, 0, 0},		tag,		{ .i = 8 } }, \
   1.163 +	{ {0, 0, 0, 0},		{XK_0, XK_t, 0, 0},		tag,		{ .i = 9 } }, \
   1.164 +	{ {0, ShiftMask, 0, 0},		{XK_1, XK_t, 0, 0},		toggletag,		{ .i = 0 } }, \
   1.165 +	{ {0, ShiftMask, 0, 0},		{XK_2, XK_t, 0, 0},		toggletag,		{ .i = 1 } }, \
   1.166 +	{ {0, ShiftMask, 0, 0},		{XK_3, XK_t, 0, 0},		toggletag,		{ .i = 2 } }, \
   1.167 +	{ {0, ShiftMask, 0, 0},		{XK_4, XK_t, 0, 0},		toggletag,		{ .i = 3 } }, \
   1.168 +	{ {0, ShiftMask, 0, 0},		{XK_5, XK_t, 0, 0},		toggletag,		{ .i = 4 } }, \
   1.169 +	{ {0, ShiftMask, 0, 0},		{XK_6, XK_t, 0, 0},		toggletag,		{ .i = 5 } }, \
   1.170 +	{ {0, ShiftMask, 0, 0},		{XK_7, XK_t, 0, 0},		toggletag,		{ .i = 6 } }, \
   1.171 +	{ {0, ShiftMask, 0, 0},		{XK_8, XK_t, 0, 0},		toggletag,		{ .i = 7 } }, \
   1.172 +	{ {0, ShiftMask, 0, 0},		{XK_9, XK_t, 0, 0},		toggletag,		{ .i = 8 } }, \
   1.173 +	{ {0, ShiftMask, 0, 0},		{XK_0, XK_t, 0, 0},		toggletag,		{ .i = 9 } }, \
   1.174 +};