Browse Source

Change only if activation policy is different.

pull/92/head
Abhishek 5 years ago
parent
commit
2cc37f3eee
  1. 4
      Clocker/AppDelegate.swift

4
Clocker/AppDelegate.swift

@ -160,9 +160,13 @@ open class AppDelegate: NSObject, NSApplicationDelegate {
private func setActivationPolicy() { private func setActivationPolicy() {
let defaults = UserDefaults.standard let defaults = UserDefaults.standard
let currentActivationPolicy = NSRunningApplication.current.activationPolicy
let activationPolicy: NSApplication.ActivationPolicy = defaults.integer(forKey: CLAppDislayOptions) == 0 ? .accessory : .regular let activationPolicy: NSApplication.ActivationPolicy = defaults.integer(forKey: CLAppDislayOptions) == 0 ? .accessory : .regular
if currentActivationPolicy != activationPolicy {
NSApp.setActivationPolicy(activationPolicy) NSApp.setActivationPolicy(activationPolicy)
} }
}
private func checkIfAppIsAlreadyOpen() { private func checkIfAppIsAlreadyOpen() {
guard let bundleID = Bundle.main.bundleIdentifier else { guard let bundleID = Bundle.main.bundleIdentifier else {

Loading…
Cancel
Save