Skip to content

Commit

Permalink
dont guard on notification name as not needed
Browse files Browse the repository at this point in the history
  • Loading branch information
erikng committed May 23, 2022
1 parent ec6323f commit 068f1b3
Showing 1 changed file with 12 additions and 14 deletions.
26 changes: 12 additions & 14 deletions Nudge/UI/Main.swift
Expand Up @@ -117,20 +117,18 @@ class AppDelegate: NSObject, NSApplicationDelegate {
return
}
utilsLog.info("\("Application launched", privacy: .public)")
if notification.name == NSWorkspace.didLaunchApplicationNotification {
for runningApplication in NSWorkspace.shared.runningApplications {
let appBundleID = runningApplication.bundleIdentifier ?? ""
let appName = runningApplication.localizedName ?? ""
if appBundleID == "com.github.macadmins.Nudge" {
continue
}
if blockedApplicationBundleIDs.contains(appBundleID) {
utilsLog.info("\("Found \(appName), terminating application", privacy: .public)")
scheduleLocal(applicationIdentifier: appName)
DispatchQueue.main.asyncAfter(deadline: .now() + 0.001, execute: {
runningApplication.forceTerminate()
})
}
for runningApplication in NSWorkspace.shared.runningApplications {
let appBundleID = runningApplication.bundleIdentifier ?? ""
let appName = runningApplication.localizedName ?? ""
if appBundleID == "com.github.macadmins.Nudge" {
continue
}
if blockedApplicationBundleIDs.contains(appBundleID) {
utilsLog.info("\("Found \(appName), terminating application", privacy: .public)")
scheduleLocal(applicationIdentifier: appName)
DispatchQueue.main.asyncAfter(deadline: .now() + 0.001, execute: {
runningApplication.forceTerminate()
})
}
}
}
Expand Down

0 comments on commit 068f1b3

Please sign in to comment.