feat: convert width to an arbitrary unit to avoid uneven setups

This commit is contained in:
Tal 2024-11-26 10:55:15 +01:00
parent a6f3eb034d
commit a39d903c68
2 changed files with 4 additions and 7 deletions

View File

@ -67,9 +67,9 @@ struct Args {
#[clap(long, short)]
debug: bool,
/// The width of the player
#[clap(long, short)]
width: Option<usize>,
/// 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')]

View File

@ -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<Player>, sender: Sender<Messages>, 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?;