modified: README.md

modified:   src/config.rs
	modified:   src/diagnose.rs
	modified:   src/launcher.rs
	modified:   src/main.rs
	new file:   src/setup.rs
	modified:   src/tray.rs
This commit is contained in:
funman300
2026-04-16 21:43:58 -07:00
parent 336c5d908e
commit 7e5ed3d447
7 changed files with 690 additions and 414 deletions
+78 -22
View File
@@ -3,16 +3,16 @@ mod diagnose;
mod launcher;
mod proton;
mod service;
mod setup;
mod tray;
use anyhow::Result;
use clap::{Parser, Subcommand};
use std::path::PathBuf;
/// Battle.net launcher manager for Linux via umu/Proton-GE.
/// Tray-based Wine launcher manager for Linux via umu/Proton-GE.
///
/// Running without a subcommand starts the system tray daemon.
/// Use `launch` in your .desktop shortcut for a direct, no-UI launch.
#[derive(Parser)]
#[command(name = "umutray", version, about)]
struct Cli {
@@ -25,14 +25,32 @@ enum Commands {
/// Start the system tray daemon (default when no subcommand given)
Tray,
/// Launch Battle.net immediately and return — use this in .desktop shortcuts
Launch,
/// Launch a configured launcher
Launch {
/// Launcher name (e.g. battlenet, eaapp, epic)
name: String,
},
/// Gracefully kill all Battle.net / Wine processes
Kill,
/// Kill a specific launcher, or every configured one if no name is given
Kill {
/// Launcher name (omit to kill all)
name: Option<String>,
},
/// Check setup health and report any problems
Diagnose,
/// Run health checks on a specific launcher, or all of them
Diagnose {
/// Launcher name (omit to check all)
name: Option<String>,
},
/// List configured launchers and whether they're installed / running
Launchers,
/// Print setup instructions for a launcher (automated wizard coming soon)
Setup {
/// Launcher name
name: String,
},
/// Download and switch GE-Proton versions
UpdateProton {
@@ -40,7 +58,7 @@ enum Commands {
#[arg(long)]
latest: bool,
/// Install a specific version (e.g. GE-Proton9-20)
/// Install a specific version (e.g. GE-Proton10-34)
#[arg(long, value_name = "VERSION")]
version: Option<String>,
@@ -70,19 +88,15 @@ enum ConfigAction {
Path,
/// Open the config file in $EDITOR
Edit,
/// Update one or more fields non-interactively
/// Update global fields. Use `config edit` for per-launcher changes.
Set {
/// Wine prefix directory
#[arg(long, value_name = "PATH")]
prefix: Option<PathBuf>,
/// Default Proton version (e.g. GE-Proton, GE-Proton10-34)
#[arg(long, value_name = "VERSION")]
proton_version: Option<String>,
/// GE-Proton install directory
#[arg(long, value_name = "PATH")]
compat_dir: Option<PathBuf>,
/// umu GAMEID (used for protonfixes lookup)
#[arg(long, value_name = "ID")]
gameid: Option<String>,
},
}
@@ -102,23 +116,65 @@ fn main() -> Result<()> {
match cli.command.unwrap_or(Commands::Tray) {
Commands::Tray => tray::run(&config)?,
Commands::Launch => launcher::launch(&config)?,
Commands::Kill => launcher::kill()?,
Commands::Diagnose => diagnose::run(&config),
Commands::Launch { name } => {
let l = config.find(&name).ok_or_else(|| {
anyhow::anyhow!("unknown launcher '{name}' — try `umutray launchers`")
})?;
launcher::launch(&config, l)?;
}
Commands::Kill { name } => match name {
Some(n) => {
let l = config.find(&n).ok_or_else(|| {
anyhow::anyhow!("unknown launcher '{n}' — try `umutray launchers`")
})?;
launcher::kill(l)?;
}
None => launcher::kill_all(&config)?,
},
Commands::Diagnose { name } => {
diagnose::run(&config, name.as_deref())?;
}
Commands::Launchers => {
for l in &config.launchers {
let installed = l.full_exe_path().exists();
let running = launcher::is_running(l);
let marker = if installed {
"\x1b[1;32m✓\x1b[0m"
} else {
"·"
};
let state = if running { " (running)" } else { "" };
println!(" {marker} {:12} {}{}", l.name, l.display, state);
}
}
Commands::Setup { name } => {
let l = config.find(&name).ok_or_else(|| {
anyhow::anyhow!("unknown launcher '{name}' — try `umutray launchers`")
})?;
setup::run(&config, l)?;
}
Commands::UpdateProton { latest, version, list } => {
proton::run(&config, latest, version, list)?;
}
Commands::Config { action } => match action {
ConfigAction::Show => config.show()?,
ConfigAction::Path => {
println!("{}", config::Config::config_path()?.display());
}
ConfigAction::Edit => config::Config::edit()?,
ConfigAction::Set { prefix, compat_dir, gameid } => {
ConfigAction::Set { proton_version, compat_dir } => {
let mut c = config;
c.set_fields(prefix, compat_dir, gameid)?;
c.set_globals(proton_version, compat_dir)?;
}
},
Commands::Service { action } => match action {
ServiceAction::Install => service::install()?,
ServiceAction::Uninstall => service::uninstall()?,