Skip to content

Commit

Permalink
Fix window methods on Linux/Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
gschier committed Apr 27, 2023
1 parent 180aa39 commit c51831c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 11 deletions.
24 changes: 15 additions & 9 deletions src-tauri/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ use sqlx::sqlite::SqlitePoolOptions;
use sqlx::types::Json;
use sqlx::{Pool, Sqlite};
use tauri::regex::Regex;
use tauri::{
AppHandle, Menu, MenuItem, RunEvent, State, Submenu, TitleBarStyle, Window, WindowUrl, Wry,
};
#[cfg(target_os = "macos")]
use tauri::TitleBarStyle;
use tauri::{AppHandle, Menu, MenuItem, RunEvent, State, Submenu, Window, WindowUrl, Wry};
use tauri::{CustomMenuItem, Manager, WindowEvent};
use tokio::sync::Mutex;

Expand Down Expand Up @@ -697,7 +697,7 @@ fn create_window(handle: &AppHandle<Wry>, url: Option<&str>) -> Window<Wry> {
let window_num = handle.windows().len();
let window_id = format!("wnd_{}_{}", window_num, generate_id(None));
let menu = default_menu.add_submenu(submenu);
let win = tauri::WindowBuilder::new(
let mut win_builder = tauri::WindowBuilder::new(
handle,
window_id,
WindowUrl::App(url.unwrap_or_default().into()),
Expand All @@ -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,
)
.hidden_title(true)
.title(match is_dev() {
true => "Yaak Dev",
false => "Yaak",
})
.title_bar_style(TitleBarStyle::Overlay)
.build()
.expect("failed to build window");
});

// Add macOS-only things
#[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 handle2 = handle.clone();
Expand Down
2 changes: 0 additions & 2 deletions src-web/components/Workspace.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,6 @@ function HeaderSize({ className, ...props }: HeaderSizeProps) {
className,
'h-md pt-[1px] flex items-center w-full pr-3 pl-20 border-b',
platform?.osType === 'Darwin' && 'pl-20',
platform?.osType === 'Linux' && 'pr-20',
platform?.osType === 'Windows_NT' && 'pr-20',
)}
{...props}
/>
Expand Down

0 comments on commit c51831c

Please sign in to comment.