5

I am trying to map keys in KWin like Meta + KP4 in Kubuntu 11.04.

If numlock is on, it gets recorded as "Meta + 4" and then works with the 4 on the main keyboard, but NOT on the keypad.

If numlock is off, it gets recorded as "Meta + Left" and then works with the left arrow on the main keyboard, but NOT on the keypad.

I want it to work on the keypad! Maybe there is some option in the keyboard settings...?

8

Thanks for the lead, there was a suggestion of a workaround in it. Here it is in case anyone else runs into this:

Create ~/.Xmodmap with the following text:

keycode 87 = XF86Launch1
keycode 88 = XF86Launch2
keycode 89 = XF86Launch3
keycode 83 = XF86Launch4
keycode 84 = XF86Launch5
keycode 85 = XF86Launch6
keycode 79 = XF86Launch7
keycode 80 = XF86Launch8
keycode 81 = XF86Launch9
keycode 90 = XF86LaunchA
keycode 91 = XF86LaunchB

I also added

keycode 86 = XF86LaunchC
keycode 82 = XF86LaunchD

which is for keypad +/-.

Then run xmodmap ~/.Xmodmap. You should be able to bind the to the keys now. Also, if other keys aren't working try the utility xev, which can tell you what the keycode is for a specific key and add it in a similar way.

| improve this answer | |
  • This works, and I added it to run automatically on startup. Btw, I want to say neither the numbers of the numpad nor the key arrows (Bloq Num on/off) don't work at all. – Gerard Aug 19 '15 at 19:12
1

Maybe this is related - A bug report: Bug 183458 - Numpad (keypad) keys not mapped correctly when setting Global Shortcuts / https://bugs.kde.org/show_bug.cgi?id=183458

| improve this answer | |
1

using xmodmap works but means the numpad can't be used as an actual numpad. The following workaround allows the numpad to be used to tile windows but also as a numpad.

Install xbindkeys

sudo apt-get install xbindkeys

Setup hotkeys

Add the following to ~/.xbindkeysrc. You may need to modify the key combination depending on your setup and desired hotkeys. This script uses the windows key and numpad. Running xbindkeys -k will allow you to discover what codes map to keys when you push them.

"qdbus org.kde.kglobalaccel /component/kwin org.kde.kglobalaccel.Component.invokeShortcut 'Window Quick Tile Bottom Left'"
Mod4 + Super_L + KP_1

"qdbus org.kde.kglobalaccel /component/kwin org.kde.kglobalaccel.Component.invokeShortcut 'Window Quick Tile Bottom'"
Mod4 + Super_L + KP_2

"qdbus org.kde.kglobalaccel /component/kwin org.kde.kglobalaccel.Component.invokeShortcut 'Window Quick Tile Bottom Right'"
Mod4 + Super_L + KP_3

"qdbus org.kde.kglobalaccel /component/kwin org.kde.kglobalaccel.Component.invokeShortcut 'Window Quick Tile Left'"
Mod4 + Super_L + KP_4

"qdbus org.kde.kglobalaccel /component/kwin org.kde.kglobalaccel.Component.invokeShortcut 'Window Maximize'"
Mod4 + Super_L + KP_5

"qdbus org.kde.kglobalaccel /component/kwin org.kde.kglobalaccel.Component.invokeShortcut 'Window Quick Tile Right'"
Mod4 + Super_L + KP_6

"qdbus org.kde.kglobalaccel /component/kwin org.kde.kglobalaccel.Component.invokeShortcut 'Window Quick Tile Top Left'"
Mod4 + Super_L + KP_7

"qdbus org.kde.kglobalaccel /component/kwin org.kde.kglobalaccel.Component.invokeShortcut 'Window Quick Tile Top'"
Mod4 + Super_L + KP_8

"qdbus org.kde.kglobalaccel /component/kwin org.kde.kglobalaccel.Component.invokeShortcut 'Window Quick Tile Top Right'"
Mod4 + Super_L + KP_9
| improve this answer | |
0

Bryce Drennan's solution is very nice, although I wanted to have a slightly different keybinding. To emulate Ubuntu/Unity settings, use the following in ~/.xbindkeysrc:

"qdbus org.kde.kglobalaccel /component/kwin org.kde.kglobalaccel.Component.invokeShortcut 'Window Quick Tile Bottom Left'"
Control + Mod2 + Mod4 + Super_L + KP_End

"qdbus org.kde.kglobalaccel /component/kwin org.kde.kglobalaccel.Component.invokeShortcut 'Window Quick Tile Bottom'"
Control + Mod2 + Mod4 + Super_L + KP_Down

"qdbus org.kde.kglobalaccel /component/kwin org.kde.kglobalaccel.Component.invokeShortcut 'Window Quick Tile Bottom Right'"
Control + Mod2 + Mod4 + Super_L + KP_Next

"qdbus org.kde.kglobalaccel /component/kwin org.kde.kglobalaccel.Component.invokeShortcut 'Window Quick Tile Left'"
Control + Mod2 + Mod4 + Super_L + KP_Left

"qdbus org.kde.kglobalaccel /component/kwin org.kde.kglobalaccel.Component.invokeShortcut 'Window Maximize'"
Control + Mod2 + Mod4 + Super_L + KP_Begin

"qdbus org.kde.kglobalaccel /component/kwin org.kde.kglobalaccel.Component.invokeShortcut 'Window Quick Tile Right'"
Control + Mod2 + Mod4 + Super_L + KP_Right

"qdbus org.kde.kglobalaccel /component/kwin org.kde.kglobalaccel.Component.invokeShortcut 'Window Quick Tile Top Left'"
Control + Mod2 + Mod4 + Super_L + KP_Home

"qdbus org.kde.kglobalaccel /component/kwin org.kde.kglobalaccel.Component.invokeShortcut 'Window Quick Tile Top'"
Control + Mod2 + Mod4 + Super_L + KP_Up

"qdbus org.kde.kglobalaccel /component/kwin org.kde.kglobalaccel.Component.invokeShortcut 'Window Quick Tile Top Right'"
Control + Mod2 + Mod4 + Super_L + KP_Prior
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.