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; } }