Raspberry Pi – Installing On Screen Keyboard

Date:  Jun 8, 2016

I bought the official 7″ Touch Screen display for my Raspberry Pi 3.

Instead of using a USB dongle to connect to a keyboard, it is very useful to install a on screen keyboard.  Whenever you need it, you will want to use it, very handy.

The popular on screen keyboard program is called matchbox-keyboard

IMG_8887.jpg

Installation

$ sudo apt-get update

$ sudo apt-get upgrade -y

$ sudo apt-get install matchbox-keyboard -y

$ sudo reboot

After reboot, the installation program failed to install it onto your “Accessories” due to you might have a newer Raspbian, and the apt-get install matchbox-keyboard works in the older Raspbian LXDE.

IMG_8877.jpg

Not to worry, follow the following steps will put that into the Start Menu, and on the task bar too.

Creating a matchbox-keyboard Script

$ sudo vi matchbox-keyboard.sh         (or you can use nano instead of vi)

IMG_8882.jpg

key in the following …

#!/bin/bash
# kenliew - this is a simple script to run the virtual on screen keyboard

PID=`pidof matchbox-keyboard`
if [ ! -e $PID ]; then
  killall matchbox-keyboard
else
 matchbox-keyboard&
fi

IMG_8883.jpg

Make the script executable.

$ sudo chmod +x /usr/bin/matchbox-keyboard.sh

Screen Shot 2016-06-08 at 9.08.45 AM.png

Add it to the Start Menu

$ cd /usr/share/applications

$ vi matchbox-keyboard.desktop

Screen Shot 2016-06-08 at 9.10.49 AM.png

Edit the file, by adding this into the matchbox-keyboard.desktop file

[Desktop Entry]
Name=Matchbox Keyboard
Comment=Run Matchbox Keyboard
Exec=matchbox-keyboard.sh
Type=Application
Icon=matchbox-keyboard.png
Categories=Panel;Utility;MB
X-MB-INPUT-MECHANISM=True

IMG_8891.jpg

 

Add it to the Task Bar

All LXDE configurations are stored under .config directory under your “pi” acct.  Edit the file /home/pi/.config./lxpanel/LXDE-pi/panels/panel

$ cd .config

$ cd lxpanel

$ cd LXDE-pi

$ cd panels

$ vi panel

IMG_8878.jpg

I think let’s place the keyboard icon in between the Bluetooth icon and the Tray.

IMG_8880.jpg

Place the following codes in between them.  Add a space behind too.

Plugin {
    type = launchbar
    Config {
        Button {
            id=matchbox-keyboard.desktop
        }
    }

Plugin {
    type = space
    Config {
        Size=2
    }
}

IMG_8881.jpg

$ /usr/bin/lxpanelctl restart

And you can see that small little keyboard there.

IMG_8927.jpg

And here comes the keyboard.

IMG_8928.jpg

And the main menu is working too.

The reason why we created the .sh file is to kill existing process before launching a new matchbox-keyboard process.  That will prevent us from running multiple copies of the process.

IMG_8929.jpg

 

 

One comment

  1. I bought a 7 inch display for use with my RPi3 and installed this “Matchbox-Keyboard. I had all my desktop icons disappear after running it. In addition, my CPU speed climbed to 25% and would never reduce. I had to remove the keyboard software. I wonder what you did to get it to run correctly?
    Todd

Leave a Reply