Skip to content

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

chore: bump version to 0.1.4, improve cross-platform build support and refactor UI code formatting

Samir Hossains913fb783f64d
diff --git a/.cargo/config.toml b/.cargo/config.toml
new file mode 100644
index 0000000..5ed6338
--- /dev/null
+++ b/.cargo/config.toml
@@ -0,0 +1,2 @@
+[target.x86_64-pc-windows-gnu]
+linker = "x86_64-w64-mingw32-gcc"
diff --git a/.gitignore b/.gitignore
index e35ea19..aaa767e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -17,4 +17,5 @@ Thumbs.db
.AppleDouble
.LSOverride
debug_*.json
-*.log
\ No newline at end of file
+*.log
+dist/
\ No newline at end of file
diff --git a/Cargo.lock b/Cargo.lock
index 47e8a26..11f59b9 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1796,7 +1796,7 @@ dependencies = [
[[package]]
name = "moviebox-tui"
-version = "0.1.3"
+version = "0.1.4"
dependencies = [
"arboard",
"base64",
diff --git a/Cargo.toml b/Cargo.toml
index 58a8cda..f4fa810 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,7 +1,7 @@
[package]
name = "moviebox-tui"
-exclude = ["assets/", ".github/"]
-version = "0.1.3"
+exclude = ["assets/", ".github/", "scripts/", "install.sh", "install.ps1"]
+version = "0.1.4"
edition = "2024"
description = "A terminal client for finding and streaming movies, TV shows, and anime from the MovieBox catalog."
repository = "https://github.com/mesamirh/MovieBox-Tui"
diff --git a/README.md b/README.md
index 306ec1f..f9725b5 100644
--- a/README.md
+++ b/README.md
@@ -8,6 +8,7 @@ A terminal client for finding and streaming movies, TV shows, and anime from you
[![Downloads](https://img.shields.io/crates/d/moviebox-tui.svg)](https://crates.io/crates/moviebox-tui)
[![License](https://img.shields.io/badge/license-MIT%20OR%20Apache--2.0-blue.svg)](#license)
[![Rust](https://img.shields.io/badge/rust-1.85%2B-orange.svg?logo=rust)](#requirements)
+[![Support](https://img.shields.io/badge/Support-Crypto-gold.svg)](#support)
<br>
@@ -133,9 +134,12 @@ A short walkthrough of the app in action:
| Platform | Status |
| :--- | :--- |
-| **macOS** | Fully supported. Developed and tested here. Ghostty, iTerm2, and Kitty all render posters correctly. |
-| **Linux** | Experimental. Should work on any terminal with graphics-protocol support. Not extensively tested. |
-| **Windows** | Experimental. Expect bugs, especially around inline image rendering. Contributions welcome. |
+| **macOS** | Fully supported. Ghostty, iTerm2, and WezTerm render full-resolution image posters. |
+| **Linux** | Supported. You **must** use Kitty, WezTerm, or Ghostty for full-resolution posters. Other terminals (like GNOME Terminal) will safely fall back to text. |
+| **Windows** | Supported. You **must** use WezTerm for full-resolution posters. Windows Terminal/cmd will safely fall back to text. |
+
+> **Warning: Windows support is currently in beta.**
+> While the core features work perfectly, you may experience occasional rendering glitches or slow performance compared to macOS and Linux. I am actively improving this. If you encounter any bugs on Windows, please [open an issue](https://github.com/mesamirh/MovieBox-Tui/issues) so I can fix them!
---
@@ -180,36 +184,45 @@ MovieBox-Tui auto-detects whichever players you have installed on the first run.
## Install
-The recommended way is to install from crates.io:
+The absolute easiest way to install MovieBox-Tui is using the automated installation scripts. This will download the latest pre-built binary for your system and add it to your PATH so you can just type `moviebox-tui` from anywhere.
+### macOS & Linux
+Paste this single line into your terminal:
```bash
-cargo install moviebox-tui
+curl -fsSL https://raw.githubusercontent.com/mesamirh/MovieBox-Tui/main/install.sh | bash
```
+*(Requires `sudo` permissions to move the binary into `/usr/local/bin`)*
-Make sure `~/.cargo/bin` is on your `PATH`, then run:
-
-```bash
-moviebox-tui
+### Windows (PowerShell)
+Paste this single line into your PowerShell:
+```powershell
+irm https://raw.githubusercontent.com/mesamirh/MovieBox-Tui/main/install.ps1 | iex
```
+---
+
<details>
-<summary><b>Building from source</b></summary>
+<summary><b>Manual Download (No scripts)</b></summary>
<br>
-If you want a local checkout or a development version:
+If you prefer not to run the scripts, you can download the binaries directly:
+1. Go to the [Releases page](https://github.com/mesamirh/MovieBox-Tui/releases/latest).
+2. Download the correct file for your operating system:
+ - **macOS:** `MovieBox_macOS_Universal.tar.gz`
+ - **Windows:** `MovieBox_Windows_x64.zip`
+ - **Linux:** `MovieBox_Linux_x64.tar.gz`
+3. Extract the file and run it directly.
+</details>
-```bash
-git clone https://github.com/mesamirh/MovieBox-Tui.git
-cd MovieBox-Tui
-cargo install --path .
-```
+<details>
+<summary><b>Installing via Cargo (for Rust developers)</b></summary>
+<br>
-Or run it directly without installing:
+If you already have Rust installed, you can easily install from crates.io:
```bash
-cargo run --release
+cargo install moviebox-tui
```
-
</details>
---
@@ -302,6 +315,11 @@ src/
├── home.rs Home, search, and result list
├── details.rs Movie / series detail view
└── help.rs Keybindings overlay
+
+install.sh macOS/Linux automated install script
+install.ps1 Windows automated install script
+scripts/
+└── release.sh Cross-platform build script for releases
```
If you're poking around the code, `src/tui/app.rs` is the map. Every user action, network response, and background task funnels through its match statement.
@@ -370,6 +388,16 @@ Commits follow [Conventional Commits](https://www.conventionalcommits.org/) (`fe
---
+## Support
+
+If you enjoy using MovieBox-Tui and want to support its development, you can send a tip to any of the crypto addresses below.
+
+- **EVM (ETH, BNB, Polygon, etc):** `0x7ea20d5fa29d87f33195f5a3b211ff94038d794c`
+- **BTC:** `3MEAtqtRWrQBhnaMi3Zuf5nt2efNUS2LUQ`
+- **LTC:** `ltc1qhjkq2n6tsayxj56n3c53uqv23v8vqhvc9g3vxl`
+
+---
+
## Acknowledgements
Built with [Ratatui](https://ratatui.rs), [crossterm](https://github.com/crossterm-rs/crossterm), [ratatui-image](https://github.com/benjajaja/ratatui-image), [tokio](https://tokio.rs), and [reqwest](https://github.com/seanmonstar/reqwest). Playback is powered by [mpv](https://mpv.io), [IINA](https://iina.io), and [VLC](https://www.videolan.org).
diff --git a/install.ps1 b/install.ps1
new file mode 100644
index 0000000..2a0e584
--- /dev/null
+++ b/install.ps1
@@ -0,0 +1,28 @@
+Write-Host "Installing MovieBox-Tui..." -ForegroundColor Cyan
+
+$Url = "https://github.com/mesamirh/MovieBox-Tui/releases/latest/download/MovieBox_Windows_x64.zip"
+$InstallDir = "$env:USERPROFILE\AppData\Local\MovieBox-Tui"
+$ZipFile = "$env:TEMP\MovieBox_Windows_x64.zip"
+
+Write-Host "Downloading latest release..."
+Invoke-WebRequest -Uri $Url -OutFile $ZipFile
+
+if (!(Test-Path $InstallDir)) {
+ New-Item -ItemType Directory -Force -Path $InstallDir | Out-Null
+}
+
+Write-Host "Extracting..."
+Expand-Archive -Path $ZipFile -DestinationPath $InstallDir -Force
+Rename-Item -Path "$InstallDir\MovieBox.exe" -NewName "moviebox-tui.exe" -Force -ErrorAction SilentlyContinue
+
+Remove-Item $ZipFile -Force
+
+$UserPath = [Environment]::GetEnvironmentVariable("PATH", "User")
+if ($UserPath -notmatch [regex]::Escape($InstallDir)) {
+ Write-Host "Adding to PATH..."
+ $NewPath = "$UserPath;$InstallDir"
+ [Environment]::SetEnvironmentVariable("PATH", $NewPath, "User")
+ Write-Host "Warning: Please restart your PowerShell window for the PATH changes to take effect." -ForegroundColor Yellow
+}
+
+Write-Host "Success! You can now run 'moviebox-tui' from anywhere." -ForegroundColor Green
diff --git a/install.sh b/install.sh
new file mode 100644
index 0000000..aab6250
--- /dev/null
+++ b/install.sh
@@ -0,0 +1,39 @@
+#!/bin/bash
+set -e
+
+echo "Installing MovieBox-Tui..."
+
+OS="$(uname -s)"
+ARCH="$(uname -m)"
+
+if [ "$OS" = "Darwin" ]; then
+ FILE="MovieBox_macOS_Universal.tar.gz"
+elif [ "$OS" = "Linux" ]; then
+ if [ "$ARCH" = "x86_64" ]; then
+ FILE="MovieBox_Linux_x64.tar.gz"
+ else
+ echo "Error: Unsupported Linux architecture: $ARCH. Only x86_64 is supported currently."
+ exit 1
+ fi
+else
+ echo "Error: Unsupported OS: $OS"
+ exit 1
+fi
+
+URL="https://github.com/mesamirh/MovieBox-Tui/releases/latest/download/$FILE"
+TMP_DIR=$(mktemp -d)
+
+echo "Downloading latest release for $OS..."
+curl -fsSL "$URL" -o "$TMP_DIR/$FILE"
+
+echo "Extracting..."
+tar -xzf "$TMP_DIR/$FILE" -C "$TMP_DIR"
+
+INSTALL_DIR="/usr/local/bin"
+echo "Installing to $INSTALL_DIR (may require sudo password)..."
+sudo mv "$TMP_DIR/moviebox" "$INSTALL_DIR/moviebox-tui"
+sudo chmod +x "$INSTALL_DIR/moviebox-tui"
+
+rm -rf "$TMP_DIR"
+
+echo "Success! You can now run 'moviebox-tui' from anywhere in your terminal."
diff --git a/scripts/release.sh b/scripts/release.sh
new file mode 100755
index 0000000..8412483
--- /dev/null
+++ b/scripts/release.sh
@@ -0,0 +1,42 @@
+#!/bin/bash
+set -e
+
+echo "Starting builds for all platforms..."
+
+rm -rf dist .tmp_build
+mkdir -p dist
+mkdir -p .tmp_build
+
+echo "Building macOS Universal Binary..."
+cargo build --target aarch64-apple-darwin --release
+cargo build --target x86_64-apple-darwin --release
+lipo -create \
+ target/aarch64-apple-darwin/release/moviebox-tui \
+ target/x86_64-apple-darwin/release/moviebox-tui \
+ -output .tmp_build/moviebox
+tar -czf dist/MovieBox_macOS_Universal.tar.gz -C .tmp_build moviebox
+rm .tmp_build/moviebox
+echo "macOS Universal build complete!"
+
+echo "Building Windows Executable..."
+cargo build --target x86_64-pc-windows-gnu --release
+cp target/x86_64-pc-windows-gnu/release/moviebox-tui.exe .tmp_build/MovieBox.exe
+cd .tmp_build && zip -q ../dist/MovieBox_Windows_x64.zip MovieBox.exe && cd ..
+rm .tmp_build/MovieBox.exe
+echo "Windows build complete!"
+
+echo "Building Linux Binary (via Docker)..."
+if ! docker info > /dev/null 2>&1; then
+ echo "Warning: Docker is not running! Please open the Docker app on your Mac and run this script again to build the Linux version."
+else
+ CROSS_CONTAINER_OPTS="--platform linux/amd64" cross build --target x86_64-unknown-linux-musl --release
+ cp target/x86_64-unknown-linux-musl/release/moviebox-tui .tmp_build/moviebox
+ tar -czf dist/MovieBox_Linux_x64.tar.gz -C .tmp_build moviebox
+ echo "Linux build complete!"
+fi
+
+rm -rf .tmp_build
+
+echo ""
+echo "All done! Your release files are packed and ready to upload to GitHub:"
+ls -lh dist
diff --git a/src/tui/app.rs b/src/tui/app.rs
index 97f9571..8132988 100644
--- a/src/tui/app.rs
+++ b/src/tui/app.rs
@@ -114,7 +114,10 @@ impl App {
if self.state.image_picker.is_none() && self.state.image_supported {
match ratatui_image::picker::Picker::from_query_stdio() {
Ok(picker) => {
- if matches!(picker.protocol_type(), ratatui_image::picker::ProtocolType::Halfblocks) {
+ if matches!(
+ picker.protocol_type(),
+ ratatui_image::picker::ProtocolType::Halfblocks
+ ) {
self.state.image_supported = false;
} else {
let cell_h = picker.font_size().height;
@@ -1568,7 +1571,14 @@ impl App {
{
if let Ok(mut clipboard) = arboard::Clipboard::new() {
let _ = clipboard.set_text(link.clone());
- self.state.toast_message = Some(format!("{} Copied stream link!", if self.state.basic_terminal { "[OK]" } else { "✓" }));
+ self.state.toast_message = Some(format!(
+ "{} Copied stream link!",
+ if self.state.basic_terminal {
+ "[OK]"
+ } else {
+ "✓"
+ }
+ ));
self.state.toast_timer = 30;
} else {
self.state.status_message = format!("Link: {}", link);
@@ -1591,7 +1601,14 @@ impl App {
let resource_id = self.get_selected_resource_id();
if let Some(rid) = resource_id {
- self.state.toast_message = Some(format!("{} Fetching subtitles...", if self.state.basic_terminal { "[OK]" } else { "✓" }));
+ self.state.toast_message = Some(format!(
+ "{} Fetching subtitles...",
+ if self.state.basic_terminal {
+ "[OK]"
+ } else {
+ "✓"
+ }
+ ));
self.state.toast_timer = 40;
let client = self.client.clone();
let sender = self.action_sender.clone();
@@ -1661,7 +1678,14 @@ impl App {
}
Action::LaunchMpv(link, subtitle_url) => {
use std::process::{Command, Stdio};
- self.state.toast_message = Some(format!("{} Launching MPV...", if self.state.basic_terminal { "[OK]" } else { "✓" }));
+ self.state.toast_message = Some(format!(
+ "{} Launching MPV...",
+ if self.state.basic_terminal {
+ "[OK]"
+ } else {
+ "✓"
+ }
+ ));
self.state.toast_timer = 40;
let mut cmd = Command::new("mpv");
@@ -1681,8 +1705,14 @@ impl App {
if cmd.spawn().is_ok() {
} else {
- self.state.toast_message =
- Some(format!("{} Error: mpv player not found in PATH", if self.state.basic_terminal { "[X]" } else { "✗" }));
+ self.state.toast_message = Some(format!(
+ "{} Error: mpv player not found in PATH",
+ if self.state.basic_terminal {
+ "[X]"
+ } else {
+ "✗"
+ }
+ ));
self.state.toast_timer = 60;
}
}
@@ -1716,8 +1746,14 @@ impl App {
.join(&filename);
if let Some(link) = link_opt {
- self.state.toast_message =
- Some(format!("{} Starting native download...", if self.state.basic_terminal { "[OK]" } else { "✓" }));
+ self.state.toast_message = Some(format!(
+ "{} Starting native download...",
+ if self.state.basic_terminal {
+ "[OK]"
+ } else {
+ "✓"
+ }
+ ));
self.state.toast_timer = 40;
self.state.download_status = Some("Connecting...".to_string());
self.state.download_progress = Some(0.0);
@@ -2373,14 +2409,27 @@ impl App {
.cancel_download
.store(true, std::sync::atomic::Ordering::SeqCst);
self.state.download_status = Some("Cancelling...".to_string());
- self.state.toast_message = Some(format!("{} Cancelling download...", if self.state.basic_terminal { "[X]" } else { "✗" }));
+ self.state.toast_message = Some(format!(
+ "{} Cancelling download...",
+ if self.state.basic_terminal {
+ "[X]"
+ } else {
+ "✗"
+ }
+ ));
self.state.toast_timer = 40;
}
Action::ShowPlayerPicker(link, subtitle) => {
if self.state.available_players.is_empty() {
- self.state.toast_message =
- Some(format!("{} No media player found. Install mpv, IINA, or VLC.", if self.state.basic_terminal { "[X]" } else { "✗" }));
+ self.state.toast_message = Some(format!(
+ "{} No media player found. Install mpv, IINA, or VLC.",
+ if self.state.basic_terminal {
+ "[X]"
+ } else {
+ "✗"
+ }
+ ));
self.state.toast_timer = 150;
return None;
}
@@ -2438,11 +2487,25 @@ impl App {
}
crate::tui::state::PlayerKind::Vlc => {
let mut c = if std::path::Path::new("/Applications/VLC.app").exists() {
- std::process::Command::new("/Applications/VLC.app/Contents/MacOS/VLC")
- } else if std::path::Path::new("C:\\Program Files\\VideoLAN\\VLC\\vlc.exe").exists() {
- std::process::Command::new("C:\\Program Files\\VideoLAN\\VLC\\vlc.exe")
- } else if std::path::Path::new("C:\\Program Files (x86)\\VideoLAN\\VLC\\vlc.exe").exists() {
- std::process::Command::new("C:\\Program Files (x86)\\VideoLAN\\VLC\\vlc.exe")
+ std::process::Command::new(
+ "/Applications/VLC.app/Contents/MacOS/VLC",
+ )
+ } else if std::path::Path::new(
+ "C:\\Program Files\\VideoLAN\\VLC\\vlc.exe",
+ )
+ .exists()
+ {
+ std::process::Command::new(
+ "C:\\Program Files\\VideoLAN\\VLC\\vlc.exe",
+ )
+ } else if std::path::Path::new(
+ "C:\\Program Files (x86)\\VideoLAN\\VLC\\vlc.exe",
+ )
+ .exists()
+ {
+ std::process::Command::new(
+ "C:\\Program Files (x86)\\VideoLAN\\VLC\\vlc.exe",
+ )
} else {
std::process::Command::new("vlc")
};
diff --git a/src/tui/screens/details.rs b/src/tui/screens/details.rs
index a3f5c98..22d8962 100644
--- a/src/tui/screens/details.rs
+++ b/src/tui/screens/details.rs
@@ -120,7 +120,11 @@ pub fn draw(frame: &mut Frame, area: Rect, state: &mut AppState, theme: &Theme)
let details_block = Block::default()
.borders(Borders::ALL)
- .border_type(if state.basic_terminal { ratatui::widgets::BorderType::Plain } else { ratatui::widgets::BorderType::Rounded })
+ .border_type(if state.basic_terminal {
+ ratatui::widgets::BorderType::Plain
+ } else {
+ ratatui::widgets::BorderType::Rounded
+ })
.border_style(theme.border)
.padding(ratatui::widgets::Padding::new(2, 2, 1, 1));
@@ -310,7 +314,11 @@ pub fn draw(frame: &mut Frame, area: Rect, state: &mut AppState, theme: &Theme)
.block(
Block::default()
.borders(Borders::ALL)
- .border_type(if state.basic_terminal { ratatui::widgets::BorderType::Plain } else { ratatui::widgets::BorderType::Rounded })
+ .border_type(if state.basic_terminal {
+ ratatui::widgets::BorderType::Plain
+ } else {
+ ratatui::widgets::BorderType::Rounded
+ })
.title(" Audio ")
.border_style(lang_border)
.padding(ratatui::widgets::Padding::horizontal(1)),
@@ -343,7 +351,11 @@ pub fn draw(frame: &mut Frame, area: Rect, state: &mut AppState, theme: &Theme)
.block(
Block::default()
.borders(Borders::ALL)
- .border_type(if state.basic_terminal { ratatui::widgets::BorderType::Plain } else { ratatui::widgets::BorderType::Rounded })
+ .border_type(if state.basic_terminal {
+ ratatui::widgets::BorderType::Plain
+ } else {
+ ratatui::widgets::BorderType::Rounded
+ })
.title(" Seasons ")
.border_style(seasons_border)
.padding(ratatui::widgets::Padding::horizontal(1)),
@@ -376,7 +388,11 @@ pub fn draw(frame: &mut Frame, area: Rect, state: &mut AppState, theme: &Theme)
.block(
Block::default()
.borders(Borders::ALL)
- .border_type(if state.basic_terminal { ratatui::widgets::BorderType::Plain } else { ratatui::widgets::BorderType::Rounded })
+ .border_type(if state.basic_terminal {
+ ratatui::widgets::BorderType::Plain
+ } else {
+ ratatui::widgets::BorderType::Rounded
+ })
.title(" Episodes ")
.border_style(eps_border)
.padding(ratatui::widgets::Padding::horizontal(1)),
@@ -410,7 +426,11 @@ pub fn draw(frame: &mut Frame, area: Rect, state: &mut AppState, theme: &Theme)
let streams_block = Block::default()
.borders(Borders::ALL)
- .border_type(if state.basic_terminal { ratatui::widgets::BorderType::Plain } else { ratatui::widgets::BorderType::Rounded })
+ .border_type(if state.basic_terminal {
+ ratatui::widgets::BorderType::Plain
+ } else {
+ ratatui::widgets::BorderType::Rounded
+ })
.title(ratatui::text::Line::from(streams_title).alignment(Alignment::Left))
.title_style(theme.title)
.border_style(streams_border)
@@ -611,7 +631,11 @@ pub fn draw(frame: &mut Frame, area: Rect, state: &mut AppState, theme: &Theme)
.title(" Select Subtitle ")
.title_style(theme.title)
.borders(ratatui::widgets::Borders::ALL)
- .border_type(if state.basic_terminal { ratatui::widgets::BorderType::Plain } else { ratatui::widgets::BorderType::Rounded })
+ .border_type(if state.basic_terminal {
+ ratatui::widgets::BorderType::Plain
+ } else {
+ ratatui::widgets::BorderType::Rounded
+ })
.border_style(theme.border),
)
.highlight_style(theme.highlight)
@@ -653,7 +677,11 @@ pub fn draw(frame: &mut Frame, area: Rect, state: &mut AppState, theme: &Theme)
.title(" Open With ")
.title_style(theme.title)
.borders(ratatui::widgets::Borders::ALL)
- .border_type(if state.basic_terminal { ratatui::widgets::BorderType::Plain } else { ratatui::widgets::BorderType::Rounded })
+ .border_type(if state.basic_terminal {
+ ratatui::widgets::BorderType::Plain
+ } else {
+ ratatui::widgets::BorderType::Rounded
+ })
.border_style(theme.border),
)
.highlight_style(theme.highlight)
diff --git a/src/tui/screens/help.rs b/src/tui/screens/help.rs
index bae8220..b3c1dc2 100644
--- a/src/tui/screens/help.rs
+++ b/src/tui/screens/help.rs
@@ -117,7 +117,11 @@ pub fn draw(frame: &mut Frame, area: Rect, state: &AppState, theme: &Theme) {
.title_alignment(Alignment::Center)
.title_style(theme.title)
.borders(Borders::ALL)
- .border_type(if state.basic_terminal { BorderType::Plain } else { BorderType::Rounded })
+ .border_type(if state.basic_terminal {
+ BorderType::Plain
+ } else {
+ BorderType::Rounded
+ })
.border_style(theme.border_focus);
let p = Paragraph::new(help_text)
diff --git a/src/tui/screens/home.rs b/src/tui/screens/home.rs
index 9c50882..f85bd39 100644
--- a/src/tui/screens/home.rs
+++ b/src/tui/screens/home.rs
@@ -291,7 +291,9 @@ pub fn draw(frame: &mut Frame, area: Rect, state: &mut AppState, theme: &Theme)
x: inner_area.x,
y: current_y,
width: inner_area.width,
- height: state.poster_rows.min(inner_area.y + inner_area.height.saturating_sub(current_y)),
+ height: state
+ .poster_rows
+ .min(inner_area.y + inner_area.height.saturating_sub(current_y)),
};
if item_area.height == 0 {
@@ -304,7 +306,11 @@ pub fn draw(frame: &mut Frame, area: Rect, state: &mut AppState, theme: &Theme)
.direction(Direction::Horizontal)
.constraints([
Constraint::Length(2),
- Constraint::Length(if state.image_supported { state.poster_rows + 1 } else { 0 }),
+ Constraint::Length(if state.image_supported {
+ state.poster_rows + 1
+ } else {
+ 0
+ }),
Constraint::Length(if state.image_supported { 1 } else { 0 }),
Constraint::Min(0),
])
@@ -316,7 +322,10 @@ pub fn draw(frame: &mut Frame, area: Rect, state: &mut AppState, theme: &Theme)
if is_selected {
let indicator = Paragraph::new(ratatui::text::Line::from(vec![
- ratatui::text::Span::styled(if state.basic_terminal { "> " } else { "▌ " }, theme.accent),
+ ratatui::text::Span::styled(
+ if state.basic_terminal { "> " } else { "▌ " },
+ theme.accent,
+ ),
]));
let v_layout = Layout::default()
@@ -561,7 +570,11 @@ pub fn draw(frame: &mut Frame, area: Rect, state: &mut AppState, theme: &Theme)
ratatui::widgets::Block::default()
.borders(ratatui::widgets::Borders::ALL)
.border_style(theme.border_focus)
- .border_type(if state.basic_terminal { ratatui::widgets::BorderType::Plain } else { ratatui::widgets::BorderType::Rounded }),
+ .border_type(if state.basic_terminal {
+ ratatui::widgets::BorderType::Plain
+ } else {
+ ratatui::widgets::BorderType::Rounded
+ }),
);
frame.render_widget(list, dropdown_area);
}
diff --git a/src/tui/state.rs b/src/tui/state.rs
index f9ef551..1f9d45b 100644
--- a/src/tui/state.rs
+++ b/src/tui/state.rs
@@ -188,7 +188,11 @@ impl Default for AppState {
player_picker_subtitle: None,
available_players: {
let mut players = Vec::new();
- let which_cmd = if cfg!(target_os = "windows") { "where" } else { "which" };
+ let which_cmd = if cfg!(target_os = "windows") {
+ "where"
+ } else {
+ "which"
+ };
let check_player = |cmd: &str| -> bool {
std::process::Command::new(which_cmd)
.arg(cmd)
@@ -196,10 +200,12 @@ impl Default for AppState {
.map(|o| o.status.success())
.unwrap_or(false)
};
-
+
#[cfg(target_os = "macos")]
{
- if std::path::Path::new("/Applications/IINA.app").exists() || check_player("iina") {
+ if std::path::Path::new("/Applications/IINA.app").exists()
+ || check_player("iina")
+ {
players.push(PlayerKind::Iina);
}
}
diff --git a/src/tui/theme.rs b/src/tui/theme.rs
index 66597d6..b711387 100644
--- a/src/tui/theme.rs
+++ b/src/tui/theme.rs
@@ -49,13 +49,23 @@ impl Default for Theme {
impl Theme {
pub fn new() -> Self {
- let colorterm = std::env::var("COLORTERM").unwrap_or_default().to_lowercase();
+ let colorterm = std::env::var("COLORTERM")
+ .unwrap_or_default()
+ .to_lowercase();
let term = std::env::var("TERM").unwrap_or_default().to_lowercase();
-
+
let wt_truecolor = std::env::var("WT_SESSION").is_ok();
- let truecolor = wt_truecolor || colorterm == "truecolor" || colorterm == "24bit" || term.contains("truecolor");
-
- if !truecolor && (term.contains("apple") || term == "dumb" || term == "linux" || std::env::var("TERM_PROGRAM").unwrap_or_default() == "Apple_Terminal") {
+ let truecolor = wt_truecolor
+ || colorterm == "truecolor"
+ || colorterm == "24bit"
+ || term.contains("truecolor");
+
+ if !truecolor
+ && (term.contains("apple")
+ || term == "dumb"
+ || term == "linux"
+ || std::env::var("TERM_PROGRAM").unwrap_or_default() == "Apple_Terminal")
+ {
Self::fallback()
} else {
Self::default()
@@ -68,15 +78,23 @@ impl Theme {
border_focus: Style::default().fg(Color::Blue),
text: Style::default().fg(Color::Reset),
text_dim: Style::default().fg(Color::Gray),
- title: Style::default().fg(Color::Magenta).add_modifier(Modifier::BOLD),
- highlight: Style::default().fg(Color::Blue).add_modifier(Modifier::BOLD),
- header: Style::default().fg(Color::Magenta).add_modifier(Modifier::BOLD),
+ title: Style::default()
+ .fg(Color::Magenta)
+ .add_modifier(Modifier::BOLD),
+ highlight: Style::default()
+ .fg(Color::Blue)
+ .add_modifier(Modifier::BOLD),
+ header: Style::default()
+ .fg(Color::Magenta)
+ .add_modifier(Modifier::BOLD),
error: Style::default().fg(Color::Red),
success: Style::default().fg(Color::Green),
shortcut: Style::default().fg(Color::Yellow),
overlay: Style::default().fg(Color::DarkGray),
rating: Style::default().fg(Color::Yellow),
- accent: Style::default().fg(Color::Cyan).add_modifier(Modifier::BOLD),
+ accent: Style::default()
+ .fg(Color::Cyan)
+ .add_modifier(Modifier::BOLD),
muted: Style::default().fg(Color::DarkGray),
}
}