From a0d5a9282315918c0543ee9294a260ffe6ac58cc Mon Sep 17 00:00:00 2001 From: Luis Garcia Date: Wed, 23 Oct 2024 02:23:56 +0000 Subject: [PATCH] tanoshi-tauri: Hide title bar on phosh --- crates/tanoshi-tauri/src/main.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/crates/tanoshi-tauri/src/main.rs b/crates/tanoshi-tauri/src/main.rs index c3482b84..427d980a 100644 --- a/crates/tanoshi-tauri/src/main.rs +++ b/crates/tanoshi-tauri/src/main.rs @@ -4,6 +4,8 @@ )] extern crate log; +use std::env; +use tauri::Manager; mod server; @@ -23,6 +25,21 @@ fn main() { .plugin(tauri_plugin_clipboard_manager::init()) .plugin(tauri_plugin_fs::init()) .plugin(Server::new()) + .setup(|app| { + let window = app.get_webview_window("main").unwrap(); + + // Check if running on Phosh + if let Ok(session) = env::var("XDG_SESSION_DESKTOP") { + println!("Session: {}", session); + if session == "phosh" { + // Hide title bar if running on Phosh + window.set_decorations(false).unwrap(); + } else { + window.set_decorations(true).unwrap(); + } + } + Ok(()) + }) .run(tauri::generate_context!()) .expect("error while running tauri application"); }