From 40d4a9b1315e41b57a42727c5f4310cf7139ef17 Mon Sep 17 00:00:00 2001 From: Yi Fan Yu Date: Thu, 8 Apr 2021 15:40:49 -0400 Subject: [PATCH] chromium: Add chrome-virtual-keyboard recipe chrome-virtual-keyboard is an extension to chromium that has a javascript on-screen keyboard that allow users to use chromium without a physical keyboard. According to chrome webstore, there are over 700K users. limitations: * upstream hasn't maintained this extension for a long time * not all textbox will work, notably iframes How to use: Enable through chromium PACKAGECONFIG vkeyboard-extension. leveraging the chromium flag: --extension-load="" to load a local unpacked extension. Signed-off-by: Yi Fan Yu --- .../chromium-extension-package.bbclass | 5 ++++ .../chrome-virtual-keyboard_git.bb | 28 +++++++++++++++++++ .../recipes-browser/chromium/chromium-gn.inc | 15 ++++++++-- 3 files changed, 45 insertions(+), 3 deletions(-) create mode 100644 meta-chromium/classes/chromium-extension-package.bbclass create mode 100644 meta-chromium/recipes-browser/chromium-extensions/chrome-virtual-keyboard_git.bb diff --git a/meta-chromium/classes/chromium-extension-package.bbclass b/meta-chromium/classes/chromium-extension-package.bbclass new file mode 100644 index 000000000..96bdc044a --- /dev/null +++ b/meta-chromium/classes/chromium-extension-package.bbclass @@ -0,0 +1,5 @@ +# class for defining extension dir for chromium + +CHROMIUM_EXTENSION_DIR = "${datadir}/chromium-extension" + +VIRTUAL_KEYBOARD_DIR = "${CHROMIUM_EXTENSION_DIR}/chrome-virtual-keyboard" diff --git a/meta-chromium/recipes-browser/chromium-extensions/chrome-virtual-keyboard_git.bb b/meta-chromium/recipes-browser/chromium-extensions/chrome-virtual-keyboard_git.bb new file mode 100644 index 000000000..02e5effc3 --- /dev/null +++ b/meta-chromium/recipes-browser/chromium-extensions/chrome-virtual-keyboard_git.bb @@ -0,0 +1,28 @@ +SUMMARY = "Chromium Virtual Keyboard" +DESCRIPTION = "Virtual Keyboard Extension for Chromium/Chrome" +HOMEPAGE = "https://apps.xontab.com/VirtualKeyboard" +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://LICENSE;md5=a8366463bacd4f2ec5edd419e8a113ff" + +SRC_URI = " \ + git://github.com/xontab/${BPN}.git \ +" +SRCREV = "e2b9adf4885cc4ed600cd9bccb77e0df8ff549aa" +S = "${WORKDIR}/git" +PV = "1.11.3+git${SRCPV}" + +inherit allarch chromium-extension-package + +do_compile() { + : +} +do_install() { + install -d ${D}${CHROMIUM_EXTENSION_DIR}/ + cp -r ${S} ${D}${CHROMIUM_EXTENSION_DIR}/${BPN} + + # remove unecessary artifacts + rm -f ${D}${CHROMIUM_EXTENSION_DIR}/${BPN}/_config.yml + rm -rf ${D}${CHROMIUM_EXTENSION_DIR}/${BPN}/.git/ +} + +FILES_${PN} += "${CHROMIUM_EXTENSION_DIR}/${BPN}" diff --git a/meta-chromium/recipes-browser/chromium/chromium-gn.inc b/meta-chromium/recipes-browser/chromium/chromium-gn.inc index 775a3605d..674629eaf 100644 --- a/meta-chromium/recipes-browser/chromium/chromium-gn.inc +++ b/meta-chromium/recipes-browser/chromium/chromium-gn.inc @@ -2,7 +2,7 @@ require chromium.inc require chromium-unbundle.inc require gn-utils.inc -inherit features_check gtk-icon-cache qemu +inherit features_check gtk-icon-cache qemu chromium-extension-package # The actual directory name in out/ is irrelevant for GN. OUTPUT_DIR = "out/Release" @@ -116,7 +116,6 @@ PACKAGECONFIG[proprietary-codecs] = ' \ ffmpeg_branding="Chrome" proprietary_codecs=true, \ ffmpeg_branding="Chromium" proprietary_codecs=false \ ' - # Disable VA-API by default. It is compile time enabled since M88, but it's not # desired to make all the users of the Chromium meta-browser recipe depend on # libva without a real need. Both X11 (non-Ozone) and Wayland (Ozone) can use it, @@ -124,6 +123,9 @@ PACKAGECONFIG[proprietary-codecs] = ' \ # that not all the hardware configs might be supported. PACKAGECONFIG[use-vaapi] = "use_vaapi=true,use_vaapi=false,libva" +# chrome/chromium extension for virtual keyboard +PACKAGECONFIG[vkeyboard-extension]= ",,,chrome-virtual-keyboard" + # Base GN arguments, mostly related to features we want to enable or disable. GN_ARGS = " \ ${PACKAGECONFIG_CONFARGS} \ @@ -309,10 +311,17 @@ GN_ARGS_append_armv6 += 'arm_use_neon=false' # https://github.com/gperftools/gperftools/issues/693 GN_ARGS_append_libc-musl = ' use_allocator_shim=false' + +# Add chromium extensions here +CHROMIUM_EXTENSIONS = " \ + ${@bb.utils.contains('PACKAGECONFIG', 'vkeyboard-extension', '${VIRTUAL_KEYBOARD_DIR}', '', d)} \ +" + CHROMIUM_EXTRA_ARGS ?= " \ ${@bb.utils.contains('PACKAGECONFIG', 'use-egl', '--use-gl=egl', '', d)} \ ${@bb.utils.contains('PACKAGECONFIG', 'impl-side-painting', '--enable-gpu-rasterization --enable-impl-side-painting', '', d)} \ ${@bb.utils.contains('PACKAGECONFIG', 'kiosk-mode', '--kiosk --no-first-run --incognito', '', d)} \ + --load-extension='${@",".join(d.getVar('CHROMIUM_EXTENSIONS').split())}' \ " # V8's JIT infrastructure requires binaries such as mksnapshot and @@ -429,7 +438,7 @@ do_install() { # Add extra command line arguments to the chromium-wrapper script by # modifying the dummy "CHROME_EXTRA_ARGS" line - sed -i "s/^CHROME_EXTRA_ARGS=\"\"/CHROME_EXTRA_ARGS=\"${CHROMIUM_EXTRA_ARGS}\"/" ${D}${libdir}/chromium/chromium-wrapper + sed -i "s#^CHROME_EXTRA_ARGS=\"\"#CHROME_EXTRA_ARGS=\"${CHROMIUM_EXTRA_ARGS}\"#" ${D}${libdir}/chromium/chromium-wrapper # This is ANGLE, not to be confused with the similarly named files under swiftshader/ if [ -e libEGL.so ]; then