Skip to content

Commit

Permalink
Merge pull request #558 from pascalbreuninger/main
Browse files Browse the repository at this point in the history
fix(ui): intel macos build
  • Loading branch information
pascalbreuninger authored Jul 23, 2023
2 parents eb7f2dd + a146bed commit 0032603
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions desktop/src-tauri/src/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,23 @@ impl WindowHelper {
msg_send![class!(NSRunningApplication), currentApplication]
}

unsafe fn is_current_app_active() -> bool {
let current_app = Self::get_current_application();
#[cfg(not(target_arch = "aarch64"))]
{
let is_active: BOOL = msg_send![current_app, isActive];

return is_active == cocoa::base::YES;
}

#[cfg(target_arch = "aarch64")]
{
let is_active: BOOL = msg_send![current_app, isActive];

return is_active;
}
}

pub fn set_dock_icon_visibility(&self, visible: bool) {
unsafe {
let psn = ProcessSerialNumber {
Expand All @@ -112,7 +129,7 @@ impl WindowHelper {
return;
}

let is_active: BOOL = msg_send![Self::get_current_application(), isActive];
let is_active = Self::is_current_app_active();
if is_active {
let application_id = NSString::alloc(nil).init_str("com.apple.dock");
let running_applications: id = msg_send![
Expand All @@ -127,7 +144,6 @@ impl WindowHelper {
];
break;
}
let is_active: BOOL = msg_send![Self::get_current_application(), isActive];

Queue::main().exec_after(Duration::from_millis(1), move || {
let result = TransformProcessType(
Expand Down

0 comments on commit 0032603

Please sign in to comment.