From 0e79c05df35013a1b83760bfafc8c18e2c50d20c Mon Sep 17 00:00:00 2001 From: vndangkhoa Date: Wed, 24 Jun 2026 20:45:23 +0700 Subject: [PATCH] Optimize tray startup disk write and clean up settings UI targets in Makefile --- Makefile | 20 ++++---------------- ui/src/tray.rs | 8 ++++++-- 2 files changed, 10 insertions(+), 18 deletions(-) diff --git a/Makefile b/Makefile index d6b6c7c..973fd19 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -.PHONY: build build-x11 build-wayland build-all build-ui build-tray test test-cli run run-x11 run-wayland clean install install-x11 install-wayland install-ui install-tray install-all-ui install-config appimage fmt lint tree +.PHONY: build build-x11 build-wayland build-all build-ui test test-cli run run-x11 run-wayland clean install install-x11 install-wayland install-ui install-config appimage fmt lint tree # Build core crates build: @@ -16,13 +16,9 @@ build-wayland: build-all: cargo build --release --features "x11,wayland" -# Build settings UI (requires GTK4 + libadwaita) +# Build tray icon UI (requires libdbus-1-dev) build-ui: - cd ui && cargo build --release --bin vietc-settings - -# Build tray icon app (requires libdbus-1-dev) -build-tray: - cd ui && cargo build --release --bin vietc-tray + cd ui && cargo build --release # Build debug build-dev: @@ -69,19 +65,11 @@ install-wayland: build-wayland sudo cp target/release/vietc /usr/local/bin/vietc @echo "Installed vietc (with Wayland IM) to /usr/local/bin/" -# Install settings UI +# Install tray icon UI install-ui: build-ui - sudo cp ui/target/release/vietc-settings /usr/local/bin/vietc-settings - @echo "Installed vietc-settings to /usr/local/bin/" - -# Install tray icon app -install-tray: build-tray sudo cp ui/target/release/vietc-tray /usr/local/bin/vietc-tray @echo "Installed vietc-tray to /usr/local/bin/" -# Install all UI binaries -install-all-ui: install-ui install-tray - # Install config to user dir install-config: mkdir -p ~/.config/vietc diff --git a/ui/src/tray.rs b/ui/src/tray.rs index b2a9a23..d643ddf 100644 --- a/ui/src/tray.rs +++ b/ui/src/tray.rs @@ -32,15 +32,19 @@ fn ensure_icons() { let vn_path = icons_dir.join("vietc-vn.svg"); let en_path = icons_dir.join("vietc-en.svg"); - let _ = std::fs::write(&vn_path, r##" + if !vn_path.exists() { + let _ = std::fs::write(&vn_path, r##" VN "##); + } - let _ = std::fs::write(&en_path, r##" + if !en_path.exists() { + let _ = std::fs::write(&en_path, r##" EN "##); + } } struct VietTray {