Enable transparent macOS window and UI tweaks
Enable macOS private API and make the app window transparent. Add tauri feature and tauri.conf settings (macOSPrivateApi + transparent) and call set_background_color in setup to use an RGBA transparent background. Adjust CSS so body is transparent, add --radius-window, and move app background to #app/.layout with border-radius and overflow hidden to preserve rounded transparent window styling.
This commit is contained in:
@@ -27,6 +27,7 @@
|
|||||||
/* Shape */
|
/* Shape */
|
||||||
--radius-md: 7px;
|
--radius-md: 7px;
|
||||||
--radius-lg: 11px;
|
--radius-lg: 11px;
|
||||||
|
--radius-window: 14px;
|
||||||
--shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
|
--shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -58,7 +59,7 @@ body {
|
|||||||
margin: 0;
|
margin: 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
background: var(--bg-app);
|
background: transparent;
|
||||||
color: var(--text-main);
|
color: var(--text-main);
|
||||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Helvetica, Arial, sans-serif;
|
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Helvetica, Arial, sans-serif;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
|
|||||||
@@ -3,6 +3,9 @@
|
|||||||
#app {
|
#app {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
overflow: hidden;
|
||||||
|
border-radius: var(--radius-window);
|
||||||
|
background: var(--bg-app);
|
||||||
}
|
}
|
||||||
|
|
||||||
.layout {
|
.layout {
|
||||||
@@ -11,6 +14,7 @@
|
|||||||
grid-template-columns: 320px minmax(0, 1fr);
|
grid-template-columns: 320px minmax(0, 1fr);
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
background: var(--bg-app);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ── Sidebar ──────────────────────────────────────────────────────────────── */
|
/* ── Sidebar ──────────────────────────────────────────────────────────────── */
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ crate-type = ["staticlib", "cdylib", "rlib"]
|
|||||||
tauri-build = { version = "2", features = [] }
|
tauri-build = { version = "2", features = [] }
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
tauri = { version = "2", features = [] }
|
tauri = { version = "2", features = ["macos-private-api"] }
|
||||||
tauri-plugin-opener = "2"
|
tauri-plugin-opener = "2"
|
||||||
serde = { version = "1", features = ["derive"] }
|
serde = { version = "1", features = ["derive"] }
|
||||||
serde_json = "1"
|
serde_json = "1"
|
||||||
|
|||||||
@@ -1832,6 +1832,14 @@ pub fn run() {
|
|||||||
tauri::Builder::default()
|
tauri::Builder::default()
|
||||||
.plugin(tauri_plugin_dialog::init())
|
.plugin(tauri_plugin_dialog::init())
|
||||||
.plugin(tauri_plugin_opener::init())
|
.plugin(tauri_plugin_opener::init())
|
||||||
|
.setup(|app| {
|
||||||
|
use tauri::Manager;
|
||||||
|
if let Some(window) = app.get_webview_window("main") {
|
||||||
|
let _ = window
|
||||||
|
.set_background_color(Some(tauri::utils::config::Color(0, 0, 0, 0)));
|
||||||
|
}
|
||||||
|
Ok(())
|
||||||
|
})
|
||||||
.invoke_handler(tauri::generate_handler![
|
.invoke_handler(tauri::generate_handler![
|
||||||
git_clone,
|
git_clone,
|
||||||
git_pull,
|
git_pull,
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
},
|
},
|
||||||
"app": {
|
"app": {
|
||||||
"withGlobalTauri": true,
|
"withGlobalTauri": true,
|
||||||
|
"macOSPrivateApi": true,
|
||||||
"windows": [
|
"windows": [
|
||||||
{
|
{
|
||||||
"title": "Gitpub Desktop",
|
"title": "Gitpub Desktop",
|
||||||
@@ -15,7 +16,8 @@
|
|||||||
"height": 860,
|
"height": 860,
|
||||||
"minWidth": 1024,
|
"minWidth": 1024,
|
||||||
"minHeight": 680,
|
"minHeight": 680,
|
||||||
"decorations": false
|
"decorations": false,
|
||||||
|
"transparent": true
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"security": {
|
"security": {
|
||||||
|
|||||||
Reference in New Issue
Block a user