树莓派使用虚拟键盘

1

1、安装必需文件

sudo apt-get install libfakekey-dev libpng-dev -y

2、安装编译虚拟键盘ato, sans-serif;font-size:16px;font-weight:700;vertical-align:baseline;color:#2B2B2B;background-color:#FFFFFF;">matchbox-keyboard
ato, sans-serif;font-size:16px;font-weight:700;vertical-align:baseline;color:#2B2B2B;background-color:#FFFFFF;">
git clone https://github.com/mwilliams03/matchbox-keyboard.git
cd matchbox-keyboard
./autogen.sh
make
sudo make install
3、安装虚拟键盘所用的共享库

ato, sans-serif;font-size:16px;font-weight:700;vertical-align:baseline;color:#2B2B2B;background-color:#FFFFFF;">
sudo apt-get install libmatchbox1 -y
4、创建虚拟键盘启动脚本

sudo nano /usr/bin/toggle-matchbox-keyboard.sh

粘贴以下内容并按ctrl+x和y保存退出

#!/bin/bash
#This script toggle the virtual keyboard

PID=`pidof matchbox-keyboard`
if [ ! -e $PID ]; then
  killall matchbox-keyboard
else
 matchbox-keyboard&
fi
给以上脚本增加可执行权限
sudo chmod +x /usr/bin/toggle-matchbox-keyboard.sh

   5、把以上脚本增加到开始菜单

sudo nano /usr/share/applications/toggle-matchbox-keyboard.desktop
[Desktop Entry]
Name=Toggle Matchbox Keyboard
Comment=Toggle Matchbox Keyboard
Exec=toggle-matchbox-keyboard.sh
Type=Application
Icon=matchbox-keyboard.png
Categorices=Panel;Utility;MB
X-MB-INPUT-MECHANSIM=Ture

go on…

nano ~/.config/lxpanel/LXDE-pi/panels/panel

找到以下内容

Plugin {
    type = launchbar
    Config {
        Button {
            id=lxde-screenlock.desktop
        }
        Button {
            id=lxde-logout.desktop
        }
    }

改为以下内容

Plugin {
    type = launchbar
    Config {
        Button {
            id=toggle-matchbox-keyboard.desktop
        }
        Button {
            id=lxde-screenlock.desktop
        }
        Button {
            id=lxde-logout.desktop
        }
    }


可以用加参数在启动时改变虚拟键盘大小

matchbox-keyboard -s 50
2

通过SSH在桌面上显示可以用这个命令:

DISPLAY=:0.0 matchbox-keyboard

显示小键盘用以下命令参数

matchbox-keyboard -s 50 extended
3
原文地址:https://www.cnblogs.com/chjbbs/p/5515151.html