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
themes/: default, aurora and six-columns, plus tools/theme.sh and theme.ps1 to push one
Gathin23b01bb945a0fc
diff --git a/README.md b/README.mdindex 6a73a3ffb..35537351f 100644--- a/README.md+++ b/README.md@@ -167,6 +167,7 @@ tools/restore.sh examples/xiaomi-mi-tv-4a/debloat.txt # undo it and resto| [`tools/tv.py`](tools/tv.py) | A pure-Python ADB client: shell, batch, push, pull. Works where the stock `adb` binary is blocked. || [`tools/b64push.py`](tools/b64push.py) | Uploads larger files such as APKs as base64 chunks and verifies the checksum. || [`tools/disable.sh`](tools/disable.sh) / [`tools/restore.sh`](tools/restore.sh) | Apply or undo a debloat list. PowerShell versions sit next to them. |+| [`tools/theme.sh`](tools/theme.sh) | Push a theme folder from [`themes/`](themes/) to the launcher and restart Home; `--reset` removes it. PowerShell version next to it. |### Windows@@ -197,6 +198,11 @@ the dock order, apps to hide, your TV's Live TV package, the number of columns (from 5 columns up), and how many grid rows stay visible under the dock (`rows_below_dock`). The Inputs button hides itself on sticks andboxes that have no HDMI or tuner.+**Themes** change the same settings, plus a background colour and a wallpaper, without a rebuild:+a folder with a `config.json` (and optionally a `wallpaper.jpg`) pushed to the TV with+`tools/theme.sh themes/<name>`, which the launcher reads as an overlay over `config.xml`. Three ship+in [`themes/`](themes/), and the keys are documented there. `tools/theme.sh --reset` goes back.+**Language** follows the TV: English, German, Spanish, Catalan, Simplified Chinese and Thai so far. If yourTV doesn't offer yours system-wide, Android 13 and later can set it for the launcher alone, e.g. Catalan:`tools/tv.py 'cmd locale set-app-locales com.gathin.tvhome --locales ca'`.diff --git a/themes/README.md b/themes/README.mdnew file mode 100644index 000000000..85cb6b313--- /dev/null+++ b/themes/README.md@@ -0,0 +1,48 @@+# Themes++A theme is a folder with a `config.json` and, optionally, a `wallpaper.jpg`. Pushing one changes the+launcher's dock, layout and look on the TV without rebuilding the APK: the launcher reads+`config.json` as an overlay over its built-in `config.xml` the next time it starts.++```bash+TV_HOST=192.168.1.50 tools/theme.sh themes/aurora # push a theme and restart Home+TV_HOST=192.168.1.50 tools/theme.sh --reset # back to the built-in config.xml+powershell -ExecutionPolicy Bypass -File tools\theme.ps1 -TvHost 192.168.1.50 themes\aurora+```++| Theme | What it does |+|---|---|+| `default/` | The built-in look written out as JSON, as a starting point for your own |+| `aurora/` | A dark aurora wallpaper (teal and violet on navy, darker at the bottom) with a matching background colour |+| `six-columns/` | Six smaller tiles per row and one grid row visible under the dock |++## Keys++Every key is optional; a missing key keeps the value from `config.xml`, an unknown or wrongly typed key+is ignored, and a file that doesn't parse is ignored as a whole, so a theme can never break Home.++| Key | Type | Meaning |+|---|---|---|+| `dock_apps` | list of package names | The dock row, in order; missing apps are skipped |+| `hidden_apps` | list of package names | Never shown as tiles |+| `live_tv_package`, `live_tv_action` | string | The Live TV app and, if it has no leanback entry, the action to start it with |+| `source_panel_service`, `source_panel_action` | string | The TV's own source panel, for sets with no TvInputManager |+| `columns` | 1 to 8 | Tiles per row; tiles shrink to fit from 5 up |+| `rows_below_dock` | 0 to 3 | Grid rows left visible under the dock |+| `shamsi_date` | bool | Show the Solar Hijri date above the Gregorian one |+| `vpn_app` | string | App the network pill opens when a VPN is configured |+| `show_home_settings_shortcut` | bool | The "Default home" tile, where the TV has a home picker |+| `background_color` | `#RRGGBB` | Colour behind everything; black by default |+| `wallpaper` | bool | Show `wallpaper.jpg` from the theme folder (`true`), or ignore it (`false`) |++## Wallpapers++`wallpaper.jpg` is drawn full screen behind the launcher, centre-cropped. Keep it dark, 1920×1080 and+under about 300 KB: the text, the hero name and the dock band are designed for black, and a 1 GB TV+decodes the picture into memory on every Home start. Pictures larger than the screen are downsampled.++## Adding a theme++Open a PR with a new folder here, a one-line row in the table above and a screenshot from a real TV+in the PR description. Keep the dock list generic (the big streaming apps) unless the theme is for a+specific TV, and say which TV you tried it on.diff --git a/themes/aurora/config.json b/themes/aurora/config.jsonnew file mode 100644index 000000000..6256c3f53--- /dev/null+++ b/themes/aurora/config.json@@ -0,0 +1,4 @@+{+ "background_color": "#070A14",+ "wallpaper": true+}diff --git a/themes/aurora/wallpaper.jpg b/themes/aurora/wallpaper.jpgnew file mode 100644index 000000000..3ee13001fBinary files /dev/null and b/themes/aurora/wallpaper.jpg differdiff --git a/themes/default/config.json b/themes/default/config.jsonnew file mode 100644index 000000000..1370ae3ac--- /dev/null+++ b/themes/default/config.json@@ -0,0 +1,8 @@+{+ "dock_apps": ["com.netflix.ninja", "com.amazon.amazonvideo.livingroom", "com.google.android.youtube.tv", "in.startv.hotstar"],+ "hidden_apps": ["com.mediatek.wwtv.tvcenter", "com.mitv.gallery"],+ "columns": 4,+ "rows_below_dock": 0,+ "background_color": "#000000",+ "wallpaper": false+}diff --git a/themes/six-columns/config.json b/themes/six-columns/config.jsonnew file mode 100644index 000000000..fafff68bd--- /dev/null+++ b/themes/six-columns/config.json@@ -0,0 +1,6 @@+{+ "columns": 6,+ "rows_below_dock": 1,+ "background_color": "#000000",+ "wallpaper": false+}diff --git a/tools/theme.ps1 b/tools/theme.ps1new file mode 100644index 000000000..f5c926805--- /dev/null+++ b/tools/theme.ps1@@ -0,0 +1,35 @@+# Windows version of theme.sh: push a theme folder (config.json and optionally wallpaper.jpg) to the+# launcher on the TV and restart Home. See themes/README.md for the keys.+#+# Usage: tools\theme.ps1 -TvHost 192.168.1.50 themes\aurora+# tools\theme.ps1 -TvHost 192.168.1.50 -Reset+param(+ [Parameter(Position = 0)][string]$Theme,+ [switch]$Reset,+ [string]$TvHost = $env:TV_HOST+)+$ErrorActionPreference = 'Stop'+$OutputEncoding = New-Object System.Text.UTF8Encoding $false+if (-not $TvHost) { throw 'pass -TvHost <tv ip> or set $env:TV_HOST' }+$env:TV_HOST = $TvHost+Set-Location $PSScriptRoot+$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"++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"+ exit 0+}+if (-not $Theme) { throw 'usage: theme.ps1 <theme folder> | -Reset' }+$config = Join-Path $Theme 'config.json'+if (-not (Test-Path $config)) { throw "no config.json in $Theme" }+try { Get-Content $config -Raw | ConvertFrom-Json | Out-Null } catch { throw "$config is not valid JSON" }++& $py -I tv.py "mkdir -p $dir" | Out-Null+& $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"+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.shnew file mode 100755index 000000000..e753189e0--- /dev/null+++ b/tools/theme.sh@@ -0,0 +1,36 @@+#!/usr/bin/env bash+# Push a theme (a folder with config.json and optionally wallpaper.jpg) to the launcher on the TV and+# restart Home so it picks it up. The launcher reads the files from its external files directory and+# overlays config.json on its built-in config.xml; see themes/README.md for the keys.+#+# Usage: TV_HOST=192.168.1.50 tools/theme.sh themes/aurora+# TV_HOST=192.168.1.50 tools/theme.sh --reset # remove the overlay, back to config.xml+set -euo pipefail+cd "$(dirname "$0")"+: "${TV_HOST:?set TV_HOST to the TV IP address, e.g. TV_HOST=192.168.1.50 $0 themes/aurora}"+PY=venv/bin/python+[ -x "$PY" ] || PY=venv/Scripts/python.exe+[ -x "$PY" ] || { echo "run: python3 -m venv tools/venv && tools/venv/bin/pip install -r tools/requirements.txt" >&2; exit 1; }+export MSYS_NO_PATHCONV=1+PKG=com.gathin.tvhome+DIR=/sdcard/Android/data/$PKG/files+tv() { "$PY" -I tv.py "$@"; }++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+ exit 0+fi+THEME="${1:?usage: theme.sh <theme folder> | --reset}"+[ -f "$THEME/config.json" ] || { echo "no config.json in $THEME" >&2; exit 1; }+python3 -c 'import json,sys; json.load(open(sys.argv[1]))' "$THEME/config.json" 2>/dev/null \+ || { echo "$THEME/config.json is not valid JSON" >&2; exit 1; }++tv "mkdir -p $DIR" >/dev/null+tv --push "$THEME/config.json" "$DIR/config.json"+if [ -f "$THEME/wallpaper.jpg" ]; then+ "$PY" -I b64push.py "$THEME/wallpaper.jpg" "$DIR/wallpaper.jpg"+else+ tv "rm -f $DIR/wallpaper.jpg" >/dev/null+fi+tv "am force-stop $PKG; am start -n $PKG/.MainActivity >/dev/null; echo applied" | tail -n 1+echo "Theme $(basename "$THEME") is on the TV. Undo with: tools/theme.sh --reset"