diff --git a/public/splash-icon.png b/public/splash-icon.png new file mode 100644 index 0000000..d16bc87 Binary files /dev/null and b/public/splash-icon.png differ diff --git a/public/splashscreen.html b/public/splashscreen.html new file mode 100644 index 0000000..21fa21c --- /dev/null +++ b/public/splashscreen.html @@ -0,0 +1,276 @@ + + + + + + GitLite + + + + +
+ +
+ GitLite + Starting workspace +
+ +
+ + diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index aadcb98..baee85b 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -19,6 +19,18 @@ use git::{ restore_to_commit, search_code_introductions, stage_files, stash_apply, stash_drop, stash_pop, stash_push, undo_last_commit, unstage_files, }; +use tauri::Manager; + +#[tauri::command] +fn close_splashscreen(app: tauri::AppHandle) { + if let Some(window) = app.get_webview_window("main") { + let _ = window.show(); + let _ = window.set_focus(); + } + if let Some(window) = app.get_webview_window("splashscreen") { + let _ = window.close(); + } +} #[tokio::main] async fn main() { @@ -97,7 +109,8 @@ async fn main() { cred_load, cred_save, cred_delete, - set_sync_badge + set_sync_badge, + close_splashscreen ]) .run(tauri::generate_context!()) .expect("error while running tauri application"); diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index 32a9b8f..741eacb 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -18,8 +18,21 @@ "height": 800, "minWidth": 900, "minHeight": 600, + "visible": false, "decorations": false, "shadow": true + }, + { + "label": "splashscreen", + "url": "splashscreen.html", + "title": "GitLite", + "width": 460, + "height": 420, + "resizable": false, + "decorations": false, + "center": true, + "skipTaskbar": true, + "shadow": true } ], "security": { diff --git a/src/app.css b/src/app.css index 3369e8e..2eeb67c 100644 --- a/src/app.css +++ b/src/app.css @@ -477,8 +477,8 @@ .titlebar-brand { display: flex; align-items: center; - gap: 7px; - padding: 0 14px; + gap: 8px; + padding: 0 13px 0 11px; height: 100%; font-size: 13px; font-weight: 700; @@ -486,7 +486,19 @@ color: var(--color-bar-text); border-right: 1px solid rgba(255,255,255,0.06); } - .titlebar-brand svg { color: #ffd343; filter: drop-shadow(0 0 10px rgba(255,211,67,0.3)); flex-shrink: 0; } + .titlebar-brand-icon { + display: grid; + place-items: center; + width: 24px; + height: 24px; + flex: 0 0 24px; + } + .titlebar-brand-icon img { + width: 24px; + height: 24px; + object-fit: contain; + filter: drop-shadow(0 1px 3px rgba(0,0,0,0.5)); + } .tb-version { margin-left: 1px; diff --git a/src/lib/TitleBar.svelte b/src/lib/TitleBar.svelte index ddc61d5..eb8e2c7 100644 --- a/src/lib/TitleBar.svelte +++ b/src/lib/TitleBar.svelte @@ -3,6 +3,7 @@ import { getVersion } from "@tauri-apps/api/app"; import { getCurrentWindow } from "@tauri-apps/api/window"; import { CloudDownload, Download, FolderOpen, GitBranch, GitCompare, LoaderCircle, Minus, RefreshCw, Search, Settings, Upload, X } from "@lucide/svelte"; + import iconUrl from "../../src-tauri/icons/icon.png"; export let branch: string = ""; export let ahead: number = 0; @@ -44,24 +45,9 @@
- + + + GitLite {#if appVersion} v{appVersion} diff --git a/src/main.ts b/src/main.ts index e45105b..378bdaf 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,4 +1,5 @@ import { mount } from "svelte"; +import { invoke } from "@tauri-apps/api/core"; import App from "./App.svelte"; import "./app.css"; @@ -9,4 +10,10 @@ if (!target) { throw new Error("App target element was not found."); } -export default mount(App, { target }); +const app = mount(App, { target }); + +void invoke("close_splashscreen").catch(() => { + // Browser preview and failed startup paths should keep working without Tauri. +}); + +export default app;