mirror of
https://github.com/Toxblh/MTMR.git
synced 2026-01-10 17:08:39 +00:00
* removed buggy "recent apps"
This commit is contained in:
parent
9db9df5641
commit
0ce5a49172
@ -62,8 +62,7 @@ class AppScrubberTouchBarItem: NSCustomTouchBarItem, NSScrubberDelegate, NSScrub
|
||||
}
|
||||
|
||||
func updateRunningApplication() {
|
||||
let isDockOrder = false
|
||||
let newApplications = (isDockOrder ? dockPersistentApplications() : launchedApplications()).filter {
|
||||
let newApplications = launchedApplications().filter {
|
||||
!$0.isTerminated && $0.bundleIdentifier != nil
|
||||
}
|
||||
let frontmost = NSWorkspace.shared.frontmostApplication
|
||||
@ -117,29 +116,6 @@ private func launchedApplications() -> [NSRunningApplication] {
|
||||
}
|
||||
}
|
||||
|
||||
private func dockPersistentApplications() -> [NSRunningApplication] {
|
||||
let apps = NSWorkspace.shared.runningApplications.filter {
|
||||
$0.activationPolicy == .regular
|
||||
}
|
||||
|
||||
guard let dockDefaults = UserDefaults(suiteName: "com.apple.dock"),
|
||||
let persistentApps = dockDefaults.array(forKey: "persistent-apps") as [AnyObject]?,
|
||||
let bundleIDs = persistentApps.compactMap({ $0.value(forKeyPath: "tile-data.bundle-identifier") }) as? [String] else {
|
||||
return apps
|
||||
}
|
||||
|
||||
return apps.sorted { (lhs, rhs) in
|
||||
switch ((bundleIDs.index(of: lhs.bundleIdentifier!)), bundleIDs.index(of: rhs.bundleIdentifier!)) {
|
||||
case (nil, _):
|
||||
return false;
|
||||
case (_?, nil):
|
||||
return true
|
||||
case let (i1?, i2?):
|
||||
return i1 < i2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extension NSUserInterfaceItemIdentifier {
|
||||
static let scrubberApplicationsItem = NSUserInterfaceItemIdentifier("ScrubberApplicationsItemReuseIdentifier")
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user