From 394d92e756801d84c3185a77a87177b98775c0a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mirek=20Wr=C3=B3bel?= Date: Thu, 15 Oct 2026 12:14:01 +0200 Subject: [PATCH] Start git without a console window on Windows, and run one reload at a time --- src-tauri/src/git.rs | 17 +++++++++++------ src/App.vue | 7 +++++++ 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/src-tauri/src/git.rs b/src-tauri/src/git.rs index e96ba3b..563c8fe 100644 --- a/src-tauri/src/git.rs +++ b/src-tauri/src/git.rs @@ -32,12 +32,17 @@ pub struct RepoData { } pub fn git(dir: &Path, args: &[&str]) -> Result { - let out = Command::new("git") - .arg("-C") - .arg(dir) - .args(args) - .output() - .map_err(|e| format!("could not run git: {e}"))?; + let mut cmd = Command::new("git"); + cmd.arg("-C").arg(dir).args(args); + // gites has no console, so Windows would open a console window for every git it + // starts. Each one flashes on screen and takes the focus, and gites reloads on focus. + #[cfg(windows)] + { + use std::os::windows::process::CommandExt; + const CREATE_NO_WINDOW: u32 = 0x0800_0000; + cmd.creation_flags(CREATE_NO_WINDOW); + } + let out = cmd.output().map_err(|e| format!("could not run git: {e}"))?; if !out.status.success() { return Err(String::from_utf8_lossy(&out.stderr).trim().to_string()); } diff --git a/src/App.vue b/src/App.vue index 8955808..153c343 100644 --- a/src/App.vue +++ b/src/App.vue @@ -105,11 +105,18 @@ function startDrag(e: PointerEvent, axis: "x" | "y") { let filtersLoadedFor: string | null = null; +let loading = false; + async function load() { + // The window gets focus often; one reload at a time is enough. + if (loading) return; + loading = true; try { await applyRepo(await invoke("load_repo")); } catch (e) { error.value = String(e); + } finally { + loading = false; } }