Fix window methods on Linux/Windows

This commit is contained in:
Gregory Schier
2023-04-27 16:27:02 -07:00
parent 2a4889bc01
commit f3ff0b660b
2 changed files with 15 additions and 11 deletions

View File

@@ -23,9 +23,9 @@ use sqlx::sqlite::SqlitePoolOptions;
use sqlx::types::Json; use sqlx::types::Json;
use sqlx::{Pool, Sqlite}; use sqlx::{Pool, Sqlite};
use tauri::regex::Regex; use tauri::regex::Regex;
use tauri::{ #[cfg(target_os = "macos")]
AppHandle, Menu, MenuItem, RunEvent, State, Submenu, TitleBarStyle, Window, WindowUrl, Wry, use tauri::TitleBarStyle;
}; use tauri::{AppHandle, Menu, MenuItem, RunEvent, State, Submenu, Window, WindowUrl, Wry};
use tauri::{CustomMenuItem, Manager, WindowEvent}; use tauri::{CustomMenuItem, Manager, WindowEvent};
use tokio::sync::Mutex; use tokio::sync::Mutex;
@@ -697,7 +697,7 @@ fn create_window(handle: &AppHandle<Wry>, url: Option<&str>) -> Window<Wry> {
let window_num = handle.windows().len(); let window_num = handle.windows().len();
let window_id = format!("wnd_{}_{}", window_num, generate_id(None)); let window_id = format!("wnd_{}_{}", window_num, generate_id(None));
let menu = default_menu.add_submenu(submenu); let menu = default_menu.add_submenu(submenu);
let win = tauri::WindowBuilder::new( let mut win_builder = tauri::WindowBuilder::new(
handle, handle,
window_id, window_id,
WindowUrl::App(url.unwrap_or_default().into()), WindowUrl::App(url.unwrap_or_default().into()),
@@ -711,14 +711,20 @@ fn create_window(handle: &AppHandle<Wry>, url: Option<&str>) -> Window<Wry> {
100.0 + random::<f64>() * 30.0, 100.0 + random::<f64>() * 30.0,
100.0 + random::<f64>() * 30.0, 100.0 + random::<f64>() * 30.0,
) )
.hidden_title(true)
.title(match is_dev() { .title(match is_dev() {
true => "Yaak Dev", true => "Yaak Dev",
false => "Yaak", false => "Yaak",
}) });
.title_bar_style(TitleBarStyle::Overlay)
.build() // Add macOS-only things
.expect("failed to build window"); #[cfg(target_os = "macos")]
{
win_builder = win_builder
.hidden_title(true)
.title_bar_style(TitleBarStyle::Overlay);
}
let win = win_builder.build().expect("failed to build window");
let win2 = win.clone(); let win2 = win.clone();
let handle2 = handle.clone(); let handle2 = handle.clone();

View File

@@ -177,8 +177,6 @@ function HeaderSize({ className, ...props }: HeaderSizeProps) {
className, className,
'h-md pt-[1px] flex items-center w-full pr-3 pl-20 border-b', 'h-md pt-[1px] flex items-center w-full pr-3 pl-20 border-b',
platform?.osType === 'Darwin' && 'pl-20', platform?.osType === 'Darwin' && 'pl-20',
platform?.osType === 'Linux' && 'pr-20',
platform?.osType === 'Windows_NT' && 'pr-20',
)} )}
{...props} {...props}
/> />