Search code examples
awesome-wm

AwesomeWm I need advice on mapping more modifier keys


I need to find another couple modifiers for key mappings. The Awesome Docs state that valid modifiers are Any, Mod1, Mod2, Mod3, Mod4, Mod5, Shift, Lock and Control, I am unclear of some of these but I have tried Capslock and Tab and it didn't work well. While the binding seems to work I found that you can still trigger the function by using just the "key" portion as if the modifier was being ignored. I know I will have to map these more than likely and I was hoping I could get some advice on where to start, thanks in advance for any help

I am using awesome 4.3 on Manjaro/Arch thanks

clear mod4 
add mod4 = Super_L Hyper_L 
add mod3 = Super_R Menu
keycode 135 = Super_R Menu

and the output of cli xmodmap

xmodmap:  up to 3 keys per modifier, (keycodes in parentheses):

shift       Shift_L (0x32),  Shift_R (0x3e)
lock        Caps_Lock (0x42)
control     Control_L (0x25),  Control_R (0x69)
mod1        Alt_L (0x40),  Alt_R (0x6c),  Meta_L (0xcd)
mod2        Num_Lock (0x4d)
mod3        Super_R (0x86),  Super_R (0x87)
mod4        Super_L (0x85),  Super_L (0xce),  Hyper_L (0xcf)
mod5        ISO_Level3_Shift (0x5c),  Mode_switch (0xcb)


Solution

  • You can see current modifiers with xmodmap in a terminal.

    You can add Tab key to mod1 with: $ xmodmap -e "add mod1 = Tab"

    Then you can use Mod1 in rc.lua, for example:

    root.buttons = gears.table.join(
          ...
          ...
          awful.button({"Mod1"}, 1, function() naughty.notification({text="ok"}) end),
          ...
          ...
    )
    

    With holding Tab and pressing left mouse button, you pop up the notification.

    Nevertheless, Tab will continue to tabulate... but if you want to change this behaviour, you may need to consider a xmodmap tutorial like this one.

    In awesomeWM, you can find a table with your current modifiers. Below we can see that Tab has been added to the Mod1 table:

    $ awesome-client "return awesome._modifiers.Mod1[1].keysym"
       string "Tab"
    $ awesome-client "return awesome._modifiers.Mod1[1].keycode"
       double 23
    

    Edit

    With xmodmap to reassign Menu key to mod3:

    clear mod1
    add mod1 = Alt_L Meta_L
    add Mod3 = Menu
    

    More on xmodmap