summaryrefslogtreecommitdiffstats
path: root/data/update-osk-layouts.sh
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 15:07:22 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 15:07:22 +0000
commitf9d480cfe50ca1d7a0f0b5a2b8bb9932962bfbe7 (patch)
treece9e8db2d4e8799780fa72ae8f1953039373e2ee /data/update-osk-layouts.sh
parentInitial commit. (diff)
downloadgnome-shell-upstream.tar.xz
gnome-shell-upstream.zip
Adding upstream version 3.38.6.upstream/3.38.6upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'data/update-osk-layouts.sh')
-rwxr-xr-xdata/update-osk-layouts.sh47
1 files changed, 47 insertions, 0 deletions
diff --git a/data/update-osk-layouts.sh b/data/update-osk-layouts.sh
new file mode 100755
index 0000000..8d78c0e
--- /dev/null
+++ b/data/update-osk-layouts.sh
@@ -0,0 +1,47 @@
+#!/bin/env bash
+
+CLDR_LAYOUTS_TARBALL="http://www.unicode.org/Public/cldr/latest/keyboards.zip"
+
+WORKDIR=".osk-layout-workbench"
+CLDR2JSON="cldr2json/cldr2json.py"
+SRCDIR="$WORKDIR/keyboards/android"
+DESTDIR="osk-layouts"
+GRESOURCE_FILE="gnome-shell-osk-layouts.gresource.xml"
+TMP_GRESOURCE_FILE=".$GRESOURCE_FILE.tmp"
+
+cd `dirname $0`
+
+# Ensure work/dest dirs
+rm -rf $WORKDIR
+mkdir -p $WORKDIR
+mkdir -p "osk-layouts"
+
+# Download stuff on the work dir
+pushd $WORKDIR
+gio copy $CLDR_LAYOUTS_TARBALL .
+unzip keyboards.zip
+popd
+
+# Transform to JSON files
+$CLDR2JSON $SRCDIR $DESTDIR
+
+# Generate new gresources xml file
+cat >$TMP_GRESOURCE_FILE <<EOF
+<?xml version="1.0" encoding="UTF-8"?>
+<gresources>
+ <gresource prefix="/org/gnome/shell/osk-layouts">
+EOF
+
+for f in $DESTDIR/*.json
+do
+ echo " <file>$(basename $f)</file>" >>$TMP_GRESOURCE_FILE
+done
+
+cat >>$TMP_GRESOURCE_FILE <<EOF
+ <file>emoji.json</file>
+ </gresource>
+</gresources>
+EOF
+
+# Rewrite old gresources xml
+mv $TMP_GRESOURCE_FILE $GRESOURCE_FILE