Skip to content

Commit

Permalink
Fix Settings window not transparent on macOS
Browse files Browse the repository at this point in the history
  • Loading branch information
ItsEeleeya committed Oct 17, 2024
1 parent 47969ea commit b667fd4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 20 deletions.
10 changes: 0 additions & 10 deletions apps/desktop/auto-imports.d.ts

This file was deleted.

18 changes: 8 additions & 10 deletions apps/desktop/src-tauri/src/windows.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
#![allow(unused_mut)]
use tauri::{AppHandle, Manager, WebviewUrl, WebviewWindow, Wry};

#[cfg(target_os = "macos")]
use tauri_plugin_decorum::WebviewWindowExt;

pub enum CapWindow {
Main,
Settings { page: Option<String> },
Expand Down Expand Up @@ -156,6 +159,9 @@ impl CapWindow {

let window = window_builder.build()?;

#[cfg(target_os = "macos")]
window.make_transparent().ok();

apply_window_chrome(&window);

window
Expand Down Expand Up @@ -198,11 +204,7 @@ impl CapWindow {
let window = window_builder.build()?;

#[cfg(target_os = "macos")]
{
use tauri_plugin_decorum::WebviewWindowExt;

window.make_transparent().ok();
}
window.make_transparent().ok();

window
}
Expand Down Expand Up @@ -239,12 +241,11 @@ impl CapWindow {
#[cfg(target_os = "macos")]
{
use objc2_app_kit::NSScreenSaverWindowLevel;
use tauri_plugin_decorum::WebviewWindowExt;

window
.set_window_level(NSScreenSaverWindowLevel as u32)
.unwrap();
window.make_transparent().unwrap();
window.make_transparent().ok();
}

window
Expand Down Expand Up @@ -308,7 +309,6 @@ impl CapWindow {

#[cfg(target_os = "macos")]
{
use tauri_plugin_decorum::WebviewWindowExt;
window.make_transparent().ok();

app.run_on_main_thread({
Expand Down Expand Up @@ -360,7 +360,6 @@ impl CapWindow {

#[cfg(target_os = "macos")]
{
use tauri_plugin_decorum::WebviewWindowExt;
window.create_overlay_titlebar().unwrap();
window.set_traffic_lights_inset(20.0, 48.0).unwrap();
}
Expand Down Expand Up @@ -470,7 +469,6 @@ impl CapWindow {
fn apply_window_chrome(window: &WebviewWindow<Wry>) {
#[cfg(target_os = "macos")]
{
use tauri_plugin_decorum::WebviewWindowExt;
window.create_overlay_titlebar().unwrap();
window.set_traffic_lights_inset(14.0, 22.0).unwrap();
}
Expand Down

0 comments on commit b667fd4

Please sign in to comment.