Add Rocknix Touchscreen keyboard to touchscreen devices

This commit is contained in:
rocknix
2025-07-25 22:03:40 +00:00
parent 755a2da32e
commit 77d6c44b34
13 changed files with 1044 additions and 2 deletions

View File

@@ -0,0 +1,22 @@
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (C) 2025-present ROCKNIX (https://github.com/ROCKNIX)
PKG_NAME="rocknix-touchscreen-keyboard"
PKG_VERSION="v0.17"
PKG_LICENSE="GPLv3"
PKG_SITE="https://github.com/jjsullivan5196/wvkbd"
PKG_URL="${PKG_SITE}/archive/${PKG_VERSION}.tar.gz"
PKG_LONGDESC="wvkbd - On-screen keyboard for wlroots that sucks less"
PKG_DEPENDS_TARGET="toolchain wayland sway pango libxkbcommon cairo"
PKG_TOOLCHAIN="make"
makeinstall_target() {
mkdir -p ${INSTALL}/usr/bin
cp -rf ${PKG_BUILD}/wvkbd-mobintl ${INSTALL}/usr/bin
cp -rf ${PKG_DIR}/sources/* ${INSTALL}/usr/bin
chmod 0755 ${INSTALL}/usr/bin/*
}
post_install() {
enable_service touchkeyboard.service
}

View File

@@ -0,0 +1,46 @@
diff --git a/Makefile b/Makefile
index db17991..bbdc67e 100644
--- a/Makefile
+++ b/Makefile
@@ -3,7 +3,6 @@ include config.mk
NAME=wvkbd
BIN=${NAME}-${LAYOUT}
SRC=.
-MAN1 = ${NAME}.1
PKGS = wayland-client xkbcommon pangocairo
@@ -21,12 +20,9 @@ HDRS = $(WAYLAND_HEADERS:.xml=-client-protocol.h)
WAYLAND_SRC = $(HDRS:.h=.c)
SOURCES = $(WVKBD_SOURCES) $(WAYLAND_SRC)
-SCDOC=scdoc
-DOCS = wvkbd.1
-
OBJECTS = $(SOURCES:.c=.o)
-all: ${BIN} ${DOCS}
+all: ${BIN}
config.h:
cp config.def.h config.h
@@ -43,18 +39,12 @@ wvkbd-${LAYOUT}: config.h $(OBJECTS) layout.${LAYOUT}.h
$(CC) -o wvkbd-${LAYOUT} $(OBJECTS) $(LDFLAGS)
clean:
- rm -f $(OBJECTS) $(HDRS) $(WAYLAND_SRC) ${BIN} ${DOCS}
+ rm -f $(OBJECTS) $(HDRS) $(WAYLAND_SRC) ${BIN}
format:
clang-format -i $(WVKBD_SOURCES) $(WVKBD_HEADERS)
-%: %.scd
- $(SCDOC) < $< > $@
-
install: all
mkdir -p ${DESTDIR}${PREFIX}/bin
cp -f ${NAME}-${LAYOUT} ${DESTDIR}${PREFIX}/bin
chmod 755 ${DESTDIR}${PREFIX}/bin/${NAME}-${LAYOUT}
- mkdir -p "${DESTDIR}${MANPREFIX}/man1"
- sed "s/VERSION/${VERSION}/g" < ${MAN1} > ${DESTDIR}${MANPREFIX}/man1/${MAN1}
- chmod 644 ${DESTDIR}${MANPREFIX}/man1/${MAN1}

View File

@@ -0,0 +1,12 @@
#!/bin/bash
# SPDX-License-Identifier: GPL-2.0
# Copyright (C) 2025-present ROCKNIX (https://github.com/ROCKNIX)
. /etc/profile
PID="$(pidof wvkbd-mobintl)"
if [ "$PID" != "" ]; then
killall wvkbd-mobintl
else
/usr/bin/wvkbd-mobintl -L 350 -fg 6b6b75 -fg-sp 6b6b75 -bg 1d1d1d --text ffffff --text-sp ffffff -fn 50 -l simple --hidden
fi

View File

@@ -0,0 +1,14 @@
[Unit]
Description=touchscreen keyboard service
After=input.service
Before=rocknix.target
StartLimitIntervalSec=0
[Service]
Environment=HOME=/storage
ExecStart=/usr/bin/rocknix-touchscreen-keyboard
Restart=always
RestartSec=1
[Install]
WantedBy=multi-user.target

View File

@@ -0,0 +1,12 @@
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0
# Copyright (C) 2025 ROCKNIX (https://github.com/ROCKNIX)
# Minimal OS variable loading for performance
. /etc/profile.d/001-functions
TOUCHSCREEN_EVENTS=$(get_setting key.touchscreen.events)
if [ -z "${TOUCHSCREEN_EVENTS}" ]
then
set_setting key.touchscreen.events 1
fi

View File

@@ -0,0 +1,12 @@
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0
# Copyright (C) 2025 ROCKNIX (https://github.com/ROCKNIX)
# Minimal OS variable loading for performance
. /etc/profile.d/001-functions
TOUCHSCREEN_EVENTS=$(get_setting key.touchscreen.events)
if [ -z "${TOUCHSCREEN_EVENTS}" ]
then
set_setting key.touchscreen.events 1
fi

View File

@@ -0,0 +1,12 @@
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0
# Copyright (C) 2025 ROCKNIX (https://github.com/ROCKNIX)
# Minimal OS variable loading for performance
. /etc/profile.d/001-functions
TOUCHSCREEN_EVENTS=$(get_setting key.touchscreen.events)
if [ -z "${TOUCHSCREEN_EVENTS}" ]
then
set_setting key.touchscreen.events 1
fi

View File

@@ -0,0 +1,12 @@
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0
# Copyright (C) 2025 ROCKNIX (https://github.com/ROCKNIX)
# Minimal OS variable loading for performance
. /etc/profile.d/001-functions
TOUCHSCREEN_EVENTS=$(get_setting key.touchscreen.events)
if [ -z "${TOUCHSCREEN_EVENTS}" ]
then
set_setting key.touchscreen.events 1
fi

View File

@@ -0,0 +1,12 @@
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0
# Copyright (C) 2025 ROCKNIX (https://github.com/ROCKNIX)
# Minimal OS variable loading for performance
. /etc/profile.d/001-functions
TOUCHSCREEN_EVENTS=$(get_setting key.touchscreen.events)
if [ -z "${TOUCHSCREEN_EVENTS}" ]
then
set_setting key.touchscreen.events 1
fi

View File

@@ -0,0 +1,12 @@
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0
# Copyright (C) 2025 ROCKNIX (https://github.com/ROCKNIX)
# Minimal OS variable loading for performance
. /etc/profile.d/001-functions
TOUCHSCREEN_EVENTS=$(get_setting key.touchscreen.events)
if [ -z "${TOUCHSCREEN_EVENTS}" ]
then
set_setting key.touchscreen.events 1
fi

View File

@@ -67,6 +67,15 @@ FUNCTION_HOTKEY_A_EVENT='*('${BTN_HOTKEY_A_MODIFIER}'), value *'
FUNCTION_HOTKEY_B_EVENT='*('${BTN_HOTKEY_B_MODIFIER}'), value *'
FUNCTION_HOTKEY_C_EVENT='*('${BTN_HOTKEY_C_MODIFIER}'), value *'
FUNCTION_HOTKEY_TOUCH_EVENT="*(BTN_TOUCH), value 1*"
TOUCHSCREEN_EVENTS=$(get_setting key.touchscreen.events)
if [ -z "${TOUCHSCREEN_EVENTS}" ] || [ "${TOUCHSCREEN_EVENTS}" = "0" ]; then
TOUCHSCREEN_EVENTS=false
else
TOUCHSCREEN_EVENTS=true
fi
### Define static values for dpad buttons and as a hat.
FUNCTION_HOTKEY_DPAD_UP_EVENT="*(BTN_DPAD_UP), value 1*"
FUNCTION_HOTKEY_DPAD_DOWN_EVENT="*(BTN_DPAD_DOWN), value 1*"
@@ -172,19 +181,23 @@ get_devices() {
local KJDEVS=false
local FOUNDKEYS=false
local FOUNDJOY=false
local FOUNDTOUCH=false
local RETRY=5
while [ ${KJDEVS} = false ]; do
for DEV in /dev/input/ev*
do
unset SUPPORTS
SUPPORTS=$(udevadm info ${DEV} | awk '/ID_INPUT_KEY=|ID_INPUT_JOYSTICK=/ {print $2}')
SUPPORTS=$(udevadm info ${DEV} | awk '/ID_INPUT_KEY=|ID_INPUT_JOYSTICK=|ID_INPUT_TOUCHSCREEN=/ {print $2}')
if [ -n "${SUPPORTS}" ]; then
DEVICE=$(udevadm info ${DEV} | awk 'BEGIN {FS="="} /DEVNAME=/ {print $2}')
INPUT_DEVICES+=("${DEVICE}")
if [[ "${SUPPORTS}" =~ ID_INPUT_KEY ]]; then
${DEBUG} && log $0 "Found Keyboard: ${DEVICE}"
FOUNDKEYS=true
elif [[ "${SUPPORTS}" =~ ID_INPUT_TOUCHSCREEN ]]; then
${DEBUG} && log $0 "Found Touchscreen: ${DEVICE}"
FOUNDTOUCH=true
elif [[ "${SUPPORTS}" =~ ID_INPUT_JOYSTICK ]]; then
${DEBUG} && log $0 "Found Joystick: ${DEVICE}"
FOUNDJOY=true
@@ -348,5 +361,11 @@ set +e
brightness down
fi
;;
(${FUNCTION_HOTKEY_TOUCH_EVENT})
if [ "${FN_A_PRESSED}" = true ] && [ "${TOUCHSCREEN_EVENTS}" = true ]; then
${DEBUG} && log $0 "${FUNCTION_HOTKEY_TOUCH_EVENT}: Toggle Touchscreen Keyboard"
kill -34 $(pidof wvkbd-mobintl)
fi
;;
esac
done

View File

@@ -7,7 +7,7 @@ PKG_SITE="https://rocknix.org"
PKG_SECTION="virtual"
PKG_LONGDESC="Game support software metapackage."
PKG_GAMESUPPORT="sixaxis rocknix-hotkey jstest-sdl gamecontrollerdb sdljoytest sdltouchtest control-gen"
PKG_GAMESUPPORT="sixaxis rocknix-hotkey jstest-sdl gamecontrollerdb sdljoytest sdltouchtest control-gen rocknix-touchscreen-keyboard"
PKG_DEPENDS_TARGET="${PKG_GAMESUPPORT}"