diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index 2306b9e3..02886517 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -865,7 +865,6 @@ fn create_window(handle: &AppHandle, url: Option<&str>) -> Window { 100.0 + random::() * 30.0, 100.0 + random::() * 30.0, ) - .decorations(false) // Doesn't seem to work from Rust, here, so we do it in JS .title(handle.package_info().name.to_string()); // Add macOS-only things @@ -874,11 +873,16 @@ fn create_window(handle: &AppHandle, url: Option<&str>) -> Window { win_builder = win_builder .menu(app_menu) .hidden_title(true) - .decoratons(true) - .transparent(false) .title_bar_style(TitleBarStyle::Overlay); } + // Add non-MacOS things + #[cfg(not(target_os = "macos"))] + { + // Doesn't seem to work from Rust, here, so we do it in JS + win_builder = win_builder.decorations(false); + } + let win = win_builder.build().expect("failed to build window"); // Tauri doesn't support shadows when hiding decorations, so we add our own diff --git a/src-web/main.tsx b/src-web/main.tsx index 09b79a0b..0819069d 100644 --- a/src-web/main.tsx +++ b/src-web/main.tsx @@ -1,16 +1,20 @@ -import {StrictMode} from 'react'; -import {createRoot} from 'react-dom/client'; -import {attachConsole} from 'tauri-plugin-log-api'; -import {App} from './components/App'; -import {maybeRestorePathname} from './lib/persistPathname'; +import { StrictMode } from 'react'; +import { createRoot } from 'react-dom/client'; +import { attachConsole } from 'tauri-plugin-log-api'; +import { App } from './components/App'; +import { maybeRestorePathname } from './lib/persistPathname'; import './main.css'; -import {getSettings} from './lib/store'; -import type {Appearance} from './lib/theme/window'; -import {setAppearanceOnDocument} from './lib/theme/window'; -import {appWindow} from "@tauri-apps/api/window"; +import { getSettings } from './lib/store'; +import type { Appearance } from './lib/theme/window'; +import { setAppearanceOnDocument } from './lib/theme/window'; +import { appWindow } from '@tauri-apps/api/window'; +import { type } from '@tauri-apps/api/os'; // Hide decorations here because it doesn't work in Rust for some reason (bug?) -await appWindow.setDecorations(false); +const osType = await type(); +if (osType !== 'Darwin') { + await appWindow.setDecorations(false); +} await attachConsole(); await maybeRestorePathname(); @@ -19,12 +23,12 @@ const settings = await getSettings(); setAppearanceOnDocument(settings.appearance as Appearance); document.addEventListener('keydown', (e) => { - // Don't go back in history on backspace - if (e.key === 'Backspace') e.preventDefault(); + // Don't go back in history on backspace + if (e.key === 'Backspace') e.preventDefault(); }); createRoot(document.getElementById('root') as HTMLElement).render( - - - , + + + , );