Skip to content

Commit

Permalink
only change activation policy if it's not already set
Browse files Browse the repository at this point in the history
  • Loading branch information
tobihagemann committed Sep 19, 2023
1 parent 45c5a8c commit 7a21c09
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,15 @@

JNIEXPORT void JNICALL Java_org_cryptomator_macos_tray_ActivationPolicy_00024Native_transformToAccessory
(JNIEnv *env, jobject thisObj) {
[NSApp setActivationPolicy:NSApplicationActivationPolicyAccessory];
if (NSApp.activationPolicy != NSApplicationActivationPolicyAccessory) {
[NSApp setActivationPolicy:NSApplicationActivationPolicyAccessory];
}
}

JNIEXPORT void JNICALL Java_org_cryptomator_macos_tray_ActivationPolicy_00024Native_transformToRegular
(JNIEnv *env, jobject thisObj) {
[NSApp activateIgnoringOtherApps:YES];
[NSApp setActivationPolicy:NSApplicationActivationPolicyRegular];
if (NSApp.activationPolicy != NSApplicationActivationPolicyRegular) {
[NSApp activateIgnoringOtherApps:YES];
[NSApp setActivationPolicy:NSApplicationActivationPolicyRegular];
}
}

0 comments on commit 7a21c09

Please sign in to comment.