diff --git a/docs/Contributors.md b/docs/Contributors.md index a6b2fa09..19e779d7 100644 --- a/docs/Contributors.md +++ b/docs/Contributors.md @@ -47,6 +47,7 @@ They helped [localize the app](https://poeditor.com/join/project/8AOEZ0eAZE): * Lcwhhh * Lumaxis * lwouis +* Marko McLion * Michael * Nilton Souza * Petr Kolář diff --git a/resources/l10n/Localizable.strings b/resources/l10n/Localizable.strings index 54bec32d..ae3011fe 100644 --- a/resources/l10n/Localizable.strings +++ b/resources/l10n/Localizable.strings @@ -319,6 +319,9 @@ /* No comment provided by engineer. */ "View existing discussions" = "View existing discussions"; +/* No comment provided by engineer. */ +"Visible Spaces" = "Visible Spaces"; + /* No comment provided by engineer. */ "While open, press:" = "While open, press:"; diff --git a/resources/l10n/ar.lproj/Localizable.strings b/resources/l10n/ar.lproj/Localizable.strings index 748e8649..aac6ea7a 100644 --- a/resources/l10n/ar.lproj/Localizable.strings +++ b/resources/l10n/ar.lproj/Localizable.strings @@ -347,6 +347,9 @@ /*No comment provided by engineer.*/ "View existing discussions" = "أنظر للنقاشات الحالية"; +/*No comment provided by engineer.*/ +"Visible Spaces" = "Visible Spaces"; + /*No comment provided by engineer.*/ "While open, press:" = "While open, press:"; diff --git a/resources/l10n/de.lproj/Localizable.strings b/resources/l10n/de.lproj/Localizable.strings index d003e4d3..dee570ad 100644 --- a/resources/l10n/de.lproj/Localizable.strings +++ b/resources/l10n/de.lproj/Localizable.strings @@ -347,6 +347,9 @@ /*No comment provided by engineer.*/ "View existing discussions" = "Bestehende Vorschläge anzeigen"; +/*No comment provided by engineer.*/ +"Visible Spaces" = "Visible Spaces"; + /*No comment provided by engineer.*/ "While open, press:" = "Während geöffnet, drücke:"; diff --git a/resources/l10n/en.lproj/Localizable.strings b/resources/l10n/en.lproj/Localizable.strings index a14be5a3..38cb3f56 100644 --- a/resources/l10n/en.lproj/Localizable.strings +++ b/resources/l10n/en.lproj/Localizable.strings @@ -347,6 +347,9 @@ /*No comment provided by engineer.*/ "View existing discussions" = "View existing discussions"; +/*No comment provided by engineer.*/ +"Visible Spaces" = "Visible Spaces"; + /*No comment provided by engineer.*/ "While open, press:" = "While open, press:"; diff --git a/resources/l10n/es.lproj/Localizable.strings b/resources/l10n/es.lproj/Localizable.strings index 5009daad..27bac266 100644 --- a/resources/l10n/es.lproj/Localizable.strings +++ b/resources/l10n/es.lproj/Localizable.strings @@ -347,6 +347,9 @@ /*No comment provided by engineer.*/ "View existing discussions" = "Ver discusiones existentes"; +/*No comment provided by engineer.*/ +"Visible Spaces" = "Visible Spaces"; + /*No comment provided by engineer.*/ "While open, press:" = "Mientras esté abierto, pulsar:"; diff --git a/resources/l10n/fi.lproj/Localizable.strings b/resources/l10n/fi.lproj/Localizable.strings index d74d38c9..63a2937a 100644 --- a/resources/l10n/fi.lproj/Localizable.strings +++ b/resources/l10n/fi.lproj/Localizable.strings @@ -347,6 +347,9 @@ /*No comment provided by engineer.*/ "View existing discussions" = "Näytä keskustelut"; +/*No comment provided by engineer.*/ +"Visible Spaces" = "Visible Spaces"; + /*No comment provided by engineer.*/ "While open, press:" = "Kun auki, paina:"; diff --git a/resources/l10n/fr.lproj/Localizable.strings b/resources/l10n/fr.lproj/Localizable.strings index e7114086..3adfa0d0 100644 --- a/resources/l10n/fr.lproj/Localizable.strings +++ b/resources/l10n/fr.lproj/Localizable.strings @@ -347,6 +347,9 @@ /*No comment provided by engineer.*/ "View existing discussions" = "Voir les discussions existantes"; +/*No comment provided by engineer.*/ +"Visible Spaces" = "Visible Spaces"; + /*No comment provided by engineer.*/ "While open, press:" = "Une fois visible, presser :"; diff --git a/resources/l10n/hu.lproj/Localizable.strings b/resources/l10n/hu.lproj/Localizable.strings index 50126597..d2db85ff 100644 --- a/resources/l10n/hu.lproj/Localizable.strings +++ b/resources/l10n/hu.lproj/Localizable.strings @@ -347,6 +347,9 @@ /*No comment provided by engineer.*/ "View existing discussions" = "Aktuális beszélgetések megtekintése"; +/*No comment provided by engineer.*/ +"Visible Spaces" = "Visible Spaces"; + /*No comment provided by engineer.*/ "While open, press:" = "Megnyitás közben nyomjon:"; diff --git a/resources/l10n/id.lproj/Localizable.strings b/resources/l10n/id.lproj/Localizable.strings index 77ee41de..9ad10024 100644 --- a/resources/l10n/id.lproj/Localizable.strings +++ b/resources/l10n/id.lproj/Localizable.strings @@ -347,6 +347,9 @@ /*No comment provided by engineer.*/ "View existing discussions" = "Lihat diskusi yang ada"; +/*No comment provided by engineer.*/ +"Visible Spaces" = "Visible Spaces"; + /*No comment provided by engineer.*/ "While open, press:" = "Ketika terbuka, tekan:"; diff --git a/resources/l10n/it.lproj/Localizable.strings b/resources/l10n/it.lproj/Localizable.strings index 02cd4205..7b511d23 100644 --- a/resources/l10n/it.lproj/Localizable.strings +++ b/resources/l10n/it.lproj/Localizable.strings @@ -347,6 +347,9 @@ /*No comment provided by engineer.*/ "View existing discussions" = "Mostra discussioni esistenti"; +/*No comment provided by engineer.*/ +"Visible Spaces" = "Visible Spaces"; + /*No comment provided by engineer.*/ "While open, press:" = "While open, press:"; diff --git a/resources/l10n/ja.lproj/Localizable.strings b/resources/l10n/ja.lproj/Localizable.strings index ee5d0276..f62e3bcc 100644 --- a/resources/l10n/ja.lproj/Localizable.strings +++ b/resources/l10n/ja.lproj/Localizable.strings @@ -347,6 +347,9 @@ /*No comment provided by engineer.*/ "View existing discussions" = "既存のディスカッションを見る"; +/*No comment provided by engineer.*/ +"Visible Spaces" = "Visible Spaces"; + /*No comment provided by engineer.*/ "While open, press:" = "ウィンドウが表示中、次のボタンを押す:"; diff --git a/resources/l10n/ko.lproj/Localizable.strings b/resources/l10n/ko.lproj/Localizable.strings index e7f214a4..6e29cdab 100644 --- a/resources/l10n/ko.lproj/Localizable.strings +++ b/resources/l10n/ko.lproj/Localizable.strings @@ -347,6 +347,9 @@ /*No comment provided by engineer.*/ "View existing discussions" = "진행중인 논의 보기"; +/*No comment provided by engineer.*/ +"Visible Spaces" = "Visible Spaces"; + /*No comment provided by engineer.*/ "While open, press:" = "켜져 있을 때, 다음을 누르면:"; diff --git a/resources/l10n/lb.lproj/Localizable.strings b/resources/l10n/lb.lproj/Localizable.strings index eb4e9929..c6883a7c 100644 --- a/resources/l10n/lb.lproj/Localizable.strings +++ b/resources/l10n/lb.lproj/Localizable.strings @@ -347,6 +347,9 @@ /*No comment provided by engineer.*/ "View existing discussions" = "View existing discussions"; +/*No comment provided by engineer.*/ +"Visible Spaces" = "Visible Spaces"; + /*No comment provided by engineer.*/ "While open, press:" = "While open, press:"; diff --git a/resources/l10n/nl.lproj/Localizable.strings b/resources/l10n/nl.lproj/Localizable.strings index 1645eaba..bbd1f4fc 100644 --- a/resources/l10n/nl.lproj/Localizable.strings +++ b/resources/l10n/nl.lproj/Localizable.strings @@ -347,6 +347,9 @@ /*No comment provided by engineer.*/ "View existing discussions" = "Bekijk bestaande discussies"; +/*No comment provided by engineer.*/ +"Visible Spaces" = "Visible Spaces"; + /*No comment provided by engineer.*/ "While open, press:" = "Druk terwijl het geopend is:"; diff --git a/resources/l10n/no.lproj/Localizable.strings b/resources/l10n/no.lproj/Localizable.strings index dfbe4696..768192b8 100644 --- a/resources/l10n/no.lproj/Localizable.strings +++ b/resources/l10n/no.lproj/Localizable.strings @@ -347,6 +347,9 @@ /*No comment provided by engineer.*/ "View existing discussions" = "Se eksisterende diskusjoner"; +/*No comment provided by engineer.*/ +"Visible Spaces" = "Visible Spaces"; + /*No comment provided by engineer.*/ "While open, press:" = "Når åpen, trykk:"; diff --git a/resources/l10n/pl.lproj/Localizable.strings b/resources/l10n/pl.lproj/Localizable.strings index 025a41c8..3dec9a82 100644 --- a/resources/l10n/pl.lproj/Localizable.strings +++ b/resources/l10n/pl.lproj/Localizable.strings @@ -348,6 +348,9 @@ /*No comment provided by engineer.*/ "View existing discussions" = "Wyświetl istniejące dyskusje"; +/*No comment provided by engineer.*/ +"Visible Spaces" = "Visible Spaces"; + /*No comment provided by engineer.*/ "While open, press:" = "Podczas gdy otwarty, naciśnij:"; diff --git a/resources/l10n/pt-BR.lproj/Localizable.strings b/resources/l10n/pt-BR.lproj/Localizable.strings index 4dd4bbb9..8d53de7d 100644 --- a/resources/l10n/pt-BR.lproj/Localizable.strings +++ b/resources/l10n/pt-BR.lproj/Localizable.strings @@ -347,6 +347,9 @@ /*No comment provided by engineer.*/ "View existing discussions" = "Ver discussões existentes"; +/*No comment provided by engineer.*/ +"Visible Spaces" = "Visible Spaces"; + /*No comment provided by engineer.*/ "While open, press:" = "Enquanto aberto, pressionar:"; diff --git a/resources/l10n/pt.lproj/Localizable.strings b/resources/l10n/pt.lproj/Localizable.strings index 1b75b5b3..8d6ae6ce 100644 --- a/resources/l10n/pt.lproj/Localizable.strings +++ b/resources/l10n/pt.lproj/Localizable.strings @@ -347,6 +347,9 @@ /*No comment provided by engineer.*/ "View existing discussions" = "Ver discussões existentes"; +/*No comment provided by engineer.*/ +"Visible Spaces" = "Visible Spaces"; + /*No comment provided by engineer.*/ "While open, press:" = "Enquanto activa, carregar:"; diff --git a/resources/l10n/ru.lproj/Localizable.strings b/resources/l10n/ru.lproj/Localizable.strings index 9d52636e..e7814403 100644 --- a/resources/l10n/ru.lproj/Localizable.strings +++ b/resources/l10n/ru.lproj/Localizable.strings @@ -347,6 +347,9 @@ /*No comment provided by engineer.*/ "View existing discussions" = "Посмотреть обсуждения"; +/*No comment provided by engineer.*/ +"Visible Spaces" = "Visible Spaces"; + /*No comment provided by engineer.*/ "While open, press:" = "Когда открыто, нажать:"; diff --git a/resources/l10n/tr.lproj/Localizable.strings b/resources/l10n/tr.lproj/Localizable.strings index ef5f87fa..0155adeb 100644 --- a/resources/l10n/tr.lproj/Localizable.strings +++ b/resources/l10n/tr.lproj/Localizable.strings @@ -347,6 +347,9 @@ /*No comment provided by engineer.*/ "View existing discussions" = "Mevcut tartışmaları görüntüle"; +/*No comment provided by engineer.*/ +"Visible Spaces" = "Visible Spaces"; + /*No comment provided by engineer.*/ "While open, press:" = "While open, press:"; diff --git a/resources/l10n/zh-CN.lproj/Localizable.strings b/resources/l10n/zh-CN.lproj/Localizable.strings index ba8f2ede..5bb3dd91 100644 --- a/resources/l10n/zh-CN.lproj/Localizable.strings +++ b/resources/l10n/zh-CN.lproj/Localizable.strings @@ -347,6 +347,9 @@ /*No comment provided by engineer.*/ "View existing discussions" = "查看现有讨论"; +/*No comment provided by engineer.*/ +"Visible Spaces" = "Visible Spaces"; + /*No comment provided by engineer.*/ "While open, press:" = "在打开时按:"; diff --git a/resources/l10n/zh-TW.lproj/Localizable.strings b/resources/l10n/zh-TW.lproj/Localizable.strings index 6de0e4e9..0675530f 100644 --- a/resources/l10n/zh-TW.lproj/Localizable.strings +++ b/resources/l10n/zh-TW.lproj/Localizable.strings @@ -347,6 +347,9 @@ /*No comment provided by engineer.*/ "View existing discussions" = "觀看目前的討論"; +/*No comment provided by engineer.*/ +"Visible Spaces" = "Visible Spaces"; + /*No comment provided by engineer.*/ "While open, press:" = "當打開時,按下:"; diff --git a/src/logic/Preferences.swift b/src/logic/Preferences.swift index 00e9119d..d9d88ad4 100644 --- a/src/logic/Preferences.swift +++ b/src/logic/Preferences.swift @@ -327,11 +327,13 @@ 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: "") } } } diff --git a/src/logic/Spaces.swift b/src/logic/Spaces.swift index 1f0ab83b..8e1a0e87 100644 --- a/src/logic/Spaces.swift +++ b/src/logic/Spaces.swift @@ -2,6 +2,7 @@ import Cocoa class Spaces { static var currentSpaceId = CGSSpaceID(1) + static var visibleSpaceIds = [CGSSpaceID]() static var currentSpaceIndex = SpaceIndex(1) static var isSingleSpace = true static var idsAndIndexes: [(CGSSpaceID, SpaceIndex)] = allIdsAndIndexes() @@ -11,6 +12,11 @@ class Spaces { debugPrint("OS event", "activeSpaceDidChangeNotification") idsAndIndexes = allIdsAndIndexes() updateCurrentSpace() + refreshVisibleSpaces() + }) + NSWorkspace.shared.notificationCenter.addObserver(forName: NSApplication.didChangeScreenParametersNotification , object: nil, queue: nil, using: { _ in + debugPrint("OS event", "didChangeScreenParametersNotification") + refreshVisibleSpaces() }) } @@ -22,8 +28,18 @@ class Spaces { } } + static func refreshVisibleSpaces() { + visibleSpaceIds = NSScreen.screens.compactMap { + if let uuid = $0.uuid() { + return CGSManagedDisplayGetCurrentSpace(cgsMainConnectionId, uuid) + } + return nil + } + } + static func initialDiscovery() { updateCurrentSpace() + refreshVisibleSpaces() updateIsSingleSpace() observeSpaceChanges() } diff --git a/src/logic/Windows.swift b/src/logic/Windows.swift index 74e6576a..e3edbed8 100644 --- a/src/logic/Windows.swift +++ b/src/logic/Windows.swift @@ -196,6 +196,7 @@ class Windows { !(!(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.visibleSpaceIds.contains(window.spaceId)) && !(Preferences.screensToShow[App.app.shortcutIndex] == .showingAltTab && !isOnScreen(window, screen)) && (Preferences.showTabsAsWindows || !window.isTabbed)) }