Skip to content

Commit

Permalink
feat: remove "active space" from filter list
Browse files Browse the repository at this point in the history
  • Loading branch information
lwouis committed Aug 30, 2021
1 parent b5b3c38 commit 4623e5b
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
17 changes: 15 additions & 2 deletions src/logic/Preferences.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down Expand Up @@ -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: "")
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/logic/Window.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion src/logic/Windows.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit 4623e5b

Please sign in to comment.