Warning: Declaration of TarskiCommentWalker::start_lvl(&$output, $depth, $args) should be compatible with Walker_Comment::start_lvl(&$output, $depth = 0, $args = Array) in /hsphere/local/home/ackerfors/snigel.nu/wp-content/themes/tarski/library/classes/comment_walker.php on line 0 Warning: Declaration of TarskiCommentWalker::start_el(&$output, $comment, $depth, $args) should be compatible with Walker_Comment::start_el(&$output, $comment, $depth = 0, $args = Array, $id = 0) in /hsphere/local/home/ackerfors/snigel.nu/wp-content/themes/tarski/library/classes/comment_walker.php on line 0 Olle Linge - Languages, literature and the pursuit of dreams · Remapping keys for custom keyboard layouts in Ubuntu

Remapping keys for custom keyboard layouts in Ubuntu

This is the second time i perform this feat (yes, that is what it feels like) successfully. Since i was stupid enough not to write it down last time, i definitely will this time. Straight away in fact. If you do not know what I am talking about, I desired to remap the keyboard on my new laptop (more on that later) to the Swedish version of Dvorak I am using. There exists no layout files to accomplish this, so what one has to do is to remap keys individually. Here is how to do it:

  • Decide what you want to do and see what has been done before. Bear in mind that special characters are tedious to change, so start with a layout which has as many correctly mapped as possible. I used the Swedish default layout and then swapped all letters and some special characters like comma, period and others which deviate between the two layouts.
  • Use the terminal command xev to start a monitoring process. All the keys you press will be displayed with a lot of technical information. Note the keycode for the characters you want to change.
  • Create a file and put #!/bin/bash on the first line. Make sure that the file is executable by typing chmod +x nameofyourfile. Then list all the keys you want to change into something else by using xmodmap -e ‘keycode X = Y Z’ , where X is the noted keycode for that particular key, Y is the lower case of the desired character (i.e. when shift is not pressed) and Z is the upper case of the desired character (i.e. when shift is pressed). One xmodmap command on each line. To find Y and Z, use another layout you know (the default of your country). These files are found in \usr\share\xmodmap\.
  • Test your new layout by running the file in a terminal and fix mistakes. Do not put an untested layout in autostart, since it might be difficult to change back if you cannot type with a faulty layout.
  • When everything seems to work, put the file you created in autostart. Do this in System >> Preferences >> Sessions >> Autostart Programs >> Add and browse to your file. Log off and then log in again and marvel at the result.
  • The file I ended up with to change from Swedish standard to Svdvorak can be found here.
  • Aoeu!

Tags: , ,

  1. Emma’s avatar

    Thanks a lot! I can see it’s an old post, still, it helped me a lot after I’d spilled juice over my Enter key.


  2. Emma’s avatar

    By the way, I’ve found out that X and Z don’t have to be numeric keycodes. For example, this worked for me:
    xmodmap -e ‘keycode 117 = KP_Enter’