i3: Binding numpad keys doesn't work anymore

Output of i3 --moreversion 2>&- || i3 --version:

Binary i3 version:  4.13 (2016-11-08) © 2009 Michael Stapelberg and contributors
Running i3 version: 4.13 (2016-11-08) (pid 566)to abort…)
Loaded i3 config: /home/stfn/.i3/config (Last modified: Sat 12 Nov 2016 02:33:58 PM CET, 721 seconds ago)

The i3 binary you just called: /usr/bin/i3
The i3 binary you are running: i3

In my i3 config I have the following configuration:

# switch to workspace (with numpad)
bindsym $mod+KP_1 workspace 1
bindsym $mod+KP_2 workspace 2
bindsym $mod+KP_3 workspace 3
bindsym $mod+KP_4 workspace 4
bindsym $mod+KP_5 workspace 5
bindsym $mod+KP_6 workspace 6
bindsym $mod+KP_7 workspace 7
bindsym $mod+KP_8 workspace 8
bindsym $mod+KP_9 workspace 9
bindsym $mod+KP_0 workspace 10

The idea is pretty obvious I guess; I simply want to be able to switch i3 workspaces using my modifier key (Windows key) + number keys on my numpad (with numlock enabled).

This used to work fine with i3 versions <= 4.12 but since I have upgraded to 4.13 today it stopped doing anything. When I press for example $mod+0 the 0 is being sent as input to the focused window just like it would if there wasn’t any keybinding at all.

My operating system is a fully up-to-date Arch Linux x86-64.

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 5
  • Comments: 40 (19 by maintainers)

Most upvoted comments

I think I’ve figured it out:

# move focused container to workspace (with numpad)
bindsym $mod+Shift+Mod2+KP_End move container to workspace 1
bindsym $mod+Shift+Mod2+KP_Down move container to workspace 2
bindsym $mod+Shift+Mod2+KP_Next move container to workspace 3
bindsym $mod+Shift+Mod2+KP_Left move container to workspace 4
bindsym $mod+Shift+Mod2+KP_Begin move container to workspace 5
bindsym $mod+Shift+Mod2+KP_Right move container to workspace 6
bindsym $mod+Shift+Mod2+KP_Home move container to workspace 7
bindsym $mod+Shift+Mod2+KP_Up move container to workspace 8
bindsym $mod+Shift+Mod2+KP_Prior move container to workspace 9
bindsym $mod+Shift+Mod2+KP_Insert move container to workspace 10

Looks rather confusing but they seem to work.

If anyone comes here, the configuration that worked for me to switch on $mod + numeric keypad and move $mod + shift + numeric keypad on a french layout, with numlock always on, is :

bindsym $mod+Mod2+KP_1 workspace 1
bindsym $mod+Mod2+KP_2 workspace 2
bindsym $mod+Mod2+KP_3 workspace 3
bindsym $mod+Mod2+KP_4 workspace 4
bindsym $mod+Mod2+KP_5 workspace 5
bindsym $mod+Mod2+KP_6 workspace 6
bindsym $mod+Mod2+KP_7 workspace 7
bindsym $mod+Mod2+KP_8 workspace 8
bindsym $mod+Mod2+KP_9 workspace 9
bindsym $mod+Mod2+KP_0 workspace 10

bindsym $mod+Shift+Mod2+KP_End move container to workspace 1
bindsym $mod+Shift+Mod2+KP_Down move container to workspace 2
bindsym $mod+Shift+Mod2+KP_Next move container to workspace 3
bindsym $mod+Shift+Mod2+KP_Left move container to workspace 4
bindsym $mod+Shift+Mod2+KP_Begin move container to workspace 5
bindsym $mod+Shift+Mod2+KP_Right move container to workspace 6
bindsym $mod+Shift+Mod2+KP_Home move container to workspace 7
bindsym $mod+Shift+Mod2+KP_Up move container to workspace 8
bindsym $mod+Shift+Mod2+KP_Prior move container to workspace 9
bindsym $mod+Shift+Mod2+KP_Insert move container to workspace 10

that’s fairly unintuitive but oh well

Try adding Mod2 to the binding, i.e. modify the binding to read bindsym $mod+Mod2+KP_1 workspace ….

With changes between v4.12 to v4.13, the numlock fallback became a bit stricter: when the key in question resolves to a different symbol with/without numlock (e.g. KP_1 vs. KP_End), the user needs to explicitly specify the numlock modifier now. This is necessary to disambiguate KP_1 and KP_End — previously, it wasn’t possible to bind on KP_End, but not KP_1.

Using bindcode as @stef204 we can use variables to keep something cleanish

set $KP_1 87
set $KP_2 88
set $KP_3 89
set $KP_4 83
set $KP_5 84
set $KP_6 85
set $KP_7 79
set $KP_8 80
set $KP_9 81
set $KP_0 90

bindcode $mod+$KP_1 workspace $workspace1
bindcode $mod+$KP_2 workspace $workspace2
bindcode $mod+$KP_3 workspace $workspace3
bindcode $mod+$KP_4 workspace $workspace4
bindcode $mod+$KP_5 workspace $workspace5
bindcode $mod+$KP_6 workspace $workspace6
bindcode $mod+$KP_7 workspace $workspace7
bindcode $mod+$KP_8 workspace $workspace8
bindcode $mod+$KP_9 workspace $workspace9
bindcode $mod+$KP_0 workspace $workspace10

bindcode $mod+Shift+$KP_1 move container to workspace $workspace1
bindcode $mod+Shift+$KP_2 move container to workspace $workspace2
bindcode $mod+Shift+$KP_3 move container to workspace $workspace3
bindcode $mod+Shift+$KP_4 move container to workspace $workspace4
bindcode $mod+Shift+$KP_5 move container to workspace $workspace5
bindcode $mod+Shift+$KP_6 move container to workspace $workspace6
bindcode $mod+Shift+$KP_7 move container to workspace $workspace7
bindcode $mod+Shift+$KP_8 move container to workspace $workspace8
bindcode $mod+Shift+$KP_9 move container to workspace $workspace9
bindcode $mod+Shift+$KP_0 move container to workspace $workspace10

Another crazy idea would be for somebody to write a tool that spits out the correct combination to use. Currently we always refer to xev which prints a lot of information the user doesn’t need and, in this case, not all the information they need in a meaningful way.

Such a tool could be a great help for a lot of people, I would imagine.

Shift does invert the meaning of numpad keys, that’s how the numpad works. Try it out in a text editor, or in xev(1). No need to open a new issue, this is working as intended.

@Airblader , it’s ok, i’m happy. I just feel like it was not necessary (because i not understand), but if you said that it should and that users can access something they can not before… ok then, i just not understand what is it after read all threads. I’m sorry to insist and maybe the tonality i had wasn’t good, i’m not english, so… don’t be hurt, my intentions are not wrong and i’m very happy with i3wm and thank you for this window manager guys.

I’m going to re-open this issue so that people will have an easier time finding it (there have been a couple of duplicates recently).

Regardless of the status, please refer to https://github.com/i3/i3/issues/2558#issuecomment-260770392 — there’s nothing we can do about this issue, and you’ll need to change your keybinding to add Mod2 in the appropriate place (see the previous comments).

You’re right, that works!

But what do I do with the following bindings?

# move focused container to workspace (with numpad)
bindsym $mod+Shift+KP_1 move container to workspace 1
bindsym $mod+Shift+KP_2 move container to workspace 2
bindsym $mod+Shift+KP_3 move container to workspace 3
bindsym $mod+Shift+KP_4 move container to workspace 4
bindsym $mod+Shift+KP_5 move container to workspace 5
bindsym $mod+Shift+KP_6 move container to workspace 6
bindsym $mod+Shift+KP_7 move container to workspace 7
bindsym $mod+Shift+KP_8 move container to workspace 8
bindsym $mod+Shift+KP_9 move container to workspace 9
bindsym $mod+Shift+KP_0 move container to workspace 10

Unforunately using bindsym $mod+Shift+Mod2+KP_1 move container to workspace 1 doesn’t seem to do the trick there.