From f87c57a92781a6e13da77eb51d0f0a51b1bb501b Mon Sep 17 00:00:00 2001 From: Lord Egypt Date: Sun, 1 Nov 2026 19:49:20 +0300 Subject: [PATCH] =?UTF-8?q?ThothTerm=20=E2=80=A2=20ThothDock=200.5.3=20(50?= =?UTF-8?q?3):=20snap=20and=20flatpak=20ready=20to=20use,=20volume=20keys?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - ThothDock engine 0.3.1 (631c67f): snap downloads show progress, are bounded by a 60 s stall instead of 10 minutes in total and resume where they stopped; store aliases (gcloud, gsutil, bq); squashfs-tools is installed by snap install itself; Engine Guard keeps the stock snapd out (snapd added to EngineGuard.PROTECTED). - flatpak wrapper: on first use installs flatpak and dbus (dbus is only a Recommends but the wrapper's system bus needs it; 48 packages instead of 205 with recommends) and adds Flathub for the user. It sets FLATPAK_BWRAP when unset, so "sudo flatpak" still sandboxes through ThothDock instead of the stock bwrap. - Volume Down and Volume Up are no longer Ctrl and Fn by default: two presses of Volume Down locked Ctrl (a triangle in the cursor) and every letter became a control character, without the volume changing. Device (SM-A165F, 0.5.2 with the new snap binary and wrapper): squashfs auto-install, core22 download interrupted and resumed, gcloud alias, flatpak first use (52 s) + Flathub, org.freedesktop.appstream.cli installed and run with FLATPAK_BWRAP unset. Unit tests: garden-common 391, garden-debian 38, 0 failures. Co-Authored-By: Claude Opus 5.5 --- garden-common/src/main/assets/linux/flatpak | 35 +++++++++++++++---- .../java/com/thothterm/dock/EngineGuard.java | 2 ++ .../src/main/res/values/defaults.xml | 4 +-- .../util/VolumeKeyDefaultsTest.java | 35 +++++++++++++++++++ garden-common/thothdock/thothdock.properties | 4 +-- garden-debian/build.gradle | 5 +-- .../metadata/android/en-US/changelogs/503.txt | 1 + .../com/thothterm/debian/ProductNameTest.java | 2 +- third_party/thothdock | 2 +- 9 files changed, 75 insertions(+), 15 deletions(-) create mode 100644 garden-common/src/test/java/jackpal/androidterm/util/VolumeKeyDefaultsTest.java create mode 100644 garden-debian/fastlane/metadata/android/en-US/changelogs/503.txt diff --git a/garden-common/src/main/assets/linux/flatpak b/garden-common/src/main/assets/linux/flatpak index 9043ccf..725edcf 100644 --- a/garden-common/src/main/assets/linux/flatpak +++ b/garden-common/src/main/assets/linux/flatpak @@ -1,12 +1,28 @@ #!/bin/sh # Managed by ThothTerm (rewritten on every window; do not edit). -# Debian's flatpak asks the system D-Bus about parental controls before it -# installs an app, and a PRoot guest runs no system bus by itself ("Could not -# connect: No such file or directory"). Start one when none answers, then run -# the real flatpak. Its sandboxes go to ThothDock through $FLATPAK_BWRAP. -if [ ! -x /usr/bin/flatpak ]; then - echo "flatpak is not installed. Install it with: sudo apt install flatpak" >&2 - exit 127 +# Runs Debian's own flatpak with what a PRoot guest lacks: +# * Its sandboxes go to ThothDock through $FLATPAK_BWRAP. sudo clears the +# environment, so it is set here as well: "sudo flatpak" would otherwise +# fall back to the stock bwrap, which needs user namespaces Android denies. +# * Debian's flatpak asks the system D-Bus about parental controls before it +# installs an app, and a PRoot guest runs no system bus by itself ("Could +# not connect: No such file or directory"). Start one when none answers. +# * On first use it installs flatpak and dbus (only Recommended by flatpak, +# but needed for that bus) and adds the Flathub remote. +BWRAP=/usr/libexec/thothdock/bwrap +if [ -z "${FLATPAK_BWRAP-}" ] && [ -x "$BWRAP" ]; then + FLATPAK_BWRAP="$BWRAP" + export FLATPAK_BWRAP +fi +if [ ! -x /usr/bin/flatpak ] || ! command -v dbus-daemon >/dev/null 2>&1; then + echo "Installing flatpak (first use)..." >&2 + if ! sudo sh -c 'export DEBIAN_FRONTEND=noninteractive + apt-get install -y --no-install-recommends flatpak dbus || + { apt-get update && apt-get install -y --no-install-recommends flatpak dbus; }' >&2; then + echo "flatpak could not be installed. Try: sudo apt install flatpak dbus" >&2 + exit 127 + fi + flatpak_first_use=1 fi if ! dbus-send --system --dest=org.freedesktop.DBus --type=method_call --print-reply \ /org/freedesktop/DBus org.freedesktop.DBus.GetId >/dev/null 2>&1; then @@ -14,4 +30,9 @@ if ! dbus-send --system --dest=org.freedesktop.DBus --type=method_call --print-r sudo -n sh -c 'mkdir -p /run/dbus && rm -f /run/dbus/pid /run/dbus/system_bus_socket && dbus-daemon --system --fork' \ >/dev/null 2>&1 || echo "flatpak (ThothTerm): could not start the system D-Bus; app installs may fail" >&2 fi +if [ -n "${flatpak_first_use-}" ]; then + /usr/bin/flatpak remote-add --user --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo >&2 && + echo "Flathub added: flatpak install flathub " >&2 || + echo "Flathub was not added: flatpak remote-add --user flathub https://dl.flathub.org/repo/flathub.flatpakrepo" >&2 +fi exec /usr/bin/flatpak "$@" diff --git a/garden-common/src/main/java/com/thothterm/dock/EngineGuard.java b/garden-common/src/main/java/com/thothterm/dock/EngineGuard.java index eaeabcf..c85665f 100644 --- a/garden-common/src/main/java/com/thothterm/dock/EngineGuard.java +++ b/garden-common/src/main/java/com/thothterm/dock/EngineGuard.java @@ -66,6 +66,8 @@ public final class EngineGuard { static final String[] PROTECTED = { "docker.io", "docker-ce", "docker-engine", "moby-engine", "containerd", "containerd.io", "runc", + // ThothDock provides the snap command; the real snapd cannot run in a PRoot guest. + "snapd", }; static final String GUARD_PACKAGE = "thothdock-engine-guard"; private static final String ASSET_DIR = "thothdock/engine-guard"; diff --git a/garden-common/src/main/res/values/defaults.xml b/garden-common/src/main/res/values/defaults.xml index 05f7f9e..55ebd47 100644 --- a/garden-common/src/main/res/values/defaults.xml +++ b/garden-common/src/main/res/values/defaults.xml @@ -12,8 +12,8 @@ 11 true 2 - 5 - 4 + 7 + 7 0 false /system/bin/sh - diff --git a/garden-common/src/test/java/jackpal/androidterm/util/VolumeKeyDefaultsTest.java b/garden-common/src/test/java/jackpal/androidterm/util/VolumeKeyDefaultsTest.java new file mode 100644 index 0000000..df21304 --- /dev/null +++ b/garden-common/src/test/java/jackpal/androidterm/util/VolumeKeyDefaultsTest.java @@ -0,0 +1,35 @@ +package jackpal.androidterm.util; + +import static org.junit.Assert.assertEquals; + +import java.io.File; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import org.junit.Test; + +/** + * The volume keys must not be Ctrl and Fn by default. Two presses of Volume + * Down used to lock Ctrl -- a triangle in the cursor, and every letter then + * sent as a control character -- without the volume changing, so a user + * turning the volume down found the terminal no longer typed. + */ +public class VolumeKeyDefaultsTest { + private static String defaultOf(String xml, String name) { + Matcher m = Pattern.compile("]*>([^<]*)").matcher(xml); + if (!m.find()) throw new AssertionError(name + " missing"); + return m.group(1); + } + + @Test + public void noKeyIsAModifierByDefault() throws Exception { + File here = new File("").getAbsoluteFile(); + File repo = new File(here, "third_party").isDirectory() ? here : here.getParentFile(); + String xml = new String(Files.readAllBytes( + new File(repo, "garden-common/src/main/res/values/defaults.xml").toPath()), StandardCharsets.UTF_8); + assertEquals(TermSettings.CONTROL_KEY_ID_NONE, Integer.parseInt(defaultOf(xml, "pref_controlkey_default"))); + assertEquals(TermSettings.FN_KEY_ID_NONE, Integer.parseInt(defaultOf(xml, "pref_fnkey_default"))); + } +} diff --git a/garden-common/thothdock/thothdock.properties b/garden-common/thothdock/thothdock.properties index eaca723..346521e 100644 --- a/garden-common/thothdock/thothdock.properties +++ b/garden-common/thothdock/thothdock.properties @@ -1,9 +1,9 @@ # ThothDock pins (see tools/stage-thothdock.sh). Both programs are built from # source at exactly these commits; nothing is downloaded during the build. -# github.com/Lord1Egypt/ThothDock v0.3.0 (submodule third_party/thothdock), Apache-2.0. +# github.com/Lord1Egypt/ThothDock v0.3.1 (submodule third_party/thothdock), Apache-2.0. # The daemon's only dependency, golang.org/x/sys, is vendored in that tree. -thothdockCommit=e4601a3 +thothdockCommit=631c67f # Lowest Go toolchain accepted (GOTOOLCHAIN=local: Go never fetches another). goMinVersion=1.26.0 diff --git a/garden-debian/build.gradle b/garden-debian/build.gradle index 9aaf61b..1189ba3 100644 --- a/garden-debian/build.gradle +++ b/garden-debian/build.gradle @@ -25,14 +25,15 @@ android { vectorDrawables.useSupportLibrary = true + // 0.5.3: ThothDock engine 0.3.1 (snap downloads resume, store aliases, squashfs-tools and flatpak set up on first use, snapd guarded); volume keys are no longer Ctrl/Fn by default. // 0.5.2: swipes reach full-screen TUIs as mouse wheel events (OpenCode), SGR mouse reports. // 0.5.1: /proc/stat and /proc/uptime stand-ins (ps -o lstart, Codex's background server). // 0.5.0: ThothDock engine 0.3.0 (Flatpak sandboxes, snap command, Apps screen), 24-bit terminal colours. // 0.4.2: store listing only (ThothDock icon, current screenshots, store text); same code and engine as 0.4.1. // 0.4.1: ThothDock engine 0.2.1 (System V IPC, hostname, long Unix sockets; PRoot patches 0010-0018). (0.4.0 was 400.) // 0.4.0: ThothTerm (bullet) ThothDock (package com.thothterm.debian), ThothDock engine 0.2.0 (NextGen). (0.3.1 was 301.) - versionCode 502 - versionName '0.5.2' + versionCode 503 + versionName '0.5.3' // Device tests (the pinch gesture and garden-common's shared tests); // run with `am instrument` against the installed app, never diff --git a/garden-debian/fastlane/metadata/android/en-US/changelogs/503.txt b/garden-debian/fastlane/metadata/android/en-US/changelogs/503.txt new file mode 100644 index 0000000..502c2a5 --- /dev/null +++ b/garden-debian/fastlane/metadata/android/en-US/changelogs/503.txt @@ -0,0 +1 @@ +snap: downloads show progress, survive a slow or dropped connection and continue where they stopped; store aliases such as gcloud are set up; squashfs-tools is installed by itself. flatpak installs itself and adds Flathub on first use, and sudo flatpak works. apt install snapd can no longer replace ThothDock's snap. The volume keys no longer act as Ctrl and Fn by default: pressing Volume Down twice used to lock Ctrl and stop typing. diff --git a/garden-debian/src/test/java/com/thothterm/debian/ProductNameTest.java b/garden-debian/src/test/java/com/thothterm/debian/ProductNameTest.java index ab2df2f..adc8255 100644 --- a/garden-debian/src/test/java/com/thothterm/debian/ProductNameTest.java +++ b/garden-debian/src/test/java/com/thothterm/debian/ProductNameTest.java @@ -94,7 +94,7 @@ public void storeTextFitsFdroidLimits() throws Exception { assertTrue(read(dir + "title.txt").trim().length() <= 50); assertTrue(read(dir + "short_description.txt").trim().length() <= 80); assertTrue(read(dir + "full_description.txt").length() <= 4000); - for (String code : new String[]{"301", "400", "401", "402", "500", "501", "502"}) { + for (String code : new String[]{"301", "400", "401", "402", "500", "501", "502", "503"}) { assertTrue(code, read(dir + "changelogs/" + code + ".txt").length() <= 500); } } diff --git a/third_party/thothdock b/third_party/thothdock index e4601a3..631c67f 160000 --- a/third_party/thothdock +++ b/third_party/thothdock @@ -1 +1 @@ -Subproject commit e4601a30bfe388ae9d3145fadb6c1ad7d03a6b07 +Subproject commit 631c67f32666034db06c6aeae6089a5773240edc