summaryrefslogtreecommitdiff
blob: 2b1c9781ac8b69f97915d03b17cface9cdc0d2da (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
diff -r ffa4f6eba0b2 echinus.c
--- a/echinus.c	Tue Aug 19 22:53:23 2008 +0400
+++ b/echinus.c	Wed Aug 20 03:20:40 2008 +0200
@@ -276,6 +276,7 @@
 int nrules = 0;
 Bool dectiled = 0;
 Bool hidebastards = 0;
+unsigned int modkey = 0;
 /* configuration, allows nested code to access above variables */
 #include "config.h"
 #include "ewmh.c"
@@ -488,7 +489,7 @@
         focus(c);
         restack();
         XAllowEvents(dpy, ReplayPointer, CurrentTime);
-        if(CLEANMASK(ev->state) != MODKEY)
+        if(CLEANMASK(ev->state) != modkey)
            return;
         if(ev->button == Button1) {
                 if((layouts[ltidxs[curtag]].arrange == floating) || c->isfloating)
@@ -959,8 +960,8 @@
 void
 grabbuttons(Client *c, Bool focused) {
     unsigned int Buttons[] = {Button1, Button2, Button3};            
-    unsigned int Modifiers[] = {MODKEY, MODKEY|LockMask,
-               MODKEY|numlockmask, MODKEY|numlockmask|LockMask};                                                                                              
+    unsigned int Modifiers[] = {modkey, modkey|LockMask,
+               modkey|numlockmask, modkey|numlockmask|LockMask};                                                                                              
     int i, j;   
     XUngrabButton(dpy, AnyButton, AnyModifier, c->win);
 
@@ -1779,6 +1780,30 @@
         xrdb = XrmGetFileDatabase("echinusrc");
         if(!xrdb)
             eprint("echinus: cannot open configuration file\n");
+
+	/* init modkey */
+		char* key;
+		if(!(key = getresource("modkey", NULL)))
+			modkey = MODKEY;
+		else {
+			switch(atoi(key)) {
+				case 1:
+					modkey = Mod1Mask;
+					break;
+				case 2:
+					modkey = Mod2Mask;
+					break;
+				case 3:
+					modkey = Mod3Mask;
+					break;
+				case 4:
+					modkey = Mod4Mask;
+					break;
+				default:
+					modkey = MODKEY;
+					break;
+			}
+		}	
 
 	/* init tags */
         inittags();
diff -r ffa4f6eba0b2 echinusrc
--- a/echinusrc	Tue Aug 19 22:53:23 2008 +0400
+++ b/echinusrc	Wed Aug 20 03:20:40 2008 +0200
@@ -41,6 +41,7 @@
 Echinus*tags.layout1: m
 Echinus*tags.layout3: b
 
+Echinus*modkey: 1
 Echinus*togglestruts: A + b
 Echinus*focusnext: A + j
 Echinus*focusprev: A + k