6

I use Mod4 for most keybindings in i3, but I use Mod1 for this:

bindsym Mod1+a workspace a
bindsym Mod1+b workspace b
bindsym Mod1+c workspace c
bindsym Mod1+d workspace d
...

However this binds both alt and altgr, which is undesired since I use altgr+<letter> to type some characters.

xev says alt is Alt_L and altgr is Alt_R, but bindsym Alt_L+a doesn't work

1
  • Ultimately it depends on what xmodmap shows for mod1 Nov 2, 2015 at 10:29

1 Answer 1

5

Ultimately it depends on what xmodmap shows for mod1. For instance, if it shows that Alt_L and Alt_R are on the same modifier, you would have to move the latter to another (of the 5 available modifiers) to avoid conflict.

Here are a few pages giving examples:

  • Remapping Alt_R with xmodmap disable VC terminal switching shows an example where the user moved Alt_R from mod1 to mod4 (and ran into problems). You should review the output from xmodmap before changing it.
  • xmodmap on ArchLinux shows a detailed example manipulating modifiers. To move a key, you must add it to one modifier and clear it from the other.

One pitfall in using xmodmap is that it does not always know the proper keycode for a key symbol (such as Alt_R). When I encounter that, I can usually work around it by looking in the output from

xmodmap -pk

for the key symbol, and in the script, assign that keycode. For example, on one machine xmodmap -pk shows

108         0xffea (Alt_R)  0x0000 (NoSymbol)       0xffea (Alt_R)

and using this script

keycode 108 = Alt_R
remove mod1 = Alt_R
add mod3 = Alt_R

changes the output from this:

xmodmap:  up to 4 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      
mod4        Super_L (0x85),  Super_R (0x86),  Super_L (0xce),  Hyper_L (0xcf)
mod5        ISO_Level3_Shift (0x5c),  Mode_switch (0xcb)

to this:

xmodmap:  up to 4 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),  Meta_L (0xcd)
mod2        Num_Lock (0x4d)
mod3        Alt_R (0x6c)
mod4        Super_L (0x85),  Super_R (0x86),  Super_L (0xce),  Hyper_L (0xcf)
mod5        ISO_Level3_Shift (0x5c),  Mode_switch (0xcb)

(For this particular machine, the workaround is not needed).

5
  • So I made a file .Xmodmap containing clear Mod1\nadd Mod1 = Alt_L and ran xmodmap ~/.Xmodmap however it didn't change anything.
    – Alice Ryhl
    Nov 2, 2015 at 11:50
  • But you did not show the result of xmodmap before and after, to show what the change might have been. Nov 2, 2015 at 11:52
  • What do you mean? The xmodmap ~/.Xmodmap command outputted nothing to stdout.
    – Alice Ryhl
    Nov 2, 2015 at 16:14
  • Without any options or parameters, xmodmap prints the current modifier map (like the -pm option). If you tell it to read a file, to set modifiers, it does not print the result at that time. Nov 3, 2015 at 1:38
  • I restarted and took the output both before and after running xmodmap ~/.Xmodmap, it was pastebin.com/V07mRn3F both times.
    – Alice Ryhl
    Nov 3, 2015 at 10:32

You must log in to answer this question.

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