Skip to content

Terminal interface to find, download, and stream movies, TV shows, and live TV using local media players.

feat(install): add responsive terminal width detection and adaptive headers

Samir Hossainsb04341f646a6
diff --git a/CHANGELOG.md b/CHANGELOG.md
index e742a05..668c744 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -18,6 +18,9 @@
- Prevented raw Kitty APC escape sequence leak (`Gi=31...`) on macOS `Terminal.app` and legacy non-graphics consoles by skipping graphics stdio probes.
- Removed unsafe mid-session stdio graphics re-probing on `FocusChange` events.
+- **Responsive Mobile Installer Headers (`install.sh` & `install.ps1`)**:
+ - Implemented dynamic terminal column detection (`tput cols`, `stty size`, and `$COLUMNS` in `install.sh`; `$Host.UI.RawUI.WindowSize.Width` in `install.ps1`) with automatic multi-tier banner sizing.
+ - Eliminated ASCII art banner wrapping and visual corruption on narrow mobile viewports (e.g. Android Termux portrait mode at 40–55 columns) by rendering an adaptive 31-column compact half-block banner (`█▀▄▀█...`) and dynamic horizontal centering.
### Removed
- Removed vestigial `ShowPlaybackPicker` and `ShowPlayerPicker` action variants and playback picker state fields in favor of direct compatible player dispatch.
- **Redundant Slash Commands**:
diff --git a/docs/cross-platform.md b/docs/cross-platform.md
index e4c8375..b852149 100644
--- a/docs/cross-platform.md
+++ b/docs/cross-platform.md
@@ -53,6 +53,7 @@ prevent escape sequence probe leakage (`Gi=31...`):
- **Terminal classification**: `TERM=dumb`/`linux` fall back to a basic UI.
- Focus events re-render in place without clearing; results render in two
columns from 110 columns wide (three from 160).
+- **Responsive Installers**: Both Unix (`install.sh`) and Windows (`install.ps1`) installation scripts query terminal width dynamically (`tput cols` / `stty size` / `$Host.UI.RawUI.WindowSize.Width`), adapting the header across wide (72-column block art), compact (31-column 2-line half-block art for mobile/Termux portrait mode), and minimal (text-only) tiers with dynamic horizontal centering to prevent line wrapping.
## Network & TLS portability
- **TLS Engine**: Uses `rustls` with embedded Mozilla roots (`webpki-roots`) across all targets (macOS, Linux, Windows, Android/Termux). The release binary has no OpenSSL runtime dependency; the `ring` cryptography backend is compiled into the binary by the platform build toolchain.
diff --git a/install.ps1 b/install.ps1
index f23990a..bdf525a 100644
--- a/install.ps1
+++ b/install.ps1
@@ -97,17 +97,61 @@ function Remove-FromUserPath {
return $true
}
+function Get-TerminalCols {
+ $Cols = 80
+ try {
+ if ($Host.UI.RawUI.WindowSize.Width -gt 0) {
+ $Cols = $Host.UI.RawUI.WindowSize.Width
+ }
+ } catch {
+ $Cols = 80
+ }
+ return $Cols
+}
+
function Print-Header {
try { [Console]::Clear() } catch { Clear-Host }
- $Header = @"
- __ __ _ ____ _____ _ _ ___
-| \/ | _____ _(_) ___| __ ) _____ __ |_ _| | | |_ _|
-| |\/| |/ _ \ \ / / |/ _ \ _ \ / _ \ \/ / | | | | | || |
-| | | | (_) \ V /| | __/ |_) | (_) > < | | | |_| || |
-|_| |_|\___/ \_/ |_|\___|____/ \___/_/\_\ |_| \___/|___|
-"@
- Write-Host $Header -ForegroundColor Magenta
- Write-Host " Official Installer`n" -ForegroundColor Cyan
+ $Cols = Get-TerminalCols
+
+ if ($Cols -ge 65) {
+ $BannerWidth = 60
+ $Lines = @(
+ " __ __ _ ____ _____ _ _ ___ ",
+ "| \/ | _____ _(_) ___| __ ) _____ __ |_ _| | | |_ _|",
+ "| |\/| |/ _ \ \ / / |/ _ \ _ \ / _ \ \/ / | | | | | || | ",
+ "| | | | (_) \ V /| | __/ |_) | (_) > < | | | |_| || | ",
+ "|_| |_|\___/ \_/ |_|\___|____/ \___/_/\_\ |_| \___/|___|"
+ )
+ } elseif ($Cols -ge 36) {
+ $BannerWidth = 31
+ $Lines = @(
+ "█▀▄▀█ █▀█ █ █ █ █▀▀ █▀▄ █▀█ ▀▄▀",
+ "█ ▀ █ █▄█ ▀▄▀ █ ██▄ █▄▀ █▄█ █ █"
+ )
+ } else {
+ $BannerWidth = 12
+ $Lines = @(
+ "MovieBox-TUI"
+ )
+ }
+
+ $BannerPad = [Math]::Max(0, [int][Math]::Floor(($Cols - $BannerWidth) / 2))
+ $Sub = "Official Installer"
+ $SubPad = [Math]::Max(0, [int][Math]::Floor(($Cols - $Sub.Length) / 2))
+
+ foreach ($Line in $Lines) {
+ if ($BannerPad -gt 0) {
+ Write-Host ((" " * $BannerPad) + $Line) -ForegroundColor Magenta
+ } else {
+ Write-Host $Line -ForegroundColor Magenta
+ }
+ }
+
+ if ($SubPad -gt 0) {
+ Write-Host ((" " * $SubPad) + $Sub + "`n") -ForegroundColor Cyan
+ } else {
+ Write-Host ($Sub + "`n") -ForegroundColor Cyan
+ }
}
function Do-Uninstall {
diff --git a/install.sh b/install.sh
index d48a077..8100d2d 100755
--- a/install.sh
+++ b/install.sh
@@ -182,12 +182,33 @@ clear_screen() {
fi
}
+get_terminal_cols() {
+ local cols=""
+ if [ -n "${COLUMNS:-}" ] && [[ "$COLUMNS" =~ ^[0-9]+$ ]] && [ "$COLUMNS" -gt 0 ]; then
+ cols="$COLUMNS"
+ elif [ -t 1 ] || [ -t 2 ]; then
+ cols=$(tput cols 2>/dev/null || true)
+ if [ -z "$cols" ] || [ "$cols" -le 0 ] 2>/dev/null; then
+ cols=$(stty size 2>/dev/null | awk '{print $2}')
+ fi
+ fi
+ if [ -z "$cols" ] || [ "$cols" -le 0 ] 2>/dev/null; then
+ cols=80
+ fi
+ printf "%s" "$cols"
+}
+
print_header() {
clear_screen
- if [ "$IS_COLOR" -eq 1 ] && [ "$IS_TTY" -eq 1 ]; then
- printf "%b\n" "$CURSOR_HIDE"
- printf "%b%b" "$C_BOLD" "$C_MAUVE"
- local lines=(
+ local cols
+ cols=$(get_terminal_cols)
+
+ local lines=()
+ local banner_width=0
+
+ if [ "$cols" -ge 76 ]; then
+ banner_width=72
+ lines=(
"███╗ ███╗ ██████╗ ██╗ ██╗ ██╗ ███████╗ ██████╗ ██████╗ ██╗ ██╗"
"████╗ ████║ ██╔═══██╗ ██║ ██║ ██║ ██╔════╝ ██╔══██╗ ██╔═══██╗ ╚██╗██╔╝"
"██╔████╔██║ ██║ ██║ ██║ ██║ ██║ █████╗ ██████╔╝ ██║ ██║ ╚███╔╝ "
@@ -195,22 +216,60 @@ print_header() {
"██║ ╚═╝ ██║ ╚██████╔╝ ╚████╔╝ ██║ ███████╗ ██████╔╝ ╚██████╔╝ ██╔╝ ██╗"
"╚═╝ ╚═╝ ╚═════╝ ╚═══╝ ╚═╝ ╚══════╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═╝"
)
+ elif [ "$cols" -ge 36 ]; then
+ banner_width=31
+ lines=(
+ "█▀▄▀█ █▀█ █ █ █ █▀▀ █▀▄ █▀█ ▀▄▀"
+ "█ ▀ █ █▄█ ▀▄▀ █ ██▄ █▄▀ █▄█ █ █"
+ )
+ else
+ banner_width=12
+ lines=(
+ "MovieBox-TUI"
+ )
+ fi
+
+ local banner_pad=0
+ if [ "$cols" -gt "$banner_width" ]; then
+ banner_pad=$(( (cols - banner_width) / 2 ))
+ fi
+
+ local sub="Official Installer"
+ local sub_len=${#sub}
+ local sub_pad=0
+ if [ "$cols" -gt "$sub_len" ]; then
+ sub_pad=$(( (cols - sub_len) / 2 ))
+ fi
+
+ if [ "$IS_COLOR" -eq 1 ] && [ "$IS_TTY" -eq 1 ]; then
+ printf "%b\n" "$CURSOR_HIDE"
+ printf "%b%b" "$C_BOLD" "$C_MAUVE"
for line in "${lines[@]}"; do
- printf "%s\n" "$line"
+ if [ "$banner_pad" -gt 0 ]; then
+ printf "%*s%s\n" "$banner_pad" "" "$line"
+ else
+ printf "%s\n" "$line"
+ fi
sleep 0.02
done
- printf "%b%b Official Installer%b%b\n\n" "$C_SAPPHIRE" "$C_BOLD" "$C_RESET" "$CURSOR_SHOW"
+ if [ "$sub_pad" -gt 0 ]; then
+ printf "%*s%b%b%s%b%b\n\n" "$sub_pad" "" "$C_SAPPHIRE" "$C_BOLD" "$sub" "$C_RESET" "$CURSOR_SHOW"
+ else
+ printf "%b%b%s%b%b\n\n" "$C_SAPPHIRE" "$C_BOLD" "$sub" "$C_RESET" "$CURSOR_SHOW"
+ fi
else
- cat << 'EOF'
-███╗ ███╗ ██████╗ ██╗ ██╗ ██╗ ███████╗ ██████╗ ██████╗ ██╗ ██╗
-████╗ ████║ ██╔═══██╗ ██║ ██║ ██║ ██╔════╝ ██╔══██╗ ██╔═══██╗ ╚██╗██╔╝
-██╔████╔██║ ██║ ██║ ██║ ██║ ██║ █████╗ ██████╔╝ ██║ ██║ ╚███╔╝
-██║╚██╔╝██║ ██║ ██║ ╚██╗ ██╔╝ ██║ ██╔══╝ ██╔══██╗ ██║ ██║ ██╔██╗
-██║ ╚═╝ ██║ ╚██████╔╝ ╚████╔╝ ██║ ███████╗ ██████╔╝ ╚██████╔╝ ██╔╝ ██╗
-╚═╝ ╚═╝ ╚═════╝ ╚═══╝ ╚═╝ ╚══════╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═╝
- Official Installer
-
-EOF
+ for line in "${lines[@]}"; do
+ if [ "$banner_pad" -gt 0 ]; then
+ printf "%*s%s\n" "$banner_pad" "" "$line"
+ else
+ printf "%s\n" "$line"
+ fi
+ done
+ if [ "$sub_pad" -gt 0 ]; then
+ printf "%*s%s\n\n" "$sub_pad" "" "$sub"
+ else
+ printf "%s\n\n" "$sub"
+ fi
fi
}