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",
|
"startAtLogin": "true",
|
||||||
"menubarIcon": "0",
|
"menubarIcon": "0",
|
||||||
"dontShowBlacklist": "",
|
"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",
|
"disableShortcutsBlacklistOnlyFullscreen": "true",
|
||||||
"updatePolicy": "1",
|
"updatePolicy": "1",
|
||||||
"crashPolicy": "1",
|
"crashPolicy": "1",
|
||||||
@@ -177,7 +177,13 @@ class Preferences {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static func blacklistStringToArray(_ blacklist: String) -> [String] {
|
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] {
|
static func defaultsDependingOnScreenRatio() -> [String: String] {
|
||||||
|
|||||||
@@ -118,9 +118,13 @@ class Windows {
|
|||||||
|
|
||||||
static func checkIfShortcutsShouldBeDisabled() {
|
static func checkIfShortcutsShouldBeDisabled() {
|
||||||
if let activeWindow = list.first {
|
if let activeWindow = list.first {
|
||||||
App.app.shortcutsShouldBeDisabled =
|
App.app.shortcutsShouldBeDisabled = (!Preferences.disableShortcutsBlacklistOnlyFullscreen || activeWindow.isFullscreen) &&
|
||||||
Preferences.disableShortcutsBlacklist.contains(activeWindow.application.runningApplication.bundleIdentifier ?? "") &&
|
(Preferences.disableShortcutsBlacklist.first { blacklistedId in
|
||||||
(!Preferences.disableShortcutsBlacklistOnlyFullscreen || activeWindow.isFullscreen)
|
if let id = activeWindow.application.runningApplication.bundleIdentifier {
|
||||||
|
return id.hasPrefix(blacklistedId)
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
} != nil)
|
||||||
if App.app.shortcutsShouldBeDisabled && App.app.appIsBeingUsed {
|
if App.app.shortcutsShouldBeDisabled && App.app.appIsBeingUsed {
|
||||||
App.app.hideUi()
|
App.app.hideUi()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user