From a39d903c683725bd7d9ea4f70adecd56ea28452d Mon Sep 17 00:00:00 2001 From: Tal <83217276+talwat@users.noreply.github.com> Date: Tue, 26 Nov 2024 10:55:15 +0100 Subject: [PATCH] feat: convert width to an arbitrary unit to avoid uneven setups --- src/main.rs | 6 +++--- src/player/ui.rs | 5 +---- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/main.rs b/src/main.rs index a2cc896..428386c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -67,9 +67,9 @@ struct Args { #[clap(long, short)] debug: bool, - /// The width of the player - #[clap(long, short)] - width: Option, + /// The width of the player, from 0 to 32. + #[clap(long, short, default_value_t = 3)] + width: usize, /// This is either a path, or a name of a file in the data directory (eg. ~/.local/share/lowfi). #[clap(long, short, alias = "list", short_alias = 'l')] diff --git a/src/player/ui.rs b/src/player/ui.rs index 8711320..8ab5a63 100644 --- a/src/player/ui.rs +++ b/src/player/ui.rs @@ -27,9 +27,6 @@ use super::{Messages, Player}; mod components; mod input; -/// The default total width of the UI. -const DEFAULT_WIDTH: usize = 27; - /// Self explanitory. const FPS: usize = 12; @@ -240,7 +237,7 @@ pub async fn start(player: Arc, sender: Sender, args: Args) -> let interface = task::spawn(interface( Arc::clone(&player), args.minimalist, - args.width.unwrap_or(DEFAULT_WIDTH).max(21), + 21 + args.width.min(32) * 2, )); input::listen(sender.clone()).await?;