fix: titlebar on windows
This commit is contained in:
@@ -26,6 +26,7 @@
|
|||||||
"core:window:allow-set-size",
|
"core:window:allow-set-size",
|
||||||
"core:window:allow-set-focus",
|
"core:window:allow-set-focus",
|
||||||
"core:window:allow-start-dragging",
|
"core:window:allow-start-dragging",
|
||||||
|
"core:window:allow-toggle-maximize",
|
||||||
"decorum:allow-show-snap-overlay",
|
"decorum:allow-show-snap-overlay",
|
||||||
"prevent-default:default",
|
"prevent-default:default",
|
||||||
"updater:default",
|
"updater:default",
|
||||||
|
|||||||
@@ -73,10 +73,6 @@ fn main() {
|
|||||||
let handle = app.handle();
|
let handle = app.handle();
|
||||||
let main_window = app.get_webview_window("main").unwrap();
|
let main_window = app.get_webview_window("main").unwrap();
|
||||||
|
|
||||||
// Open devtools
|
|
||||||
#[cfg(debug_assertions)]
|
|
||||||
main_window.open_devtools();
|
|
||||||
|
|
||||||
// Set custom decoration
|
// Set custom decoration
|
||||||
#[cfg(target_os = "windows")]
|
#[cfg(target_os = "windows")]
|
||||||
main_window.create_overlay_titlebar().unwrap();
|
main_window.create_overlay_titlebar().unwrap();
|
||||||
@@ -85,7 +81,7 @@ fn main() {
|
|||||||
#[cfg(target_os = "macos")]
|
#[cfg(target_os = "macos")]
|
||||||
main_window.set_traffic_lights_inset(12.0, 18.0).unwrap();
|
main_window.set_traffic_lights_inset(12.0, 18.0).unwrap();
|
||||||
|
|
||||||
// Workaround for reset traffic light when window resized
|
// Workaround for reset traffic light when theme changed
|
||||||
#[cfg(target_os = "macos")]
|
#[cfg(target_os = "macos")]
|
||||||
let win_ = main_window.clone();
|
let win_ = main_window.clone();
|
||||||
#[cfg(target_os = "macos")]
|
#[cfg(target_os = "macos")]
|
||||||
@@ -165,9 +161,8 @@ fn main() {
|
|||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
})
|
})
|
||||||
.enable_macos_default_menu(false)
|
.plugin(prevent_default())
|
||||||
.plugin(tauri_plugin_fs::init())
|
.plugin(tauri_plugin_fs::init())
|
||||||
.plugin(tauri_plugin_prevent_default::init())
|
|
||||||
.plugin(tauri_plugin_process::init())
|
.plugin(tauri_plugin_process::init())
|
||||||
.plugin(tauri_plugin_updater::Builder::new().build())
|
.plugin(tauri_plugin_updater::Builder::new().build())
|
||||||
.plugin(tauri_plugin_os::init())
|
.plugin(tauri_plugin_os::init())
|
||||||
@@ -179,3 +174,17 @@ fn main() {
|
|||||||
.run(tauri::generate_context!())
|
.run(tauri::generate_context!())
|
||||||
.expect("error while running tauri application");
|
.expect("error while running tauri application");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(debug_assertions)]
|
||||||
|
fn prevent_default() -> tauri::plugin::TauriPlugin<tauri::Wry> {
|
||||||
|
use tauri_plugin_prevent_default::Flags;
|
||||||
|
|
||||||
|
tauri_plugin_prevent_default::Builder::new()
|
||||||
|
.with_flags(Flags::all().difference(Flags::CONTEXT_MENU))
|
||||||
|
.build()
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(not(debug_assertions))]
|
||||||
|
fn prevent_default() -> tauri::plugin::TauriPlugin<tauri::Wry> {
|
||||||
|
tauri_plugin_prevent_default::Builder::new().build()
|
||||||
|
}
|
||||||
|
|||||||
@@ -31,6 +31,14 @@ input::-ms-clear {
|
|||||||
line-height: normal;
|
line-height: normal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
div[data-tauri-decorum-tb] {
|
||||||
|
@apply h-12 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
button.decorum-tb-btn {
|
||||||
|
@apply h-12 !important;
|
||||||
|
}
|
||||||
|
|
||||||
.spinner-leaf {
|
.spinner-leaf {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 0;
|
top: 0;
|
||||||
|
|||||||
@@ -46,13 +46,17 @@ function Screen() {
|
|||||||
|
|
||||||
function Header() {
|
function Header() {
|
||||||
const { account, id } = Route.useParams();
|
const { account, id } = Route.useParams();
|
||||||
|
const { platform } = Route.useRouteContext();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
data-tauri-drag-region
|
data-tauri-drag-region
|
||||||
className="h-12 shrink-0 flex items-center justify-between px-3.5 border-b border-neutral-100 dark:border-neutral-800"
|
className={cn(
|
||||||
|
"h-12 shrink-0 flex items-center justify-between border-b border-neutral-100 dark:border-neutral-800",
|
||||||
|
platform === "windows" ? "pl-3.5 pr-[150px]" : "px-3.5"
|
||||||
|
)}
|
||||||
>
|
>
|
||||||
<div>
|
<div className="z-[200]">
|
||||||
<div className="flex -space-x-1 overflow-hidden">
|
<div className="flex -space-x-1 overflow-hidden">
|
||||||
<User.Provider pubkey={account}>
|
<User.Provider pubkey={account}>
|
||||||
<User.Root className="size-8 rounded-full inline-block ring-2 ring-white dark:ring-neutral-900">
|
<User.Root className="size-8 rounded-full inline-block ring-2 ring-white dark:ring-neutral-900">
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ function Header() {
|
|||||||
<div
|
<div
|
||||||
data-tauri-drag-region
|
data-tauri-drag-region
|
||||||
className={cn(
|
className={cn(
|
||||||
"shrink-0 h-12 flex items-center justify-between",
|
"z-[200] shrink-0 h-12 flex items-center justify-between",
|
||||||
platform === "macos" ? "pl-[78px] pr-3.5" : "px-3.5",
|
platform === "macos" ? "pl-[78px] pr-3.5" : "px-3.5",
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ function Screen() {
|
|||||||
|
|
||||||
if (res.status === "ok") {
|
if (res.status === "ok") {
|
||||||
navigate({
|
navigate({
|
||||||
to: "/$account/chats",
|
to: "/$account/chats/new",
|
||||||
params: { account: res.data },
|
params: { account: res.data },
|
||||||
replace: true,
|
replace: true,
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user