feat: remove "active space" from filter list

This commit is contained in:
Louis Pontoise
2021-08-31 01:36:15 +09:00
parent b5b3c38fec
commit 4623e5b7c4
3 changed files with 16 additions and 4 deletions
+15 -2
View File
@@ -183,9 +183,24 @@ class Preferences {
}
// nextWindowShortcut used to be able to have modifiers already present in holdShortcut; we remove these
migrateNextWindowShortcuts()
// "Show windows from:" got the "Active Space" option removed
migrateShowWindowsFrom()
defaults.set(App.version, forKey: preferencesVersion)
}
private static func migrateShowWindowsFrom() {
["", "2"].forEach { suffix in
if let spacesToShow = defaults.string(forKey: "spacesToShow" + suffix) {
if spacesToShow == "2" {
defaults.set("1", forKey: "screensToShow" + suffix)
defaults.set("1", forKey: "spacesToShow" + suffix)
} else if spacesToShow == "1" {
defaults.set("1", forKey: "screensToShow" + suffix)
}
}
}
}
private static func migrateNextWindowShortcuts() {
["", "2"].forEach { suffix in
if let oldHoldShortcut = defaults.string(forKey: "holdShortcut" + suffix),
@@ -342,13 +357,11 @@ enum AppsToShowPreference: String, CaseIterable, MacroPreference {
enum SpacesToShowPreference: String, CaseIterable, MacroPreference {
case all = "0"
case active = "1"
case visible = "2"
var localizedString: LocalizedString {
switch self {
case .all: return NSLocalizedString("All Spaces", comment: "")
case .active: return NSLocalizedString("Active Space", comment: "")
case .visible: return NSLocalizedString("Visible Spaces", comment: "")
}
}
+1 -1
View File
@@ -227,7 +227,7 @@ class Window {
var screenFrameInQuartzCoordinates = screen.frame
screenFrameInQuartzCoordinates.origin.y = NSMaxY(NSScreen.screens[0].frame) - NSMaxY(screen.frame)
let windowRect = CGRect(origin: topLeftCorner, size: size)
return windowRect.intersects(screenFrameInQuartzCoordinates) && Spaces.visibleSpaces.contains(spaceId)
return windowRect.intersects(screenFrameInQuartzCoordinates)
}
}
return true
-1
View File
@@ -196,7 +196,6 @@ class Windows {
!window.isWindowlessApp &&
!(!(Preferences.showFullscreenWindows[App.app.shortcutIndex] != .hide) && window.isFullscreen) &&
!(!(Preferences.showMinimizedWindows[App.app.shortcutIndex] != .hide) && window.isMinimized) &&
!(Preferences.spacesToShow[App.app.shortcutIndex] == .active && window.spaceId != Spaces.currentSpaceId) &&
!(Preferences.spacesToShow[App.app.shortcutIndex] == .visible && !Spaces.visibleSpaces.contains(window.spaceId)) &&
!(Preferences.screensToShow[App.app.shortcutIndex] == .showingAltTab && !window.isOnScreen(screen)) &&
(Preferences.showTabsAsWindows || !window.isTabbed))