feat: blacklisting apps can use start of the bundle id (closes #549)
Also handle Parallels better
This commit is contained in:
1 parent
8399f845d6
commit
de9cf46746
2 files changed
+15
-5
No files matched your search
@@ -50,7 +50,7 @@ class Preferences {
|
||||
"startAtLogin": "true",
|
||||
"menubarIcon": "0",
|
||||
"dontShowBlacklist": "",
|
||||
"disableShortcutsBlacklist": ["com.realvnc.vncviewer", "com.microsoft.rdc.macos", "com.teamviewer.TeamViewer", "org.virtualbox.app.VirtualBoxVM", "com.parallels.vm", "com.citrix.XenAppViewer"].joined(separator: "\n"),
|
||||
"disableShortcutsBlacklist": ["com.realvnc.vncviewer", "com.microsoft.rdc.macos", "com.teamviewer.TeamViewer", "org.virtualbox.app.VirtualBoxVM", "com.parallels.", "com.citrix.XenAppViewer"].joined(separator: "\n"),
|
||||
"disableShortcutsBlacklistOnlyFullscreen": "true",
|
||||
"updatePolicy": "1",
|
||||
"crashPolicy": "1",
|
||||
@@ -177,7 +177,13 @@ class Preferences {
|
||||
}
|
||||
|
||||
static func blacklistStringToArray(_ blacklist: String) -> [String] {
|
||||
return blacklist.components(separatedBy: "\n").map { $0.trimmingCharacters(in: .whitespaces) }
|
||||
return blacklist.components(separatedBy: "\n").compactMap {
|
||||
let line = $0.trimmingCharacters(in: .whitespaces)
|
||||
if line.isEmpty {
|
||||
return nil
|
||||
}
|
||||
return line
|
||||
}
|
||||
}
|
||||
|
||||
static func defaultsDependingOnScreenRatio() -> [String: String] {
|
||||
|
||||
@@ -118,9 +118,13 @@ class Windows {
|
||||
|
||||
static func checkIfShortcutsShouldBeDisabled() {
|
||||
if let activeWindow = list.first {
|
||||
App.app.shortcutsShouldBeDisabled =
|
||||
Preferences.disableShortcutsBlacklist.contains(activeWindow.application.runningApplication.bundleIdentifier ?? "") &&
|
||||
(!Preferences.disableShortcutsBlacklistOnlyFullscreen || activeWindow.isFullscreen)
|
||||
App.app.shortcutsShouldBeDisabled = (!Preferences.disableShortcutsBlacklistOnlyFullscreen || activeWindow.isFullscreen) &&
|
||||
(Preferences.disableShortcutsBlacklist.first { blacklistedId in
|
||||
if let id = activeWindow.application.runningApplication.bundleIdentifier {
|
||||
return id.hasPrefix(blacklistedId)
|
||||
}
|
||||
return false
|
||||
} != nil)
|
||||
if App.app.shortcutsShouldBeDisabled && App.app.appIsBeingUsed {
|
||||
App.app.hideUi()
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user