Initial commit: battlenet-manager tray daemon and CLI

This commit is contained in:
funman300
2026-04-16 13:28:17 -07:00
commit 1559ee5f2b
7 changed files with 791 additions and 0 deletions
+66
View File
@@ -0,0 +1,66 @@
mod config;
mod diagnose;
mod launcher;
mod proton;
mod tray;
use anyhow::Result;
use clap::{Parser, Subcommand};
/// Battle.net 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 = "battlenet-manager", version, about)]
struct Cli {
#[command(subcommand)]
command: Option<Commands>,
}
#[derive(Subcommand)]
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,
/// Gracefully kill all Battle.net / Wine processes
Kill,
/// Check setup health and report any problems
Diagnose,
/// Download and switch GE-Proton versions
UpdateProton {
/// Install the latest release automatically
#[arg(long)]
latest: bool,
/// Install a specific version (e.g. GE-Proton9-20)
#[arg(long, value_name = "VERSION")]
version: Option<String>,
/// List recent releases and exit
#[arg(long)]
list: bool,
},
}
fn main() -> Result<()> {
let cli = Cli::parse();
let config = config::Config::load()?;
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::UpdateProton { latest, version, list } => {
proton::run(&config, latest, version, list)?;
}
}
Ok(())
}