2

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)

jk121960
  • 843
  • 14
  • 45

2 Answers2

2

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

david
  • 1,302
  • 1
  • 10
  • 21
  • Hi and thanks, and that was very useful, what I am looking for however is to activate more modifiers. The menu key would be great. Right now it seems as though Awesome doesn't recognize it at all, I can make a binding say to menu+e, the binding will work even if I just key "e", this tells me that Awesome is ignoring it. According to the docs we can use all the way up to Mod5 plus the common ones. Do you know how I can turn on the menu key? that would be perfect, thanks very much for your help. – jk121960 Jul 18 '20 at 16:41
  • You can discover keycodes and other informations with `$ xev` . With my Menu key I get `keycode 135 (keysym 0xff67, Menu)`. You could use 'Menu' in your `xmodmap ` command: `$ xmodmap -e "add mod1 = Menu"` – david Jul 18 '20 at 16:56
  • But doesn't that set Mod1 which is Alt_L now to use menu? I don't want to use menu to have another Alt but to act as a unique modifier, thereby extending the shortcut possibilities. thanks for your patience. – jk121960 Jul 18 '20 at 17:02
  • OK. Menu is already in mod1 modifiers. You have to reassign mod1 without Menu and then add Menu to mod3 modifiers, for example. I edit my answer. – david Jul 18 '20 at 17:16
  • No go, with a binding in awesome of Menu+e nothing happens but keying the "e" triggers the event, so it seems like once again awesome is just ignoring the key, I added my modifications that I appended to Xmodmap and the output of cli xmodmap, thanks – jk121960 Jul 18 '20 at 19:11
  • Everything is ok for me, adding `awful.key({"Mod3"}, "e", function() naughty.notification({text="ok"}) end)` to `root.keys ` produces the notification and "e" (alone) doens not trigger the notif. – david Jul 18 '20 at 22:00
  • Ok, that got it, I was attempting to use Menu as the constant which was pointing to a keycode of #135 which is what I got when I put it in xev, but when I swapped it out for the string "Mod3" it worked, if you look at the code I added to Xmodmap I assign the keycode to Menu, I guess that isn't enough. Anyway thanks for your patience you've been great, thanks – jk121960 Jul 18 '20 at 23:03
0

The way that Xorg keeps track of these keys, is by storing a table of keycodes. You can view what keycodes are assigned to which modifier keys with xmodmap.

> xmodmap

shift      Shift_L (0x32),  Shift_R (0x3e)
lock       Caps_Lock(0x42)
...

Some of these keys are also used for other things. In my case, I wanted to use my Capslock as my main modifier key, without triggering capslock. What I did to achieve that was remove the lock keybind, then rebind the keycode of my CapsLock key to Hyper_R and assign that to a mod key using xmodmap.

~/.Xmodmap

clear lock
keycode 66 = Hyper_R
add mod3 = Hyper_R

After doing this, in my rc.lua I changed the modkey to mod3:

modkey = "Mod3"

Be warned that Hyper_R might be bound on your system, so if a key stops working after doing this, that might be the reason.

Nickiel
  • 99
  • 1
  • 3
  • 13