Skip to content

Commit

Permalink
fix: don't observe daemons to avoid infinite loops (closes #170)
Browse files Browse the repository at this point in the history
There is a risk of not showing some windows, like CopyQ, but the reward is less risk of trying to observe some buggy daemon process that will never succeed
  • Loading branch information
lwouis committed Mar 11, 2020
1 parent 6018a53 commit e40f859
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/logic/Applications.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import Cocoa
import ApplicationServices

class Applications {
static var list = [Application]()
Expand Down Expand Up @@ -64,9 +65,7 @@ class Applications {
}

private static func filterApplications(_ apps: [NSRunningApplication]) -> [NSRunningApplication] {
// it would be nice to filter with $0.activationPolicy != .prohibited (see https://stackoverflow.com/a/26002033/2249756)
// however some daemon processes can sometimes create windows, so we can't filter them out (e.g. CopyQ is .prohibited for some reason)
return apps.filter { $0.bundleIdentifier != nil }
return apps.filter { $0.activationPolicy != .prohibited || $0.bundleIdentifier == "io.github.hluk.CopyQ" }
}
}

Expand Down

0 comments on commit e40f859

Please sign in to comment.