On Wed, May 26, 2010 at 01:08:27AM +0200, orsch...@googlemail.com wrote: > Sorry forgot to add a small request when we're already talking about this > issue. > > Is there any way to display the currently used layout via xsetroot in > statusbar? >
I simply use something like setxkbmap -option "grp:alt_shift_toggle,grp_led:caps" "ie,de" which uses the otherwise unused caps lock led for this. Btw, I noticed that if you specify more than two keyboards, bits 13 and 14 in XEvent->xbutton->state seem to indicate which layout is currently selected. This seems to be consistent with the following macro defined in /usr/include/X11/extensions/XKB.h : #define XkbGroupForCoreState(s) (((s)>>13)&0x3) Rather than including XKB.h and dealing with its macros, the better solution might be to simply list the allowed modifiers in the CLEANMASK macro as in the attached patch. This works for any number of keyboard layout and masks out any other modifiers by default. Arguably the definition of CLEANMASK could even move to config.def.h for easy tweakability by users. Andreas
diff --git a/dwm.c b/dwm.c --- a/dwm.c +++ b/dwm.c @@ -43,7 +43,7 @@ /* macros */ #define D if(1) #define BUTTONMASK (ButtonPressMask|ButtonReleaseMask) -#define CLEANMASK(mask) (mask & ~(numlockmask|LockMask)) +#define CLEANMASK(mask) (mask & (ShiftMask|ControlMask|Mod1Mask|Mod2Mask|Mod3Mask|Mod4Mask|Mod5Mask)) #define INRECT(X,Y,RX,RY,RW,RH) ((X) >= (RX) && (X) < (RX) + (RW) && (Y) >= (RY) && (Y) < (RY) + (RH)) #define ISVISIBLE(C) ((C->tags & C->mon->tagset[C->mon->seltags])) #define LENGTH(X) (sizeof X / sizeof X[0])