I'm trying to remap the last row of my keyboard to mimic the Happy Hacking Keyboard layout. I created a .Xmodmap
file with following the keycode changes. The below shows only the lines that have been changed manually in the Xmodmap file generated using xmodmap -pke > ~/.Xmodmap
.
keycode 37 = Super_L NoSymbol Super_L
keycode 64 = Control_L NoSymbol Control_L
keycode 105 = Super_R NoSymbol Super_R
keycode 108 = Control_R NoSymbol Control_R
keycode 133 = Alt_L Meta_L Alt_L Meta_L
keycode 134 = Alt_R Meta_R Alt_R Meta_R
The above changes were loaded using
xmodmap ~/.Xmodmap
The changes were verified from running xev
i.e. Alt key: Ctrl, Super key: Alt and Ctrl key: Super.
However, when I run emacs, it is still Alt key: Alt, Super key: Super & Ctrl key: Ctrl. And, the terminal can still be launched only by pressing Alt + Ctrl + t instead of Alt + Super + t. These applications still reflect the default keyboard layout, not in accordance to the new configuration in my $HOME/.Xmodmap
file.
Added the xmodmap ~/.Xmodmap
to the $HOME/.xinitrc
file so that the changes are persistant across applications. This did not the work.
Also, added the following code to /etc/X11/xinit/xinitrc
. But this did not work either.
if [ -f $HOME/.Xmodmap ]; then
/usr/bin/xmodmap $HOME/.Xmodmap
fi
Kindly provide your suggestions.
Thank you for your time.
-Girish
Recently switched to Ubuntu from Windows. I use Emacs for writing code and have found it effective to map the keys as in HHK. It avoids hurting the pinky and RSI of the wrists.
For info, if you don't want to get into the pain of Xmodmap
, you can also do a lot via gnome settings.
sudo apt-get install gnome-tweak-tool
, open it, go to Typing, and check out the options for Ctrl key position and Alt/Win key behaviour:
You could probably also do this stuff via gsettings
, but am not sure of the exact config entry name.
Finally, got the keyboard to mimic the HHK layout (for the last row of the keyboard).
Had to add the command to clear the modifier keys before making the changes for the new keymap. Then, enabled the modifier keys.
clear control
clear mod1
clear mod4
keycode 37 = Super_L NoSymbol Super_L
keycode 64 = Control_L NoSymbol Control_L
keycode 105 = Super_R NoSymbol Super_R
keycode 108 = Control_R NoSymbol Control_R
keycode 133 = Alt_L Meta_L Alt_L Meta_L
keycode 134 = Alt_R Meta_R Alt_R Meta_R
add control = Control_L Control_R
add mod1 = Alt_L Alt_R
add mod4 = Super_L Super_R
Thank you @d4gg4d for sharing ur Xmodmap file. Else, I wouldn't have figured it out.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With