Skip to content

Commit

Permalink
Merge pull request #44 from project-81/dev/pi5
Browse files Browse the repository at this point in the history
Dev/pi5
  • Loading branch information
vkottler authored May 20, 2024
2 parents 57a6a36 + 27f10bc commit 21ccdef
Show file tree
Hide file tree
Showing 5 changed files with 386 additions and 1 deletion.
47 changes: 47 additions & 0 deletions data/bookworm-osk/bookworm-on-screen-keyboard.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
HOW-TO: install an on-screen Keyboard to Bookworm

Introduction: The latest PI OS (Bookworm) uses Wayland. The distribution shipped (Oct 2023) without an on-screen keyboard. Most on-screen keyboards (like matchbox-keyboard) do not work under wayland. This process will install both matchbox-keyboard (for X11 use) and wvkbd (for use under wayland).

Installation:
1) set the localisations in the "preferences - Raspberry pi configuration - localisation".
- this may not be necessary in the future, but the current pi-imager (1.7.5) does not set them properly.
- the bug is reported to pi-imager, i assume it will be fixed soon

2) copy the files in. In this example, i copied then to /home/pi. The below instructions assume this is the source location for copying files to other locations. YMMV
files to be copied in: (files in the zip archive)
- keyboard.xml
- wvkbd.desktop
- toggle-wvkbd.sh

2a) make sure "toggle-wvkbd.sh" is set to executable (right-click - properties - permissions -execute by anybody)

3) install matchbox-keyboard:
- with "sudo apt install matchbox-keyboard" in a terminal

3a) replace the default (terrible) matchbox keyboard ..copy the new xml file in. (use a terminal)
- "sudo cp ./keyboard.xml /usr/share/matchbox-keyboard/keyboard.xml"
- the above replaces the default matchbox-keyboard with a new keyboard layout. (in case you ever switch back to X environment.)


4) Install wvkbd
- "sudo apt install wvkbd"
- note: this creates "wvkbd-mobintl" executable in /usr/bin
5) copy the scripts to toggle keyboard and the desktop file in to /usr/bin:
- "sudo cp ./toggle-wvkbd.sh /usr/bin/toggle-wvkbd.sh"
- "sudo cp ./wvkbd.desktop /usr/bin/wvkbd.desktop"

6) Add to the launcher menu
- note: this adds a new icon to the (left) launcher menu, as i could not figure out how to add it to the panel applets on the right side
- open file manager
- enable "hidden files" in the menu (view - show hidden)
- open folder ".config"
- EDIT the file "wf-panel-pi.ini" as follows:
- under "launcher_000003=lxterminal.desktop" ADD a NEW line:
"launcher_000004=/usr/bin/wvkbd.desktop"
- Save the file
- a new icon should appear to toggle the on-screen keyboard.

final note: my "toggle-wvkbd.sh" script has set the colors and size to my liking. you can edit this bash script to set whatever options you prefer. Also, when everything is working you may delete the files from /home/pi where you copied them in (step 2 above)

@TerribleTed Oct 2023

302 changes: 302 additions & 0 deletions data/bookworm-osk/keyboard.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,302 @@
<?xml version="1.0" encoding="UTF-8"?>

<keyboard>

<options>
<!-- not yet implemented -->
</options>


<layout id="default keyboard">


<row>

<key fill="true">
<default display="Esc" action="escape" />
</key>
<key>
<default display="`" />
<shifted display="~" />
</key>
<key>
<default display="1" />
<shifted display="!" />
</key>
<key>
<default display="2" />
<shifted display='@' />
<mod1 display="½" />
</key>
<key>
<default display="3" />
<shifted display="#" />
<mod1 display="¾" />
</key>
<key>
<default display="4" />
<shifted display="$" />
</key>
<key>
<default display="5" />
<shifted display="%" />
</key>
<key>
<default display="6" />
<shifted display="^" />
</key>
<key>
<default display="7" />
<shifted display="&amp;" />
</key>
<key>
<default display="8" />
<shifted display="*" />
</key>
<key>
<default display="9" />
<shifted display="(" />
</key>
<key>
<default display="0" />
<shifted display=")" />
</key>
<key>
<default display="-" />
<shifted display="_" />
</key>
<key>
<default display="=" />
<shifted display="+" />
</key>

<key fill="true">
<default display="Bksp" action="backspace"/>
</key>


</row>
<row>


<key fill="true">
<default display="Tab" action="tab"/>
</key>
<key obey-caps='true'>
<default display="q" />
<shifted display="Q" />
</key>
<key obey-caps='true'>
<default display="w" />
<shifted display="W" />
</key>
<key obey-caps='true'>
<default display="e" />
<shifted display="E" />
</key>
<key obey-caps='true'>
<default display="r" />
<shifted display="R" />
</key>
<key obey-caps='true'>
<default display="t" />
<shifted display="T" />
</key>
<key obey-caps='true'>
<default display="y" />
<shifted display="Y" />
</key>
<key obey-caps='true'>
<default display="u" />
<shifted display="U" />
</key>
<key obey-caps='true'>
<default display="i" />
<shifted display="I" />
</key>
<key obey-caps='true'>
<default display="o" />
<shifted display="O" />
</key>
<key obey-caps='true'>
<default display="p" />
<shifted display="P" />
</key>
<key>
<default display="{" />
<shifted display="[" />
</key>
<key>
<default display="}" />
<shifted display="]" />
</key>
<key fill="true">
<default display="\" />
<shifted display="|" />
</key>

</row>
<row>


<key fill="true">
<default display="Caps" action="modifier:caps"/>
</key>
<key obey-caps='true'>
<default display="a" />
<shifted display="A" />
</key>
<key obey-caps='true'>
<default display="s" />
<shifted display="S" />
</key>
<key obey-caps='true'>
<default display="d" />
<shifted display="D" />
</key>
<key obey-caps='true'>
<default display="f" />
<shifted display="F" />
</key>
<key obey-caps='true'>
<default display="g" />
<shifted display="G" />
</key>
<key obey-caps='true'>
<default display="h" />
<shifted display="H" />
</key>
<key obey-caps='true'>
<default display="j" />
<shifted display="J" />
</key>
<key obey-caps='true'>
<default display="k" />
<shifted display="K" />
</key>
<key obey-caps='true'>
<default display="l" />
<shifted display="L" />
</key>
<key>
<default display=";" />
<shifted display=":" />
</key>
<key>
<default display="'" />
<shifted display="&#34;" />
</key>
<key fill="true">
<default display="Enter" action="return"/>
</key>



</row>
<row>


<key fill="true">
<default display="Shift" action="modifier:shift"/>
</key>

<key obey-caps='true'>
<default display="z" />
<shifted display="Z" />
</key>

<key obey-caps='true'>
<default display="x" />
<shifted display="X" />
</key>

<key obey-caps='true'>
<default display="c" />
<shifted display="C" />
</key>

<key obey-caps='true'>
<default display="v" />
<shifted display="V" />
</key>

<key obey-caps='true'>
<default display="b" />
<shifted display="B" />
</key>

<key obey-caps='true'>
<default display="n" />
<shifted display="N" />
</key>

<key obey-caps='true'>
<default display="m" />
<shifted display="M" />
</key>

<key>
<default display="," />
<shifted display="&lt;" />
</key>
<key>
<default display="." />
<shifted display="&gt;" />
</key>
<key>
<default display="/" />
<shifted display="?" />
</key>


<key fill="true">
<default display="Shift" action="modifier:shift"/>
</key>


</row>
<row>

<!--
<key>
<default display="Func" action="modifier:mod1"/>
</key>
-->

<key fill="true">
<default display="Ctrl" action="modifier:ctrl"/>
</key>

<key>
<default display="Alt" action="modifier:alt"/>
</key>


<key width="12000">
<default display=" " action="space" />
</key>

<key>
<default display="@" />
<shifted display="'" />
</key>

<key>
<default display="" action="up" />
</key>
<key>
<default display="" action="down" />
</key>
<key>
<default display="" action="left" />
</key>
<key>
<default display="" action="right" />
</key>


</row>

</layout>

</keyboard>
21 changes: 21 additions & 0 deletions data/bookworm-osk/toggle-wvkbd.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash
#This script toggle the virtual keyboard
#
# this file is in /usr/bin/toggle-wvkbd.sh
#
PID="$(pidof wvkbd-mobintl)"
if [ "$PID" != "" ]; then
killall wvkbd-mobintl
else
wvkbd-mobintl -L 300 -fg ffffff -fg-sp ffffff --text 000000 --text-sp 000000 -fn 40
# use wvkbd-mobintl --help for options
# my options:
# -L 300 = landscape, 300 pixels tall
# -fg ffffff = foreground color white
# -fg-sp ffffff = special keys foreground white
# -text 000000 = text color black
# -text-sp 000000 = special keys text color black
# -fn 40 = font size 40


fi
9 changes: 9 additions & 0 deletions data/bookworm-osk/wvkbd.desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[Desktop Entry]
Name=Toggle wvkbd Keyboard
Comment=Toggle wvkbd Keyboard
Exec=/usr/bin/toggle-wvkbd.sh
Type=Application
Icon=matchbox-keyboard.png
Categories=Panel;Utility;MB
X-MB-INPUT-MECHANISM=True
Name[en_US]=Toggle wvkbd
8 changes: 7 additions & 1 deletion scripts/sh/install_raspberrypi.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,10 @@ for repo in "${REPOS[@]}"; do
clone_third_party_github raspberrypi "$repo"
done

PACKAGES+=(i2c-tools)
# pick one of the keyboards
PACKAGES+=(i2c-tools wvkbd)

# https://forums.raspberrypi.com/viewtopic.php?t=358654
# in file .config/wf-panel-pi.ini ADD the following:
# autohide=true
# autohide_duration=500

0 comments on commit 21ccdef

Please sign in to comment.