0

I would like to implement some Greek characters into my keymap in the console (tty). I am using Arch Linux and the directory I am working in is /usr/share/kbd/i386/qwerty/uk.map, although I don't know if this is the right place to deal with the problem.

The expected result should be:

Key pressed: d

Shift (or Caps Lock) pressed + letter: D

Alt Gr + letter: δ

Shift (or Caps Lock) pressed + Alt Gr + letter: ∆

...just like this, but in the console.

Any clues?

  • I don't know if it would work with Arch but this might help askubuntu.com/questions/339772/… – Katu Nov 16 '16 at 11:48
  • It should, but isn't there a way which does not involve init-time execution scripting? – xvlaze Nov 16 '16 at 23:21
2

You should be able to leave the original keymap alone and just do a second loadkeys with some extra explicit changes. For example, you may currently see

$ dumpkeys|grep ' 30'|tr -s ' '
keycode 30 = +a +A Hex_A Control_a Control_a Meta_a Meta_Control_a  

So you want to change two columns of this to the greek alpha character, which is unicode U+03B1 and U+0391. If you do

$ sudo loadkeys - <<\!
      alt keycode 30 = U+03B1
shift alt keycode 30 = U+0391
!

and run dumpkeys again you should see the change:

keycode 30 = +a +A Hex_A Control_a Control_a alpha Alpha Meta_Control_a 

As you can see, my system even knows the unicodes as keysyms alpha and Alpha which I could have used instead. Simply create a file of all the changes you want to make and call loadkeys with that filename to make the modifications.

  • How can I make it persistent after a reboot? Which file does this apply changes to? – xvlaze Nov 17 '16 at 9:02
  • man loadkeys tells you the command changes the kernel keymap, so no files are changed. You need to run the command at every boot. How to do so depends greatly on what distribution you have, and what version of it you have. You will find lots of examples of how to run a command at each boot for your situation. – meuh Nov 17 '16 at 10:06
  • Yep, I was reading the man right now. So isn't there a way to write to the kernel to make the changes permanent? Is a startup script the solution? – xvlaze Nov 17 '16 at 10:10
  • There will already be a startup script somewhere setting up the default keymap. If you can find it you can amend it. But it is more simple to just add your own startup script to make the changes, then it will still work when you update the system, for example. – meuh Nov 17 '16 at 15:53

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.