]> code.delx.au - spectrwm/commitdiff
.conf entry for modkey so that pepople will stop pestering me for the
authorMarco Peereboom <marco@conformal.com>
Mon, 16 Feb 2009 00:03:53 +0000 (00:03 +0000)
committerMarco Peereboom <marco@conformal.com>
Mon, 16 Feb 2009 00:03:53 +0000 (00:03 +0000)
windows key mod.

scrotwm.c
scrotwm.conf

index 6c1fc2437cf9007fce87cf95a180ee064d88a1e7..55b889699c04a9c6d0c5ca0bebb2c30f9f24393b 100644 (file)
--- a/scrotwm.c
+++ b/scrotwm.c
@@ -250,6 +250,7 @@ void        max_stack(struct workspace *, struct swm_geometry *);
 
 void   grabbuttons(struct ws_win *, int);
 void   new_region(struct swm_screen *, int, int, int, int);
+void   update_modkey(unsigned int);
 
 struct layout {
        void            (*l_stack)(struct workspace *, struct swm_geometry *);
@@ -502,6 +503,7 @@ conf_load(char *filename)
        char                    *line, *cp, *var, *val;
        size_t                  len, lineno = 0;
        int                     i, sc;
+       unsigned int            modkey;
 
        DNPRINTF(SWM_D_MISC, "conf_load: filename %s\n", filename);
 
@@ -572,6 +574,22 @@ conf_load(char *filename)
                                goto bad;
                        break;
 
+               case 'm':
+                       if (!strncmp(var, "modkey", strlen("modkey"))) {
+                               modkey = MODKEY;
+                               if (!strncmp(val, "Mod2", strlen("Mod2")))
+                                       modkey = Mod2Mask;
+                               else if (!strncmp(val, "Mod3", strlen("Mod3")))
+                                       modkey = Mod3Mask;
+                               else if (!strncmp(val, "Mod4", strlen("Mod4")))
+                                       modkey = Mod4Mask;
+                               else
+                                       modkey = Mod1Mask;
+                               update_modkey(modkey);
+                       } else
+                               goto bad;
+                       break;
+
                case 'r':
                        if (!strncmp(var, "region", strlen("region")))
                                custom_region(val);
@@ -2079,6 +2097,24 @@ struct button {
        { client_click,         MODKEY,         Button1,        move,           {0} },
 };
 
+void
+update_modkey(unsigned int mod)
+{
+       int                     i;
+
+       for (i = 0; i < LENGTH(keys); i++)
+               if (keys[i].mod & ShiftMask)
+                       keys[i].mod = mod | ShiftMask;
+               else
+                       keys[i].mod = mod;
+
+       for (i = 0; i < LENGTH(buttons); i++)
+               if (buttons[i].mask & ShiftMask)
+                       buttons[i].mask = mod | ShiftMask;
+               else
+                       buttons[i].mask = mod;
+}
+
 void
 updatenumlockmask(void)
 {
index 58047ac8a1545d638d8b44d2d4b408471ae8cdc0..774e6b15aa1671c34c47fce446088892084c779c 100644 (file)
@@ -27,3 +27,6 @@ dialog_ratio          = 0.6
 # (non-standard driver-based multihead is not seen by scrotwm)
 # region               = screen[1]:1280x1024+0+0
 # region               = screen[1]:1280x1024+1280+0
+
+# mod key, (windows key is Mod4)
+# modkey = Mod1