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
+65
View File
@@ -0,0 +1,65 @@
# Maintainer: funman300 <funman300@gmail.com>
#
# AUR NOTE: This PKGBUILD is kept in the source repo for convenience during
# development. For AUR submission, move it to a separate repository and update
# the `source` array to point to the upstream git URL instead of a local path.
#
# To build locally:
# cd packaging && makepkg -si
#
# To update for AUR, replace the source line with:
# source=("$pkgname::git+https://git.aleshym.co/funman300/umutray.git#tag=v$pkgver")
pkgname=umutray
pkgver=0.1.0
pkgrel=1
pkgdesc='Tray-based Wine launcher manager for Linux via umu/Proton-GE'
arch=('x86_64')
url='https://git.aleshym.co/funman300/umutray'
license=('MIT')
depends=('umu-launcher')
makedepends=('rust' 'cargo')
optdepends=(
'zenity: folder picker in setup wizard (GNOME/GTK)'
'kdialog: folder picker in setup wizard (KDE)'
'gamemode: per-game GameMode support'
'mangohud: per-game MangoHud overlay'
'gamescope: per-game Gamescope compositor'
)
# Build from the local repository. Change to the upstream URL for AUR.
_localrepo="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
source=("$pkgname::git+file://${_localrepo}")
sha256sums=('SKIP')
prepare() {
cd "$pkgname"
export RUSTUP_TOOLCHAIN=stable
cargo fetch --locked --target "$(rustc -vV | sed -n 's/host: //p')"
}
build() {
cd "$pkgname"
export RUSTUP_TOOLCHAIN=stable
export CARGO_TARGET_DIR=target
cargo build --release --locked --offline
}
package() {
cd "$pkgname"
# Binary
install -Dm755 target/release/umutray "$pkgdir/usr/bin/umutray"
# App menu entry (.desktop uses /usr/bin/umutray as the exec path)
install -Dm644 umutray.desktop "$pkgdir/usr/share/applications/umutray.desktop"
sed -i "s|Exec=umutray|Exec=/usr/bin/umutray|" \
"$pkgdir/usr/share/applications/umutray.desktop"
# Systemd user service (static file — no runtime generation needed)
install -Dm644 umutray.service \
"$pkgdir/usr/lib/systemd/user/umutray.service"
# License
install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}