feat: add preference to show visible spaces (closes #583)

This commit is contained in:
Louis Pontoise authored and lwouis committed 2020-11-12 00:30:27 +09:00
1 parent d021be1336
commit 545437e43e
26 files changed
+86

No files matched your search

+1
View File
@@ -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ář
+3
View File
@@ -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:";
@@ -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:";
@@ -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:";
@@ -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:";
@@ -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:";
@@ -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:";
@@ -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 :";
@@ -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:";
@@ -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:";
@@ -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:";
@@ -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:" = "ウィンドウが表示中、次のボタンを押す:";
@@ -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:" = "켜져 있을 때, 다음을 누르면:";
@@ -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:";
@@ -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:";
@@ -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:";
@@ -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:";
@@ -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:";
@@ -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:";
@@ -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:" = "Когда открыто, нажать:";
@@ -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:";
@@ -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:" = "在打开时按:";
@@ -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:" = "當打開時,按下:";
+2
View File
@@ -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: "")
}
}
}
+16
View File
@@ -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()
}
+1
View File
@@ -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))
}