13

After an hour or two of manpage and Google searching and finding no solution or good resources, I've come for help!

I have set my Caps Lock key to Ctrl using setxkbmap -option ctrl:nocaps - this works perfectly fine.

However, since I use [awesome][1], and an IBM model M which lacks the meta key, I need my left alt key to replace the windows key. Using xkeycaps I was able to get this to work, except it killed my arrow keys and End. Problematic.

Unfortunately, documentation on setxkbmap options are sparse. and I can't find the proper option to use.

Thanks for any links/solutions.

1 Answer 1

22
setxkbmap -option altwin:swap_alt_win

The list of predefined remapping options is in /usr/share/X11/xkb/rules/evdev.lst. In this case, you probably want one of

jinx:792 Z$ grep alt /usr/share/X11/xkb/rules/evdev.lst | grep win
  altwin               Alt/Win key behavior
  altwin:menu          Add the standard behavior to Menu key
  altwin:meta_alt      Alt and Meta are on Alt keys
  altwin:ctrl_win      Control is mapped to Win keys (and the usual Ctrl keys)
  altwin:ctrl_alt_win  Control is mapped to Alt keys, Alt is mapped to Win keys
  altwin:meta_win      Meta is mapped to Win keys
  altwin:left_meta_win Meta is mapped to Left Win
  altwin:hyper_win     Hyper is mapped to Win-keys
  altwin:alt_super_win Alt is mapped to Right Win, Super to Menu
  altwin:swap_lalt_lwin Left Alt is swapped with Left Win

The Windows key is generally mapped to X11's Super modifier, and the Menu key is sometimes mapped to its Hyper modifier.

5
  • 1
    Is there a way to swap the right alt and win instead of the left?
    – Kerrick
    Dec 14, 2011 at 21:05
  • 1
    @Kerrick just in case someone else stumbles across this question, like me. I was able to swap the left alt to windows, and retain the alt behavior in the right alt by using: setxkbmap -option altwin:swap_lalt_lwin
    – tbranyen
    Jul 21, 2019 at 21:16
  • @tbranyen did you find any way to remap also the right win with altgr ? I am using a windows keyboard but I am used to altgr in the position where the Mac has it. Sep 22, 2019 at 10:35
  • Ups found it using setxkbmap -option lv3:rwin_switch after switching the alt and win keys, thanks! :D Sep 22, 2019 at 10:48
  • Great, but when where how do you run this? Can you make this permanent somewhere?
    – NeilG
    Oct 16, 2021 at 23:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .