[xmonad] How to make the menu key your mod key too?

Brandon Allbery allbery.b at gmail.com
Wed Dec 24 19:36:17 UTC 2014


On Wed, Dec 24, 2014 at 2:30 PM, jenia.ivlev <jenia.ivlev at gmail.com> wrote:

> 1. I'm really used to using the alt-tab for window switching. How
> can I set alt-tab to work for switching windows like before? Just to
> reiterate, even though
> I set mob to be "super key" before, I would like alt-tab to work
> as usual, like in vanilla xmonad.
>

You can still bind things explicitly using mod1Mask instead of mod4Mask or
the convenience modMask. See below.

2. And two, I would like there to be a mod key on the right side of the
> keyboard too. So I decided to use the "menu key" for that.
> How do I map my "menu key" to be mod too?
>

This is a little more involved, since we rely on X11's keyboard handling
instead of trying to interpret nonportable keycodes directly. The Menu key
is not a modifier key in common X11 keymaps, but is bound to xK_Menu. You
need to undo this, either using Xkb (a crawling horror which is
"recommended" but which even those who recommend it do not fully
understand) or xmodmap; I use the latter.

This is also available as http://lpaste.net/117177

import XMonadimport XMonad.Hooks.DynamicLogimport
XMonad.Util.EZConfigimport qualified XMonad.StackSet as W
main = xmonad =<< statusBar cmd pp kb conf
  where
    cmd = "xmobar"
    pp = xmobarPP
    kb (XConfig {XMonad.modMask = modMask}) = (modMask, xK_b)
    conf = myConfig
myConfig = defaultConfig { borderWidth = 2
                         , terminal = "urxvt"
                         , modMask = mod4Mask
                         , startupHook = spawn "xmodmap -e 'add mod4 = Menu'"
                         }
           `additionalKeys`
           -- alternatively, consider XMonad.Actions.CycleWindows
which includes a
           -- more Windows-like alt-tab mechanism (cycleRecentWindows)
           -- http://xmonad.org/xmonad-docs/xmonad-contrib/XMonad-Actions-CycleWindows.html
           [((mod1Mask, xK_Tab), windows W.focusDown)
           ]


-- 
brandon s allbery kf8nh                               sine nomine associates
allbery.b at gmail.com                                  ballbery at sinenomine.net
unix, openafs, kerberos, infrastructure, xmonad        http://sinenomine.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/xmonad/attachments/20141224/8afd6453/attachment.html>


More information about the xmonad mailing list