refactor: apply CLAUDE.md code quality improvements and add packaging

- Add #![forbid(unsafe_code)] to main.rs (issue #3)
- Replace raw ANSI escape codes with owo-colors crate (issue #2)
- Replace manual HOME path construction with dirs::home_dir() (issue #5)
- Ship umutray.service as a static file; service::install() substitutes
  the binary path at install time instead of generating the unit at runtime
- Add packaging/PKGBUILD following Arch Rust package guidelines
- Add CLAUDE.md tracking refactor tasks
- setup.rs: clean up downloaded temp files on abort/back, save launcher
  to config only after successful install, auto-start download when a
  preset has an installer_url
- util.rs: add pick_folder() using zenity/kdialog subprocesses (no rfd)
- config.rs: populate installer_url for all 6 built-in presets with
  official download URLs
- Document the Option<Option<Vec<String>>> gamescope pattern at main.rs:307

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
funman300
2026-04-18 19:28:10 -07:00
parent f2f584febf
commit 9b7e474e80
11 changed files with 233 additions and 57 deletions
+9 -9
View File
@@ -1,5 +1,6 @@
use crate::config::Config;
use anyhow::Result;
use owo_colors::OwoColorize;
use std::collections::HashMap;
use std::path::{Path, PathBuf};
@@ -135,7 +136,7 @@ fn print_findings(config: &Config, by_launcher: &HashMap<String, Vec<PathBuf>>)
println!(" · {:12} not found", l.name);
}
Some(matches) if matches.len() > 1 => {
println!(" \x1b[33m⚠\x1b[0m {:12} multiple prefixes:", l.name);
println!(" {} {:12} multiple prefixes:", "".yellow(), l.name);
for p in matches {
println!(" {}", p.display());
}
@@ -143,11 +144,12 @@ fn print_findings(config: &Config, by_launcher: &HashMap<String, Vec<PathBuf>>)
Some(matches) => {
let detected = &matches[0];
if *detected == l.prefix_dir {
println!(" \x1b[1;32m✓\x1b[0m {:12} {}", l.name, detected.display());
println!(" {} {:12} {}", "".green().bold(), l.name, detected.display());
} else {
any_divergent = true;
println!(
" \x1b[36m→\x1b[0m {:12} {} (was {})",
" {} {:12} {} (was {})",
"".cyan(),
l.name,
detected.display(),
l.prefix_dir.display()
@@ -171,19 +173,17 @@ fn apply_findings(config: &Config, by_launcher: &HashMap<String, Vec<PathBuf>>)
};
if matches.len() > 1 {
ambiguous += 1;
println!(
" \x1b[33m⚠\x1b[0m {:12} ambiguous — update via `config edit`",
l.name
);
println!(" {} {:12} ambiguous — update via `config edit`", "".yellow(), l.name);
continue;
}
let detected = &matches[0];
if *detected == l.prefix_dir {
println!(" \x1b[1;32m✓\x1b[0m {:12} unchanged", l.name);
println!(" {} {:12} unchanged", "".green().bold(), l.name);
continue;
}
println!(
" \x1b[1;32m→\x1b[0m {:12} {}{}",
" {} {:12} {}{}",
"".green().bold(),
l.name,
l.prefix_dir.display(),
detected.display()