How to make the menu key your mod key too?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

How to make the menu key your mod key too?

jenia.ivlev

Hello.

I set my mod key to be the "super" key. This setup needs two very
precise and small additional features:

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.

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?

I'm wondering if someone has done this or knows how to do it.

Thanks very much in advnace for your kind help and concern.
jenia

=================================================================================

This is my config file:

import XMonad
import XMonad.Hooks.DynamicLog

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
                         }


Reply | Threaded
Open this post in threaded view
|

How to make the menu key your mod key too?

Brandon Allbery
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>

Reply | Threaded
Open this post in threaded view
|

How to make the menu key your mod key too?

Paul Fertser
On Wed, Dec 24, 2014 at 02:36:17PM -0500, Brandon Allbery wrote:
> 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)

I use the Xkb way here [1] to remap keys and assign modifiers. In this
particular case I used a special "none" modifier which removes the key
from all the modifiers, this one is not nicely documented, but other
than that the Xkb resources seem to provide decent info.

[1] https://gitorious.org/xmonad-smartphone-config/xmonad-smartphone-config/source/aa36011d09c17d2fef0c40fd8d5451f27110fb59:.xkb/symbols/xkbcustom

--
Be free, use free (http://www.gnu.org/philosophy/free-sw.html) software!
mailto:fercerpav at gmail.com

Reply | Threaded
Open this post in threaded view
|

How to make the menu key your mod key too?

jenia.ivlev
In reply to this post by Brandon Allbery
Thanks at lot. It worked perfectly.

I managed to make the "menu" key into a super key too. You can use `xmodmap`:

    keysym Menu = Super_L

You can figure out the names of the keys using `xev`

Now I'm totally set.
Thanks again and happy Holidays.


Reply | Threaded
Open this post in threaded view
|

How to make the menu key your mod key too?

jenia.ivlev
In reply to this post by Paul Fertser
Thanks very much.
I managed to make it work using xmodmap and xev

    keysym Menu = Super_L

Thanks and Happy Holidays!!