You are not logged in.

#1 2014-09-09 13:00:14

kokoko3k
Member
Registered: 2008-11-14
Posts: 2,398

Change the kernel keymap and xkbd keyboard layout?

I'd like to remap
CTRL+(Left,Right,Up,Down)
to
Begin,End,PgUp,PgDown

And i've to say that i almost succeded, but probably there's a better way.

For the tty, i made a modified it.map.gz called itCtrlArrows.map.gz,
put it into /usr/share/kbd/keymaps/i386/qwerty/
modified /etc/vconsole.conf accordingly and rebooted.
Ttys works, fine.

For Xorg i've had to use xbindkeys with something like:

"xvkbd -xsendevent -text '\[Home]'"
    m:0x14 + c:113
    Control+Mod2 + Left
"xvkbd -xsendevent -text '\[Shift]\[Home]'"
    m:0x5 + c:113
    Control+Shift + Left
"xvkbd -xsendevent -text '\[End]'"
    m:0x14 + c:114
    Control+Mod2 + Right
"xvkbd -xsendevent -text '\[Shift]\[End]'"
    m:0x5 + c:114
    Control+Shift + Right
"xvkbd -xsendevent -text '\[Prior]'"
    m:0x14 + c:111
    Control+Mod2 + Up
"xvkbd -xsendevent -text '\[Shift]\[Prior]'"
    m:0x5 + c:111
    Control+Shift + Up
"xvkbd -xsendevent -text '\[Next]'"
    m:0x14 + c:116
    Control+Mod2 + Down
"xvkbd -xsendevent -text '\[Shift]\[Next]'"
    m:0x5 + c:116
    Control+Shift + Down

It works too, but it is an highly inefficient solution.

The tty keyboard layouts are really easy to hack, could this one be done somehow with an xkb keyboard layout?

How?

smile

Last edited by kokoko3k (2014-09-09 19:14:26)


Help me to improve ssh-rdp !
Retroarch User? Try my koko-aio shader !

Offline

#2 2014-09-09 22:18:38

dhead
Member
Registered: 2012-09-26
Posts: 190

Re: Change the kernel keymap and xkbd keyboard layout?

I was just trying to figure this out myself and got to the realization that keyboard layout handling in Linux == crap and total mess.

xvkbd doesn't really works as you expect, try for example your mapping in Epiphany or Nautilus.

From what I gather you really can't map key combination with CTRL to a keysym in X as CTRL isn't a modifier key.
What you can do is to set a modifier key and the best way to do that would be to patch xkeyboard-config (I didn't tried yet, just looked in the code) but if you only got one keyboard layout then you can also use xmodmap and of course both method won't work in Wayland.

See
http://cgit.freedesktop.org/xkeyboard-config (notice in symbols/us that English (US) layout doesn't map ALT_R to ISO_Level3_Shift, "level3(ralt_switch)" )
http://askubuntu.com/questions/5095/typ … mbinations

Offline

#3 2014-09-10 06:54:04

kokoko3k
Member
Registered: 2008-11-14
Posts: 2,398

Re: Change the kernel keymap and xkbd keyboard layout?

If the windows key is a modifier, i could use it instead of CTRL.

Btw, are you sure CTRL isn't a modifier key?
I'm not sure what the following output actually means.

(-pm = print modifier map)
# xmodmap -pm      #(print modifier map)
xmodmap:  up to 2 keys per modifier, (keycodes in parentheses): 
shift       Shift_L (0xa),  Shift_R (0xb)                                                                     
lock 
control     Control_L (0x8),  Control_R (0x9)
mod1        Alt_L (0xe),  Alt_R (0xf)
mod2      
mod3      
mod4        Meta_L (0xc),  Meta_R (0xd)
mod5      

However i can't figure out how to use it to achieve the desidered result (with the Win or the CTRL key)

-EDIT-
My example seems to work in dolphin and kwrite (i use kde) and firefox too to me.
If it doesn't for you, maybe is because your keycodes are different (i'm an it keyboard)

Last edited by kokoko3k (2014-09-10 07:00:16)


Help me to improve ssh-rdp !
Retroarch User? Try my koko-aio shader !

Offline

#4 2014-09-10 09:27:39

kokoko3k
Member
Registered: 2008-11-14
Posts: 2,398

Re: Change the kernel keymap and xkbd keyboard layout?

...meanwhile i found a daemon called bkeyd which seems way lighter than xbindkeys (at least in terms of memory, it uses almost 100KB vs almost 3MB).
It is in aur, and probably can also replace acpid with a little work.

-EDIT-
nope, bkeyd and shkd (similar tools) both uses less ram than xbindkeys, but unfortunately are more cpu hungry, with spikes even when unconfigured keys are pressed.

Last edited by kokoko3k (2014-09-10 13:20:05)


Help me to improve ssh-rdp !
Retroarch User? Try my koko-aio shader !

Offline

Board footer

Powered by FluxBB