File tree Expand file tree Collapse file tree 2 files changed +13
-4
lines changed
apps/desktop/src-tauri/src Expand file tree Collapse file tree 2 files changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -22,12 +22,12 @@ use tray::Tray;
22
22
use window_custom:: WindowExt ;
23
23
24
24
#[ cfg( target_os = "macos" ) ]
25
- use tauri:: { App , Window } ;
25
+ use tauri:: Window ;
26
26
27
27
pub struct Pinned ( AtomicBool ) ;
28
28
29
29
#[ cfg( target_os = "macos" ) ]
30
- fn apply_macos_specifics ( _app : & mut App , window : & Window ) {
30
+ fn apply_macos_specifics ( window : & Window ) {
31
31
window. set_visisble_on_all_workspaces ( true ) ;
32
32
window. set_transparent_titlebar ( true , true ) ;
33
33
}
@@ -51,6 +51,7 @@ fn main() {
51
51
let settings = app. get_window ( SETTINGS_WINDOW_NAME ) . unwrap ( ) ;
52
52
53
53
// the window should always be on top
54
+ #[ cfg( not( target_os = "macos" ) ) ]
54
55
window. set_always_on_top ( true ) ;
55
56
56
57
// set the document title for the main window
@@ -66,7 +67,7 @@ fn main() {
66
67
67
68
// add mac things
68
69
#[ cfg( target_os = "macos" ) ]
69
- apply_macos_specifics ( app , & window) ;
70
+ apply_macos_specifics ( & window) ;
70
71
71
72
// Open dev tools only when in dev mode
72
73
#[ cfg( debug_assertions) ]
Original file line number Diff line number Diff line change @@ -4,6 +4,9 @@ use cocoa::appkit::{
4
4
NSWindowTitleVisibility ,
5
5
} ;
6
6
7
+ #[ cfg( target_os = "macos" ) ]
8
+ use cocoa:: foundation:: NSInteger ;
9
+
7
10
#[ cfg( target_os = "macos" ) ]
8
11
use objc:: runtime:: YES ;
9
12
@@ -12,6 +15,9 @@ use cocoa::base::id;
12
15
13
16
use tauri:: { Runtime , Window } ;
14
17
18
+ #[ cfg( target_os = "macos" ) ]
19
+ use objc:: msg_send;
20
+
15
21
pub trait WindowExt {
16
22
#[ cfg( target_os = "macos" ) ]
17
23
fn set_transparent_titlebar ( & self , title_transparent : bool , remove_toolbar : bool ) ;
@@ -24,10 +30,12 @@ impl<R: Runtime> WindowExt for Window<R> {
24
30
#[ cfg( target_os = "macos" ) ]
25
31
fn set_visisble_on_all_workspaces ( & self , enabled : bool ) {
26
32
{
33
+ const HIGHER_LEVEL_THAN_LEAGUE : NSInteger = 1001 ;
27
34
let ns_win = self . ns_window ( ) . unwrap ( ) as id ;
35
+
28
36
unsafe {
29
37
if enabled {
30
- ns_win. setLevel_ ( ( ( NSMainMenuWindowLevel + 1 ) as u64 ) . try_into ( ) . unwrap ( ) ) ;
38
+ ns_win. setLevel_ ( HIGHER_LEVEL_THAN_LEAGUE ) ;
31
39
ns_win. setCollectionBehavior_ (
32
40
NSWindowCollectionBehavior :: NSWindowCollectionBehaviorCanJoinAllSpaces ,
33
41
) ;
You can’t perform that action at this time.
0 commit comments