Tagged: keyboard

Script to change keyboard layout on Raspberry Pi

To make it easier to change keyboard layout on a raspberry pi I wrote a small shell script. Be warned, this is one of my first scripts. So it is not optimal, and no guarantees. Use at your own risk.

echo "--------------------------------"
echo "Script to change keyboard layout"
echo "--------------------------------"
echo "Which layout should be used? tr=turkish, se=swedish, gb=english etc"
read layout

sudo sed -i 's|XKBLAYOUT=....|XKBLAYOUT="'$layout'"|g' /etc/default/keyboard

echo "Changed to"
grep "XKBLAYOUT" /etc/default/keyboard | sed 's/XKBLAYOUT=\(....\)/\1/g'
sleep 1
sudo reboot
exit 0

Save the code to a file change_keyboard.sh (or downoad from here). Then add execute permission on that file with the command chmod 755 change_keyboard.sh Then you can run the file with ./change_keyboard.sh

Look in this list to find the 2 character code for the country layout you want to use.

Raspbian keyboard shortcut for window management

Raspberry Pi tip of the day: If you want to maximize your window, but do not have a mouse to click the icon, you can press alt+spacebar to open the menu in the windowbar. Similarly, press alt+[the letter that is underlined] to open one of the the menu’s in the menubar.

Raspberry pi on-screen keyboard

Because I don’t have any usb keyboard at home, other than my big and bulky laptop stand, it is a bit of a challenge to type on a Raspberry Pi. I’ve even went as far as copying letters one by one with a mouse to type something.

But now that is solved thanks to this forum post where JeremyF and Paenny explain how to get an on-screen keyboard.

The summary:

  • type: sudo apt-get install matchbox-keyboard
  • type ‘y’ say yes to installing
  • create a new file on the Desktop called ‘keyboard.sh’:
  • Then open a terminal and write:
    cd Desktop
    chmod +x keyboard.sh
  • Now you can double click that file and execute it to start a big on-screen keyboard 🙂

PS: If you start the keyboard from a terminal, and then use that keyboard to type ctrl-c in that terminal your Raspberry will go nuts.