diff --git a/Cargo.lock b/Cargo.lock index c0fcc29..8102a63 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -90,20 +90,6 @@ version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" -[[package]] -name = "battlenet-manager" -version = "0.1.0" -dependencies = [ - "anyhow", - "clap 4.6.1", - "directories", - "ksni", - "reqwest", - "serde", - "serde_json", - "toml", -] - [[package]] name = "bitflags" version = "1.3.2" @@ -1530,6 +1516,20 @@ version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" +[[package]] +name = "umutray" +version = "0.1.0" +dependencies = [ + "anyhow", + "clap 4.6.1", + "directories", + "ksni", + "reqwest", + "serde", + "serde_json", + "toml", +] + [[package]] name = "unicode-ident" version = "1.0.24" diff --git a/Cargo.toml b/Cargo.toml index 3400059..bfbc4b1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,11 +1,11 @@ [package] -name = "battlenet-manager" +name = "umutray" version = "0.1.0" edition = "2021" description = "Battle.net launcher manager for Linux via umu/Proton-GE" [[bin]] -name = "battlenet-manager" +name = "umutray" path = "src/main.rs" [dependencies] diff --git a/README.md b/README.md index 72ff2ac..1fa4af0 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# battlenet-manager +# umutray A small system-tray daemon and CLI for running the Battle.net launcher on Linux via [umu-launcher](https://github.com/Open-Wine-Components/umu-launcher) @@ -18,7 +18,7 @@ and [GE-Proton](https://github.com/GloriousEggroll/proton-ge-custom). ```sh cargo build --release -install -Dm755 target/release/battlenet-manager ~/.local/bin/battlenet-manager +install -Dm755 target/release/umutray ~/.local/bin/umutray ``` Requires `umu-launcher` and `tar` on PATH. On Arch: @@ -33,25 +33,25 @@ first launch. ## Usage -| Command | What it does | -| --------------------------------- | -------------------------------------------------------- | -| `battlenet-manager` | Start the tray daemon (default) | -| `battlenet-manager launch` | Launch Battle.net and return (for `.desktop` shortcuts) | -| `battlenet-manager kill` | SIGTERM → wait 3 s → SIGKILL on all Battle.net procs | -| `battlenet-manager diagnose` | Run environment health checks | -| `battlenet-manager update-proton` | Interactive GE-Proton picker | -| `update-proton --latest` | Install newest GE-Proton release | -| `update-proton --version X` | Install a specific tag (e.g. `GE-Proton10-34`) | -| `update-proton --list` | Show recent releases without installing | -| `config show` / `config path` | Print current config or its path | -| `config edit` | Open config in `$EDITOR` | -| `config set --prefix PATH` | Change the Wine prefix (also `--compat-dir`, `--gameid`) | -| `service install` | Write + enable a `systemd --user` unit for autostart | -| `service uninstall` / `status` | Remove the unit / show its status | +| Command | What it does | +| ------------------------------ | -------------------------------------------------------- | +| `umutray` | Start the tray daemon (default) | +| `umutray launch` | Launch Battle.net and return (for `.desktop` shortcuts) | +| `umutray kill` | SIGTERM → wait 3 s → SIGKILL on all Battle.net procs | +| `umutray diagnose` | Run environment health checks | +| `umutray update-proton` | Interactive GE-Proton picker | +| `update-proton --latest` | Install newest GE-Proton release | +| `update-proton --version X` | Install a specific tag (e.g. `GE-Proton10-34`) | +| `update-proton --list` | Show recent releases without installing | +| `config show` / `config path` | Print current config or its path | +| `config edit` | Open config in `$EDITOR` | +| `config set --prefix PATH` | Change the Wine prefix (also `--compat-dir`, `--gameid`) | +| `service install` | Write + enable a `systemd --user` unit for autostart | +| `service uninstall` / `status` | Remove the unit / show its status | ## Config -Lives at `~/.config/battlenet-manager/config.toml`, written with defaults on +Lives at `~/.config/umutray/config.toml`, written with defaults on first run: ```toml diff --git a/src/config.rs b/src/config.rs index 17bac9a..0df6374 100644 --- a/src/config.rs +++ b/src/config.rs @@ -37,7 +37,7 @@ fn home_dir() -> PathBuf { impl Config { pub fn config_path() -> Result { - let dirs = ProjectDirs::from("co.aleshym", "", "battlenet-manager") + let dirs = ProjectDirs::from("co.aleshym", "", "umutray") .context("Could not determine config directory")?; Ok(dirs.config_dir().join("config.toml")) } diff --git a/src/diagnose.rs b/src/diagnose.rs index db2347d..470b036 100644 --- a/src/diagnose.rs +++ b/src/diagnose.rs @@ -58,7 +58,7 @@ pub fn run(config: &Config) { if age > 300 { checks.push(Check::fail( "agent.lock", - format!("stale lock ({age}s old) — may cause BLZBNTBNA00000005; run: battlenet-manager kill"), + format!("stale lock ({age}s old) — may cause BLZBNTBNA00000005; run: umutray kill"), )); issues += 1; } else { @@ -108,7 +108,7 @@ pub fn run(config: &Config) { checks.push(Check::fail( "proton", format!( - "{} not found — run: battlenet-manager update-proton --version={}", + "{} not found — run: umutray update-proton --version={}", config.proton_version, config.proton_version ), )); diff --git a/src/launcher.rs b/src/launcher.rs index fc4a8d2..498556d 100644 --- a/src/launcher.rs +++ b/src/launcher.rs @@ -63,8 +63,9 @@ pub fn kill() -> Result<()> { /// Returns true if any Battle.net process is currently running. pub fn is_running() -> bool { - // Escape the dot — unescaped, "battle.net" also matches our own - // "battlenet-manager" binary and reports a false positive. + // Escape the dot — unescaped, "battle.net" would regex-match literally + // any process with "battlenet" in its cmdline (including this binary if + // it were ever renamed back to battlenet-*). std::process::Command::new("pgrep") .args(["-fi", "Battle\\.net"]) .stdout(std::process::Stdio::null()) diff --git a/src/main.rs b/src/main.rs index d600241..2600ee7 100644 --- a/src/main.rs +++ b/src/main.rs @@ -14,7 +14,7 @@ use std::path::PathBuf; /// 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)] +#[command(name = "umutray", version, about)] struct Cli { #[command(subcommand)] command: Option, diff --git a/src/proton.rs b/src/proton.rs index 6ebab65..1d429e8 100644 --- a/src/proton.rs +++ b/src/proton.rs @@ -20,7 +20,7 @@ struct Asset { fn http_client() -> Result { reqwest::blocking::Client::builder() - .user_agent("battlenet-manager/0.1") + .user_agent("umutray/0.1") .build() .context("Failed to build HTTP client") } diff --git a/src/service.rs b/src/service.rs index 33647d8..826f23f 100644 --- a/src/service.rs +++ b/src/service.rs @@ -2,7 +2,7 @@ use anyhow::{bail, Context, Result}; use std::path::PathBuf; use std::process::Command; -const UNIT_NAME: &str = "battlenet-manager.service"; +const UNIT_NAME: &str = "umutray.service"; fn unit_path() -> Result { let home = std::env::var("HOME").context("$HOME is not set")?; diff --git a/src/tray.rs b/src/tray.rs index eda6d57..8aabf96 100644 --- a/src/tray.rs +++ b/src/tray.rs @@ -14,7 +14,7 @@ pub struct BattlenetTray { impl ksni::Tray for BattlenetTray { fn id(&self) -> String { - "battlenet-manager".into() + "umutray".into() } fn icon_name(&self) -> String { @@ -80,7 +80,7 @@ impl ksni::Tray for BattlenetTray { icon_name: "media-playback-start".into(), activate: Box::new(|this: &mut Self| { if let Err(e) = launcher::launch(&this.config) { - eprintln!("battlenet-manager: launch failed: {e}"); + eprintln!("umutray: launch failed: {e}"); } }), ..Default::default() @@ -100,7 +100,7 @@ impl ksni::Tray for BattlenetTray { let config = this.config.clone(); thread::spawn(move || { if let Err(e) = crate::proton::install_latest(&config) { - eprintln!("battlenet-manager: proton update failed: {e}"); + eprintln!("umutray: proton update failed: {e}"); } }); }),