Debloat any Android or Google TV over Wi-Fi and get an Apple TV-style home.
Python adbadblockandroid-tvandroid-tv-launcherapple-tvbloatware-removalclaude-codedebloatfire-tvgoogle-tvlauncherprivacysmart-tvsony-braviatclvibe-codingxiaomi
theme scripts: keep the accessibility helpers enabled across the restart
Ivan Manolov984b9c8dc3b8
diff --git a/tools/theme.ps1 b/tools/theme.ps1index e04026a3e..8001a0bfe 100644--- a/tools/theme.ps1+++ b/tools/theme.ps1@@ -19,9 +19,12 @@ $py = 'venv\Scripts\python.exe'if (-not (Test-Path $py)) { throw 'run: python -m venv tools\venv; tools\venv\Scripts\python.exe -m pip install -r tools\requirements.txt' }$pkg = 'com.gathin.tvhome'$dir = "/sdcard/Android/data/$pkg/files"+# Restart Home so it rereads the theme. Android drops a force-stopped app's accessibility services from the+# enabled list, which would switch off InputKeyService/HomeKeyService, so put the list back if it had ours.+$restart = "a=`$(settings get secure enabled_accessibility_services); am force-stop $pkg; case `"`$a`" in *$pkg*) settings put secure enabled_accessibility_services `"`$a`" ;; esac; am start -n $pkg/.MainActivity >/dev/null"if ($Reset) {- & $py -I tv.py "rm -f $dir/config.json $dir/wallpaper.jpg; am force-stop $pkg; am start -n $pkg/.MainActivity >/dev/null; echo reset"+ & $py -I tv.py "rm -f $dir/config.json $dir/wallpaper.jpg; $restart; echo reset"exit 0}if (-not $Theme) { throw 'usage: theme.ps1 <theme folder> | -Reset' }@@ -33,5 +36,5 @@ try { Get-Content $config -Raw | ConvertFrom-Json | Out-Null } catch { throw "$c& $py -I tv.py --push $config "$dir/config.json"$wall = Join-Path $Theme 'wallpaper.jpg'if (Test-Path $wall) { & $py -I b64push.py $wall "$dir/wallpaper.jpg" } else { & $py -I tv.py "rm -f $dir/wallpaper.jpg" | Out-Null }-& $py -I tv.py "am force-stop $pkg; am start -n $pkg/.MainActivity >/dev/null; echo applied"+& $py -I tv.py "$restart; echo applied"Write-Host "Theme $(Split-Path $Theme -Leaf) is on the TV. Undo with: tools\theme.ps1 -TvHost $TvHost -Reset"diff --git a/tools/theme.sh b/tools/theme.shindex 61f3c0f40..95c836ad6 100755--- a/tools/theme.sh+++ b/tools/theme.sh@@ -18,9 +18,12 @@ export MSYS_NO_PATHCONV=1PKG=com.gathin.tvhomeDIR=/sdcard/Android/data/$PKG/filestv() { "$PY" -I tv.py "$@"; }+# Restart Home so it rereads the theme. Android drops a force-stopped app's accessibility services from the+# enabled list, which would switch off InputKeyService/HomeKeyService, so put the list back if it had ours.+RESTART="a=\$(settings get secure enabled_accessibility_services); am force-stop $PKG; case \"\$a\" in *$PKG*) settings put secure enabled_accessibility_services \"\$a\" ;; esac; am start -n $PKG/.MainActivity >/dev/null"if [ "${1:-}" = --reset ]; then- tv "rm -f $DIR/config.json $DIR/wallpaper.jpg; am force-stop $PKG; am start -n $PKG/.MainActivity >/dev/null; echo reset" | tail -n 1+ tv "rm -f $DIR/config.json $DIR/wallpaper.jpg; $RESTART; echo reset" | tail -n 1exit 0fiTHEME="${THEME_ARG:?usage: theme.sh <theme folder> | --reset}"@@ -35,5 +38,5 @@ if [ -f "$THEME/wallpaper.jpg" ]; thenelsetv "rm -f $DIR/wallpaper.jpg" >/dev/nullfi-tv "am force-stop $PKG; am start -n $PKG/.MainActivity >/dev/null; echo applied" | tail -n 1+tv "$RESTART; echo applied" | tail -n 1echo "Theme $(basename "$THEME") is on the TV. Undo with: tools/theme.sh --reset"