Skip to content

Commit

Permalink
fix: the variable wasLaunchedBeforeAltTab is not initialized correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
刘富兴 committed Mar 29, 2022
1 parent 5d33d3a commit 17642ff
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/logic/Application.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,9 @@ class Application: NSObject {
return n
}

init(_ runningApplication: NSRunningApplication) {
init(_ runningApplication: NSRunningApplication, _ wasLaunchedBeforeAltTab: Bool = false) {
self.runningApplication = runningApplication
self.wasLaunchedBeforeAltTab = wasLaunchedBeforeAltTab
pid = runningApplication.processIdentifier
super.init()
isHidden = runningApplication.isHidden
Expand Down
6 changes: 3 additions & 3 deletions src/logic/Applications.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class Applications {
}

static func addInitialRunningApplications() {
addRunningApplications(NSWorkspace.shared.runningApplications)
addRunningApplications(NSWorkspace.shared.runningApplications, true)
}

static func addInitialRunningApplicationsWindows() {
Expand All @@ -39,10 +39,10 @@ class Applications {
}
}

static func addRunningApplications(_ runningApps: [NSRunningApplication]) {
static func addRunningApplications(_ runningApps: [NSRunningApplication], _ wasLaunchedBeforeAltTab: Bool = false) {
runningApps.forEach {
if isActualApplication($0) {
Applications.list.append(Application($0))
Applications.list.append(Application($0, wasLaunchedBeforeAltTab))
}
}
}
Expand Down

0 comments on commit 17642ff

Please sign in to comment.