The i3 FAQ has migrated to https://github.com/i3/i3/discussions. All content here is read-only.
Ask Your Question
0

$mod+Shift+A works, Strg+Alt+a doesn't

asked 2015-06-28 13:53:12 +0000

a_flamethrowing_duck gravatar image

I've tried several bindsym's to have a programm exec'd:

$mod+Shift+A exec flamethrowers ..works
$mod+Alt+a exec flamethrowers ..doesnt work
Strg+Alt+a exec flamethrowers ..doesnt work either..

can someone explain this to me, thank you!

edit retag flag offensive close merge delete

3 answers

Sort by ยป oldest newest most voted
1

answered 2015-06-30 08:47:26 +0000

Adaephon gravatar image

Neither Alt nor Strg are valid modifiers. According to the User's Guide, key bindings are to be defined like this:

bindsym [--release] [Modifiers+]keysym command
bindcode [--release] [Modifiers+]keycode command

where [Modifiers+] is a list of modifiers separated and ended with +. Recognized modifiers are

  • Mod1 (usually aka "Alt" or "Meta")
  • Mod2 ("NumLock")
  • Mod3 (unused on default QWERTY layout)
  • Mod4 (aka "Super" or "Windows-Key")
  • Mod5 (e.g. "Alt_Gr" on german QWERTZ layout)
  • Shift
  • Control
  • Mode_Switch

Depending on the physical keyboard and keyboard layout you use, not every modifier is necessarily available or mapped to a key that your keyboard actually has. You can use xmodmap -pm to get a list of modifiers and the key symbols and codes they are mapped to. For the US layout ("QWERTY") it looks something like that:

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)

As you can see, here the "Alt" keys (Alt_L and Alt_R) are mapped to the mod1 modifier. So in order to utilize them in the i3 configuration, you would write:

bindsym Mod1+a exec flamethrowers
bindsym Control+Mod1+a exec flamethrowers
bindsym $mod+Control+Mod1+a exec flamethrowers

Note: some combinations of modifiers may not work, depending on layout and possibly keyboard hardware.

edit flag offensive delete link more
1

answered 2015-06-28 14:36:22 +0000

Airblader gravatar image

updated 2015-06-28 14:39:05 +0000

That's because Alt isn't a valid keysym. Use xev to figure out the correct one. You can just start it, move the mouse over the window it opens, press the Alt key and look into the stdout to find the keysym. The output you are looking for looks something like this:

KeyPress event, serial 32, synthetic NO, window 0x2c00001,
    root 0x29f, subw 0x0, time 19956153, (126,563), root:(1095,627),
    state 0x0, keycode 50 (keysym 0xffe1, Shift_L), same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyRelease event, serial 32, synthetic NO, window 0x2c00001,
    root 0x29f, subw 0x0, time 19956223, (126,563), root:(1095,627),
    state 0x1, keycode 50 (keysym 0xffe1, Shift_L), same_screen YES,
    XLookupString gives 0 bytes: 
    XFilterEvent returns: False
edit flag offensive delete link more

Comments

Thanks for the explanation! I've tried this and came to the conclusion that the following command should work `bindsym Control_L+Alt_L+a exec "keepass2 --auto-type"`.. I've reloaded i3's config but it doesn't seem to work for me. What am I missing?

a_flamethrowing_duck gravatar imagea_flamethrowing_duck ( 2015-06-28 15:03:30 +0000 )edit
1

answered 2015-06-28 14:53:37 +0000

oberon gravatar image

updated 2015-06-28 14:56:07 +0000

Easier: $mod+Mod1+a :)

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2015-06-28 13:53:12 +0000

Seen: 301 times

Last updated: Jun 30