From d32951f06f3d04112fec7a09d8159b7050db8485 Mon Sep 17 00:00:00 2001 From: Louis Pontoise Date: Fri, 17 Jul 2020 18:57:20 +0900 Subject: [PATCH] feat: allow backlisting apps, with 2 different types of blacklist closes #239 --- alt-tab-macos.xcodeproj/project.pbxproj | 4 +++ resources/l10n/Localizable.strings | 12 ++++++++ resources/l10n/ar.lproj/Localizable.strings | 12 ++++++++ resources/l10n/de.lproj/Localizable.strings | 12 ++++++++ resources/l10n/en.lproj/Localizable.strings | 12 ++++++++ resources/l10n/es.lproj/Localizable.strings | 12 ++++++++ resources/l10n/fi.lproj/Localizable.strings | 12 ++++++++ resources/l10n/fr.lproj/Localizable.strings | 12 ++++++++ resources/l10n/hu.lproj/Localizable.strings | 12 ++++++++ resources/l10n/it.lproj/Localizable.strings | 12 ++++++++ resources/l10n/ja.lproj/Localizable.strings | 12 ++++++++ resources/l10n/ko.lproj/Localizable.strings | 22 +++++++++++---- resources/l10n/nl.lproj/Localizable.strings | 12 ++++++++ .../l10n/pt-BR.lproj/Localizable.strings | 12 ++++++++ resources/l10n/ru.lproj/Localizable.strings | 12 ++++++++ resources/l10n/tr.lproj/Localizable.strings | 12 ++++++++ .../l10n/zh-CN.lproj/Localizable.strings | 12 ++++++++ .../l10n/zh-TW.lproj/Localizable.strings | 12 ++++++++ src/logic/Preferences.swift | 12 +++++++- src/logic/Windows.swift | 13 ++++++++- src/logic/events/AccessibilityEvents.swift | 3 ++ src/logic/events/KeyboardEvents.swift | 2 +- src/ui/App.swift | 3 ++ src/ui/generic-components/text/TextArea.swift | 4 +-- .../preferences-window/LabelAndControl.swift | 11 ++++++++ .../tabs/BlacklistsTab.swift | 28 +++++++++++++++++++ 26 files changed, 284 insertions(+), 10 deletions(-) create mode 100644 src/ui/preferences-window/tabs/BlacklistsTab.swift diff --git a/alt-tab-macos.xcodeproj/project.pbxproj b/alt-tab-macos.xcodeproj/project.pbxproj index 5ce327f0..9d709a7e 100644 --- a/alt-tab-macos.xcodeproj/project.pbxproj +++ b/alt-tab-macos.xcodeproj/project.pbxproj @@ -96,6 +96,7 @@ D04BAFB90E00AA5D662EAF24 /* PermissionsWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = D04BA9DF10D0CC4CA0C8F814 /* PermissionsWindow.swift */; }; D04BAFB973C3D28718FAEB87 /* Windows.swift in Sources */ = {isa = PBXBuildFile; fileRef = D04BACD976030676FD0761D5 /* Windows.swift */; }; D04BAFBC862BA5FE0294EA7A /* AXUIElement.swift in Sources */ = {isa = PBXBuildFile; fileRef = D04BA6F823BC0EDA9AA4B80A /* AXUIElement.swift */; }; + D04BAFF30A98CF287F85DA1E /* BlacklistsTab.swift in Sources */ = {isa = PBXBuildFile; fileRef = D04BA27695D9A5824720BD7B /* BlacklistsTab.swift */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ @@ -131,6 +132,7 @@ D04BA2526DC6726E0F7ACF7C /* LabelAndControl.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LabelAndControl.swift; sourceTree = ""; }; D04BA258B56193958D60978A /* ThumbnailView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ThumbnailView.swift; sourceTree = ""; }; D04BA26C75F76C277653C932 /* FeedbackWindow.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FeedbackWindow.swift; sourceTree = ""; }; + D04BA27695D9A5824720BD7B /* BlacklistsTab.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BlacklistsTab.swift; sourceTree = ""; }; D04BA282BB16C1554595A968 /* Applications.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Applications.swift; sourceTree = ""; }; D04BA2A68FFD585C3A64434A /* zh-CN */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = "zh-CN"; path = InfoPlist.strings; sourceTree = ""; }; D04BA2C7B51F68651B3C60E2 /* 6 windows - 1 line.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = "6 windows - 1 line.jpg"; sourceTree = ""; }; @@ -476,6 +478,7 @@ D04BACE22DC907F03D193075 /* GeneralTab.swift */, D04BAD60C97E609A759E721E /* UpdatesTab.swift */, D04BA788228BA86D9EFBD1ED /* AcknowledgmentsTab.swift */, + D04BA27695D9A5824720BD7B /* BlacklistsTab.swift */, ); path = tabs; sourceTree = ""; @@ -1085,6 +1088,7 @@ D04BA7E39FA539DD8316447A /* PermissionView.swift in Sources */, D04BA446D702C5E252AF2319 /* TitleLabel.swift in Sources */, D04BAD43C122A1C7E88B0362 /* MouseEvents.swift in Sources */, + D04BAFF30A98CF287F85DA1E /* BlacklistsTab.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/resources/l10n/Localizable.strings b/resources/l10n/Localizable.strings index b788d8c3..e7a2ad0a 100644 --- a/resources/l10n/Localizable.strings +++ b/resources/l10n/Localizable.strings @@ -52,6 +52,9 @@ /* No comment provided by engineer. */ "Auto-install updates periodically" = "Auto-install updates periodically"; +/* No comment provided by engineer. */ +"Blacklists" = "Blacklists"; + /* No comment provided by engineer. */ "Cancel" = "Cancel"; @@ -76,6 +79,9 @@ /* No comment provided by engineer. */ "Don’t check for updates periodically" = "Don’t check for updates periodically"; +/* No comment provided by engineer. */ +"Don’t show windows from these apps" = "Don’t show windows from these apps"; + /* No comment provided by engineer. */ "End" = "End"; @@ -106,6 +112,9 @@ /* No comment provided by engineer. */ "I think the app could be improved with…" = "I think the app could be improved with…"; +/* No comment provided by engineer. */ +"Ignore shortcuts while a window from these apps is active" = "Ignore shortcuts while a window from these apps is active"; + /* No comment provided by engineer. */ "Latest releases" = "Latest releases"; @@ -136,6 +145,9 @@ /* No comment provided by engineer. */ "Not allowed" = "Not allowed"; +/* No comment provided by engineer. */ +"Only if the window is fullscreen" = "Only if the window is fullscreen"; + /* No comment provided by engineer. */ "Open Accessibility Preferences…" = "Open Accessibility Preferences…"; diff --git a/resources/l10n/ar.lproj/Localizable.strings b/resources/l10n/ar.lproj/Localizable.strings index 14c6142d..09f6642a 100644 --- a/resources/l10n/ar.lproj/Localizable.strings +++ b/resources/l10n/ar.lproj/Localizable.strings @@ -56,6 +56,9 @@ /*No comment provided by engineer.*/ "Auto-install updates periodically" = "تثبيت التحديثات بشكل دوري تلقائي"; +/*No comment provided by engineer.*/ +"Blacklists" = "Blacklists"; + /*Cancel button*/ "Cancel" = "إلغاء"; @@ -80,6 +83,9 @@ /*No comment provided by engineer.*/ "Don’t check for updates periodically" = "لا تبحث عن تحديثات بشكل دوري"; +/*No comment provided by engineer.*/ +"Don’t show windows from these apps" = "Don’t show windows from these apps"; + /*No comment provided by engineer.*/ "End" = "End"; @@ -110,6 +116,9 @@ /*No comment provided by engineer.*/ "I think the app could be improved with…" = "اعتقد أنه بالإمكان تطوير البرنامج بـ…"; +/*No comment provided by engineer.*/ +"Ignore shortcuts while a window from these apps is active" = "Ignore shortcuts while a window from these apps is active"; + /*No comment provided by engineer.*/ "Latest releases" = "آخر الإصدارات"; @@ -143,6 +152,9 @@ /*Copyright (human-readable)*/ "NSHumanReadableCopyright" = "رخصة GPL-3.0"; +/*No comment provided by engineer.*/ +"Only if the window is fullscreen" = "Only if the window is fullscreen"; + /*No comment provided by engineer.*/ "Open Accessibility Preferences…" = "Open Accessibility Preferences…"; diff --git a/resources/l10n/de.lproj/Localizable.strings b/resources/l10n/de.lproj/Localizable.strings index 22172794..60ee7eb9 100644 --- a/resources/l10n/de.lproj/Localizable.strings +++ b/resources/l10n/de.lproj/Localizable.strings @@ -56,6 +56,9 @@ /*No comment provided by engineer.*/ "Auto-install updates periodically" = "Updates regelmäßig automatisch installieren"; +/*No comment provided by engineer.*/ +"Blacklists" = "Blacklists"; + /*Cancel button*/ "Cancel" = "Abbrechen"; @@ -80,6 +83,9 @@ /*No comment provided by engineer.*/ "Don’t check for updates periodically" = "Nicht regelmäßig nach Updates suchen"; +/*No comment provided by engineer.*/ +"Don’t show windows from these apps" = "Don’t show windows from these apps"; + /*No comment provided by engineer.*/ "End" = "End"; @@ -110,6 +116,9 @@ /*No comment provided by engineer.*/ "I think the app could be improved with…" = "Ich denke so könnte die Anwendung verbessert werden…"; +/*No comment provided by engineer.*/ +"Ignore shortcuts while a window from these apps is active" = "Ignore shortcuts while a window from these apps is active"; + /*No comment provided by engineer.*/ "Latest releases" = "Neuste Versionen"; @@ -143,6 +152,9 @@ /*Copyright (human-readable)*/ "NSHumanReadableCopyright" = "GPL-3.0 Lizenz"; +/*No comment provided by engineer.*/ +"Only if the window is fullscreen" = "Only if the window is fullscreen"; + /*No comment provided by engineer.*/ "Open Accessibility Preferences…" = "Open Accessibility Preferences…"; diff --git a/resources/l10n/en.lproj/Localizable.strings b/resources/l10n/en.lproj/Localizable.strings index 8457ef4a..335efa06 100644 --- a/resources/l10n/en.lproj/Localizable.strings +++ b/resources/l10n/en.lproj/Localizable.strings @@ -56,6 +56,9 @@ /*No comment provided by engineer.*/ "Auto-install updates periodically" = "Auto-install updates periodically"; +/*No comment provided by engineer.*/ +"Blacklists" = "Blacklists"; + /*Cancel button*/ "Cancel" = "Cancel"; @@ -80,6 +83,9 @@ /*No comment provided by engineer.*/ "Don’t check for updates periodically" = "Don’t check for updates periodically"; +/*No comment provided by engineer.*/ +"Don’t show windows from these apps" = "Don’t show windows from these apps"; + /*No comment provided by engineer.*/ "End" = "End"; @@ -110,6 +116,9 @@ /*No comment provided by engineer.*/ "I think the app could be improved with…" = "I think the app could be improved with…"; +/*No comment provided by engineer.*/ +"Ignore shortcuts while a window from these apps is active" = "Ignore shortcuts while a window from these apps is active"; + /*No comment provided by engineer.*/ "Latest releases" = "Latest releases"; @@ -143,6 +152,9 @@ /*Copyright (human-readable)*/ "NSHumanReadableCopyright" = "GPL-3.0 license"; +/*No comment provided by engineer.*/ +"Only if the window is fullscreen" = "Only if the window is fullscreen"; + /*No comment provided by engineer.*/ "Open Accessibility Preferences…" = "Open Accessibility Preferences…"; diff --git a/resources/l10n/es.lproj/Localizable.strings b/resources/l10n/es.lproj/Localizable.strings index fa9bb4b0..6ad6b688 100644 --- a/resources/l10n/es.lproj/Localizable.strings +++ b/resources/l10n/es.lproj/Localizable.strings @@ -56,6 +56,9 @@ /*No comment provided by engineer.*/ "Auto-install updates periodically" = "Auto instalar actualizaciones periódicamente"; +/*No comment provided by engineer.*/ +"Blacklists" = "Blacklists"; + /*Cancel button*/ "Cancel" = "Cancelar"; @@ -80,6 +83,9 @@ /*No comment provided by engineer.*/ "Don’t check for updates periodically" = "No comprobar actualizaciones periódicamente"; +/*No comment provided by engineer.*/ +"Don’t show windows from these apps" = "Don’t show windows from these apps"; + /*No comment provided by engineer.*/ "End" = "End"; @@ -110,6 +116,9 @@ /*No comment provided by engineer.*/ "I think the app could be improved with…" = "Creo que la aplicación podría mejorarse con…"; +/*No comment provided by engineer.*/ +"Ignore shortcuts while a window from these apps is active" = "Ignore shortcuts while a window from these apps is active"; + /*No comment provided by engineer.*/ "Latest releases" = "Últimos lanzamientos"; @@ -143,6 +152,9 @@ /*Copyright (human-readable)*/ "NSHumanReadableCopyright" = "Licencia GPL-3.0"; +/*No comment provided by engineer.*/ +"Only if the window is fullscreen" = "Only if the window is fullscreen"; + /*No comment provided by engineer.*/ "Open Accessibility Preferences…" = "Open Accessibility Preferences…"; diff --git a/resources/l10n/fi.lproj/Localizable.strings b/resources/l10n/fi.lproj/Localizable.strings index 2215fb8c..a1413d07 100644 --- a/resources/l10n/fi.lproj/Localizable.strings +++ b/resources/l10n/fi.lproj/Localizable.strings @@ -56,6 +56,9 @@ /*No comment provided by engineer.*/ "Auto-install updates periodically" = "Asenna päivitykset automaattisesti aika ajoin"; +/*No comment provided by engineer.*/ +"Blacklists" = "Blacklists"; + /*Cancel button*/ "Cancel" = "Peru"; @@ -80,6 +83,9 @@ /*No comment provided by engineer.*/ "Don’t check for updates periodically" = "Älä tarkista päivityksiä"; +/*No comment provided by engineer.*/ +"Don’t show windows from these apps" = "Don’t show windows from these apps"; + /*No comment provided by engineer.*/ "End" = "End"; @@ -110,6 +116,9 @@ /*No comment provided by engineer.*/ "I think the app could be improved with…" = "Ohjelmaa voisi mielestäni parantaa…"; +/*No comment provided by engineer.*/ +"Ignore shortcuts while a window from these apps is active" = "Ignore shortcuts while a window from these apps is active"; + /*No comment provided by engineer.*/ "Latest releases" = "Uusimmat julkaisut"; @@ -143,6 +152,9 @@ /*Copyright (human-readable)*/ "NSHumanReadableCopyright" = "GPL-3.0 -lisenssi"; +/*No comment provided by engineer.*/ +"Only if the window is fullscreen" = "Only if the window is fullscreen"; + /*No comment provided by engineer.*/ "Open Accessibility Preferences…" = "Open Accessibility Preferences…"; diff --git a/resources/l10n/fr.lproj/Localizable.strings b/resources/l10n/fr.lproj/Localizable.strings index 2d7f6c16..0c2ca850 100644 --- a/resources/l10n/fr.lproj/Localizable.strings +++ b/resources/l10n/fr.lproj/Localizable.strings @@ -56,6 +56,9 @@ /*No comment provided by engineer.*/ "Auto-install updates periodically" = "Auto-installer les mises-à-jour périodiquement"; +/*No comment provided by engineer.*/ +"Blacklists" = "Blacklists"; + /*Cancel button*/ "Cancel" = "Annuler"; @@ -80,6 +83,9 @@ /*No comment provided by engineer.*/ "Don’t check for updates periodically" = "Ne pas chercher de mise-à-jour périodiquement"; +/*No comment provided by engineer.*/ +"Don’t show windows from these apps" = "Don’t show windows from these apps"; + /*No comment provided by engineer.*/ "End" = "Fin"; @@ -110,6 +116,9 @@ /*No comment provided by engineer.*/ "I think the app could be improved with…" = "Je pense que l’app pourrait être améliorée avec…"; +/*No comment provided by engineer.*/ +"Ignore shortcuts while a window from these apps is active" = "Ignore shortcuts while a window from these apps is active"; + /*No comment provided by engineer.*/ "Latest releases" = "Dernières versions"; @@ -143,6 +152,9 @@ /*Copyright (human-readable)*/ "NSHumanReadableCopyright" = "Licence GPL-3.0"; +/*No comment provided by engineer.*/ +"Only if the window is fullscreen" = "Only if the window is fullscreen"; + /*No comment provided by engineer.*/ "Open Accessibility Preferences…" = "Ouvrir Préférences Accessibilité…"; diff --git a/resources/l10n/hu.lproj/Localizable.strings b/resources/l10n/hu.lproj/Localizable.strings index 0d57eeb1..a4cba087 100644 --- a/resources/l10n/hu.lproj/Localizable.strings +++ b/resources/l10n/hu.lproj/Localizable.strings @@ -56,6 +56,9 @@ /*No comment provided by engineer.*/ "Auto-install updates periodically" = "Frissítések automatikus telepítése"; +/*No comment provided by engineer.*/ +"Blacklists" = "Blacklists"; + /*Cancel button*/ "Cancel" = "Mégsem"; @@ -80,6 +83,9 @@ /*No comment provided by engineer.*/ "Don’t check for updates periodically" = "Ne keressen frissítéseket automatikusan"; +/*No comment provided by engineer.*/ +"Don’t show windows from these apps" = "Don’t show windows from these apps"; + /*No comment provided by engineer.*/ "End" = "End"; @@ -110,6 +116,9 @@ /*No comment provided by engineer.*/ "I think the app could be improved with…" = "Azt gondolom hasznos lenne az app bővítése ezzel…"; +/*No comment provided by engineer.*/ +"Ignore shortcuts while a window from these apps is active" = "Ignore shortcuts while a window from these apps is active"; + /*No comment provided by engineer.*/ "Latest releases" = "Legutóbbi kiadások"; @@ -143,6 +152,9 @@ /*Copyright (human-readable)*/ "NSHumanReadableCopyright" = "GPL-3.0 license"; +/*No comment provided by engineer.*/ +"Only if the window is fullscreen" = "Only if the window is fullscreen"; + /*No comment provided by engineer.*/ "Open Accessibility Preferences…" = "Open Accessibility Preferences…"; diff --git a/resources/l10n/it.lproj/Localizable.strings b/resources/l10n/it.lproj/Localizable.strings index cf50cbde..a374d0ca 100644 --- a/resources/l10n/it.lproj/Localizable.strings +++ b/resources/l10n/it.lproj/Localizable.strings @@ -56,6 +56,9 @@ /*No comment provided by engineer.*/ "Auto-install updates periodically" = "La procedure di auto-install aggiorna periodicamente"; +/*No comment provided by engineer.*/ +"Blacklists" = "Blacklists"; + /*Cancel button*/ "Cancel" = "Cancella"; @@ -80,6 +83,9 @@ /*No comment provided by engineer.*/ "Don’t check for updates periodically" = "Non controllare gli aggiornamenti periodicamente"; +/*No comment provided by engineer.*/ +"Don’t show windows from these apps" = "Don’t show windows from these apps"; + /*No comment provided by engineer.*/ "End" = "End"; @@ -110,6 +116,9 @@ /*No comment provided by engineer.*/ "I think the app could be improved with…" = "Credo che l’applicazione possa essere migliorata con…"; +/*No comment provided by engineer.*/ +"Ignore shortcuts while a window from these apps is active" = "Ignore shortcuts while a window from these apps is active"; + /*No comment provided by engineer.*/ "Latest releases" = "Ultimi rilasci"; @@ -143,6 +152,9 @@ /*Copyright (human-readable)*/ "NSHumanReadableCopyright" = "Licenza GPL-3.0"; +/*No comment provided by engineer.*/ +"Only if the window is fullscreen" = "Only if the window is fullscreen"; + /*No comment provided by engineer.*/ "Open Accessibility Preferences…" = "Open Accessibility Preferences…"; diff --git a/resources/l10n/ja.lproj/Localizable.strings b/resources/l10n/ja.lproj/Localizable.strings index 2ea2ec84..84071203 100644 --- a/resources/l10n/ja.lproj/Localizable.strings +++ b/resources/l10n/ja.lproj/Localizable.strings @@ -56,6 +56,9 @@ /*No comment provided by engineer.*/ "Auto-install updates periodically" = "更新を定期的に自動インストールする"; +/*No comment provided by engineer.*/ +"Blacklists" = "Blacklists"; + /*Cancel button*/ "Cancel" = "キャンセル"; @@ -80,6 +83,9 @@ /*No comment provided by engineer.*/ "Don’t check for updates periodically" = "定期的に更新を確認しない"; +/*No comment provided by engineer.*/ +"Don’t show windows from these apps" = "Don’t show windows from these apps"; + /*No comment provided by engineer.*/ "End" = "End"; @@ -110,6 +116,9 @@ /*No comment provided by engineer.*/ "I think the app could be improved with…" = "アプリの◯◯を改善したい"; +/*No comment provided by engineer.*/ +"Ignore shortcuts while a window from these apps is active" = "Ignore shortcuts while a window from these apps is active"; + /*No comment provided by engineer.*/ "Latest releases" = "最新バージョン"; @@ -143,6 +152,9 @@ /*Copyright (human-readable)*/ "NSHumanReadableCopyright" = "GPL-3.0ライセンス"; +/*No comment provided by engineer.*/ +"Only if the window is fullscreen" = "Only if the window is fullscreen"; + /*No comment provided by engineer.*/ "Open Accessibility Preferences…" = "Open Accessibility Preferences…"; diff --git a/resources/l10n/ko.lproj/Localizable.strings b/resources/l10n/ko.lproj/Localizable.strings index 3ef49ac0..1d815ffe 100644 --- a/resources/l10n/ko.lproj/Localizable.strings +++ b/resources/l10n/ko.lproj/Localizable.strings @@ -6,7 +6,7 @@ "About" = "정보"; /*No comment provided by engineer.*/ -"Accessibility" = "Accessibility"; +"Accessibility" = "접근성"; /*No comment provided by engineer.*/ "Acknowledgments" = "감사의 말"; @@ -39,7 +39,7 @@ "Allowed" = "Allowed"; /*No comment provided by engineer.*/ -"AltTab needs some permissions" = "AltTab needs some permissions"; +"AltTab needs some permissions" = "AltTab이 권한을 필요로 합니다."; /*No comment provided by engineer.*/ "Apparition delay:" = "나타나는 시간:"; @@ -56,6 +56,9 @@ /*No comment provided by engineer.*/ "Auto-install updates periodically" = "자동으로 업데이트 설치하기"; +/*No comment provided by engineer.*/ +"Blacklists" = "Blacklists"; + /*Cancel button*/ "Cancel" = "취소"; @@ -80,6 +83,9 @@ /*No comment provided by engineer.*/ "Don’t check for updates periodically" = "주기적으로 업데이트를 확인하지 않기"; +/*No comment provided by engineer.*/ +"Don’t show windows from these apps" = "Don’t show windows from these apps"; + /*No comment provided by engineer.*/ "End" = "End"; @@ -110,6 +116,9 @@ /*No comment provided by engineer.*/ "I think the app could be improved with…" = "이 앱의 개선방안은…"; +/*No comment provided by engineer.*/ +"Ignore shortcuts while a window from these apps is active" = "Ignore shortcuts while a window from these apps is active"; + /*No comment provided by engineer.*/ "Latest releases" = "최신 출시"; @@ -144,10 +153,13 @@ "NSHumanReadableCopyright" = "GPL-3.0 라이선스"; /*No comment provided by engineer.*/ -"Open Accessibility Preferences…" = "Open Accessibility Preferences…"; +"Only if the window is fullscreen" = "Only if the window is fullscreen"; + +/*No comment provided by engineer.*/ +"Open Accessibility Preferences…" = "접근성 설정 열기..."; /*No comment provided by engineer.*/ -"Open Screen Recording Preferences…" = "Open Screen Recording Preferences…"; +"Open Screen Recording Preferences…" = "화면 녹화 설정 열기..."; /*No comment provided by engineer.*/ "Optional: email (if you want a reply)" = "답변을 원하면 이메일 남겨주세요"; @@ -174,7 +186,7 @@ "Screen including mouse" = "마우스를 포함한 화면"; /*No comment provided by engineer.*/ -"Screen Recording" = "Screen Recording"; +"Screen Recording" = "화면 녹화"; /*No comment provided by engineer.*/ "Screen showing AltTab" = "AltTab이 보여지는 화면"; diff --git a/resources/l10n/nl.lproj/Localizable.strings b/resources/l10n/nl.lproj/Localizable.strings index 065eeb6d..b9287948 100644 --- a/resources/l10n/nl.lproj/Localizable.strings +++ b/resources/l10n/nl.lproj/Localizable.strings @@ -56,6 +56,9 @@ /*No comment provided by engineer.*/ "Auto-install updates periodically" = "Installeer regelmatig automatisch updates"; +/*No comment provided by engineer.*/ +"Blacklists" = "Blacklists"; + /*Cancel button*/ "Cancel" = "Annuleer"; @@ -80,6 +83,9 @@ /*No comment provided by engineer.*/ "Don’t check for updates periodically" = "Controleer niet regelmatig op updates"; +/*No comment provided by engineer.*/ +"Don’t show windows from these apps" = "Don’t show windows from these apps"; + /*No comment provided by engineer.*/ "End" = "End"; @@ -110,6 +116,9 @@ /*No comment provided by engineer.*/ "I think the app could be improved with…" = "Ik denk dat het programma verbeterd kan worden door…"; +/*No comment provided by engineer.*/ +"Ignore shortcuts while a window from these apps is active" = "Ignore shortcuts while a window from these apps is active"; + /*No comment provided by engineer.*/ "Latest releases" = "Laatste releases"; @@ -143,6 +152,9 @@ /*Copyright (human-readable)*/ "NSHumanReadableCopyright" = "GPL 3.0-licentie"; +/*No comment provided by engineer.*/ +"Only if the window is fullscreen" = "Only if the window is fullscreen"; + /*No comment provided by engineer.*/ "Open Accessibility Preferences…" = "Open Accessibility Preferences…"; diff --git a/resources/l10n/pt-BR.lproj/Localizable.strings b/resources/l10n/pt-BR.lproj/Localizable.strings index 09b0bc47..a8f0c2bf 100644 --- a/resources/l10n/pt-BR.lproj/Localizable.strings +++ b/resources/l10n/pt-BR.lproj/Localizable.strings @@ -56,6 +56,9 @@ /*No comment provided by engineer.*/ "Auto-install updates periodically" = "Instalar atualizações periódicas automaticamente"; +/*No comment provided by engineer.*/ +"Blacklists" = "Blacklists"; + /*Cancel button*/ "Cancel" = "Cancelar"; @@ -80,6 +83,9 @@ /*No comment provided by engineer.*/ "Don’t check for updates periodically" = "Não verifique periodicamente por atualizações"; +/*No comment provided by engineer.*/ +"Don’t show windows from these apps" = "Don’t show windows from these apps"; + /*No comment provided by engineer.*/ "End" = "End"; @@ -110,6 +116,9 @@ /*No comment provided by engineer.*/ "I think the app could be improved with…" = "Eu acho que a aplicação poderia ser melhorada com…"; +/*No comment provided by engineer.*/ +"Ignore shortcuts while a window from these apps is active" = "Ignore shortcuts while a window from these apps is active"; + /*No comment provided by engineer.*/ "Latest releases" = "Últimas atualizações"; @@ -143,6 +152,9 @@ /*Copyright (human-readable)*/ "NSHumanReadableCopyright" = "Licença GPL-3.0"; +/*No comment provided by engineer.*/ +"Only if the window is fullscreen" = "Only if the window is fullscreen"; + /*No comment provided by engineer.*/ "Open Accessibility Preferences…" = "Open Accessibility Preferences…"; diff --git a/resources/l10n/ru.lproj/Localizable.strings b/resources/l10n/ru.lproj/Localizable.strings index 093706be..4f10bd72 100644 --- a/resources/l10n/ru.lproj/Localizable.strings +++ b/resources/l10n/ru.lproj/Localizable.strings @@ -56,6 +56,9 @@ /*No comment provided by engineer.*/ "Auto-install updates periodically" = "Автоматически устанавливать обновления"; +/*No comment provided by engineer.*/ +"Blacklists" = "Blacklists"; + /*Cancel button*/ "Cancel" = "Отмена"; @@ -80,6 +83,9 @@ /*No comment provided by engineer.*/ "Don’t check for updates periodically" = "Не проверять обновления"; +/*No comment provided by engineer.*/ +"Don’t show windows from these apps" = "Don’t show windows from these apps"; + /*No comment provided by engineer.*/ "End" = "End"; @@ -110,6 +116,9 @@ /*No comment provided by engineer.*/ "I think the app could be improved with…" = "Я думаю, что приложение может быть улучшено…"; +/*No comment provided by engineer.*/ +"Ignore shortcuts while a window from these apps is active" = "Ignore shortcuts while a window from these apps is active"; + /*No comment provided by engineer.*/ "Latest releases" = "Последние обновления"; @@ -143,6 +152,9 @@ /*Copyright (human-readable)*/ "NSHumanReadableCopyright" = "Лицензия GPL-3.0"; +/*No comment provided by engineer.*/ +"Only if the window is fullscreen" = "Only if the window is fullscreen"; + /*No comment provided by engineer.*/ "Open Accessibility Preferences…" = "Open Accessibility Preferences…"; diff --git a/resources/l10n/tr.lproj/Localizable.strings b/resources/l10n/tr.lproj/Localizable.strings index ea92c693..6e93153f 100644 --- a/resources/l10n/tr.lproj/Localizable.strings +++ b/resources/l10n/tr.lproj/Localizable.strings @@ -56,6 +56,9 @@ /*No comment provided by engineer.*/ "Auto-install updates periodically" = "Güncellemeleri periyodik olarak otomatik yükle"; +/*No comment provided by engineer.*/ +"Blacklists" = "Blacklists"; + /*Cancel button*/ "Cancel" = "İptal"; @@ -80,6 +83,9 @@ /*No comment provided by engineer.*/ "Don’t check for updates periodically" = "Güncellemeleri periyodik olarak kontrol etme"; +/*No comment provided by engineer.*/ +"Don’t show windows from these apps" = "Don’t show windows from these apps"; + /*No comment provided by engineer.*/ "End" = "End"; @@ -110,6 +116,9 @@ /*No comment provided by engineer.*/ "I think the app could be improved with…" = "Bence uygulama … ile geliştirilebilir."; +/*No comment provided by engineer.*/ +"Ignore shortcuts while a window from these apps is active" = "Ignore shortcuts while a window from these apps is active"; + /*No comment provided by engineer.*/ "Latest releases" = "Son sürüm"; @@ -143,6 +152,9 @@ /*Copyright (human-readable)*/ "NSHumanReadableCopyright" = "GPL-3.0 lisansı"; +/*No comment provided by engineer.*/ +"Only if the window is fullscreen" = "Only if the window is fullscreen"; + /*No comment provided by engineer.*/ "Open Accessibility Preferences…" = "Open Accessibility Preferences…"; diff --git a/resources/l10n/zh-CN.lproj/Localizable.strings b/resources/l10n/zh-CN.lproj/Localizable.strings index 181ca5a6..0c273798 100644 --- a/resources/l10n/zh-CN.lproj/Localizable.strings +++ b/resources/l10n/zh-CN.lproj/Localizable.strings @@ -56,6 +56,9 @@ /*No comment provided by engineer.*/ "Auto-install updates periodically" = "定期自动安装更新"; +/*No comment provided by engineer.*/ +"Blacklists" = "Blacklists"; + /*Cancel button*/ "Cancel" = "取消"; @@ -80,6 +83,9 @@ /*No comment provided by engineer.*/ "Don’t check for updates periodically" = "不自动检查更新"; +/*No comment provided by engineer.*/ +"Don’t show windows from these apps" = "Don’t show windows from these apps"; + /*No comment provided by engineer.*/ "End" = "End"; @@ -110,6 +116,9 @@ /*No comment provided by engineer.*/ "I think the app could be improved with…" = "我认为该应用程序可以这样改进…"; +/*No comment provided by engineer.*/ +"Ignore shortcuts while a window from these apps is active" = "Ignore shortcuts while a window from these apps is active"; + /*No comment provided by engineer.*/ "Latest releases" = "最新版本"; @@ -143,6 +152,9 @@ /*Copyright (human-readable)*/ "NSHumanReadableCopyright" = "GPL-3.0 协议"; +/*No comment provided by engineer.*/ +"Only if the window is fullscreen" = "Only if the window is fullscreen"; + /*No comment provided by engineer.*/ "Open Accessibility Preferences…" = "打开辅助功能偏好设置"; diff --git a/resources/l10n/zh-TW.lproj/Localizable.strings b/resources/l10n/zh-TW.lproj/Localizable.strings index 7433aade..02052517 100644 --- a/resources/l10n/zh-TW.lproj/Localizable.strings +++ b/resources/l10n/zh-TW.lproj/Localizable.strings @@ -56,6 +56,9 @@ /*No comment provided by engineer.*/ "Auto-install updates periodically" = "定期自動安裝更新"; +/*No comment provided by engineer.*/ +"Blacklists" = "Blacklists"; + /*Cancel button*/ "Cancel" = "取消"; @@ -80,6 +83,9 @@ /*No comment provided by engineer.*/ "Don’t check for updates periodically" = "不要定期自動檢查更新"; +/*No comment provided by engineer.*/ +"Don’t show windows from these apps" = "Don’t show windows from these apps"; + /*No comment provided by engineer.*/ "End" = "End"; @@ -110,6 +116,9 @@ /*No comment provided by engineer.*/ "I think the app could be improved with…" = "我認為這個 app 可以改善在…"; +/*No comment provided by engineer.*/ +"Ignore shortcuts while a window from these apps is active" = "Ignore shortcuts while a window from these apps is active"; + /*No comment provided by engineer.*/ "Latest releases" = "最新版本"; @@ -143,6 +152,9 @@ /*Copyright (human-readable)*/ "NSHumanReadableCopyright" = "GPL-3.0 授權"; +/*No comment provided by engineer.*/ +"Only if the window is fullscreen" = "Only if the window is fullscreen"; + /*No comment provided by engineer.*/ "Open Accessibility Preferences…" = "Open Accessibility Preferences…"; diff --git a/src/logic/Preferences.swift b/src/logic/Preferences.swift index 7e8ba157..3f6f8322 100644 --- a/src/logic/Preferences.swift +++ b/src/logic/Preferences.swift @@ -37,7 +37,10 @@ class Preferences { "fadeOutAnimation": "false", "hideSpaceNumberLabels": "false", "startAtLogin": "true", - "hideMenubarIcon": "false" + "hideMenubarIcon": "false", + "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"), + "disableShortcutsBlacklistOnlyFullscreen": "true", ] // constant values @@ -75,6 +78,9 @@ class Preferences { static var hideSpaceNumberLabels: Bool { defaults.bool("hideSpaceNumberLabels") } static var startAtLogin: Bool { defaults.bool("startAtLogin") } static var hideMenubarIcon: Bool { defaults.bool("hideMenubarIcon") } + static var dontShowBlacklist: [String] { blacklistStringToArray(defaults.string("dontShowBlacklist")) } + static var disableShortcutsBlacklist: [String] { blacklistStringToArray(defaults.string("disableShortcutsBlacklist")) } + static var disableShortcutsBlacklistOnlyFullscreen: Bool { defaults.bool("disableShortcutsBlacklistOnlyFullscreen") } // macro values static var theme: ThemePreference { defaults.macroPref("theme", ThemePreference.allCases) } @@ -137,6 +143,10 @@ class Preferences { defaults.set(new, forKey: preference) } } + + static func blacklistStringToArray(_ blacklist: String) -> [String] { + return blacklist.components(separatedBy: "\n").map { $0.trimmingCharacters(in: .whitespaces) } + } } // MacroPreference are collection of values derived from a single key diff --git a/src/logic/Windows.swift b/src/logic/Windows.swift index 270b9ce0..e873e4fd 100644 --- a/src/logic/Windows.swift +++ b/src/logic/Windows.swift @@ -102,7 +102,8 @@ class Windows { !(Preferences.appsToShow == .active && window.application.runningApplication != NSWorkspace.shared.frontmostApplication) && !(Preferences.spacesToShow == .active && window.spaceId != Spaces.currentSpaceId) && !(Preferences.screensToShow == .showingAltTab && !isOnScreen(window, screen)) && - (Preferences.showTabsAsWindows || !window.isTabbed) + (Preferences.showTabsAsWindows || !window.isTabbed) && + !Preferences.dontShowBlacklist.contains(window.application.runningApplication.bundleIdentifier ?? "") } static func isOnScreen(_ window: Window, _ screen: NSScreen) -> Bool { @@ -113,4 +114,14 @@ class Windows { } return true } + + static func checkIfShortcutsShouldBeDisabled() { + let activeWindow = list[0] + App.app.shortcutsShouldBeDisabled = + Preferences.disableShortcutsBlacklist.contains(activeWindow.application.runningApplication.bundleIdentifier ?? "") && + (!Preferences.disableShortcutsBlacklistOnlyFullscreen || activeWindow.isFullscreen) + if App.app.shortcutsShouldBeDisabled && App.app.appIsBeingUsed { + App.app.hideUi() + } + } } diff --git a/src/logic/events/AccessibilityEvents.swift b/src/logic/events/AccessibilityEvents.swift index 914ee448..b8a3fffe 100644 --- a/src/logic/events/AccessibilityEvents.swift +++ b/src/logic/events/AccessibilityEvents.swift @@ -74,6 +74,7 @@ private func applicationActivated(_ element: AXUIElement) throws { guard let existingIndex = Windows.list.firstIndexThatMatches(appFocusedWindow, wid) else { return } Windows.list.insertAndScaleRecycledPool(Windows.list.remove(at: existingIndex), at: 0) App.app.refreshOpenUi([Windows.list[0], Windows.list[existingIndex]]) + Windows.checkIfShortcutsShouldBeDisabled() } } } @@ -135,6 +136,7 @@ private func focusedWindowChanged(_ element: AXUIElement, _ pid: pid_t) throws { Windows.list.insertAndScaleRecycledPool(Window(element, app, wid, axTitle, isFullscreen, isMinimized, position), at: 0) App.app.refreshOpenUi([Windows.list[0]]) } + Windows.checkIfShortcutsShouldBeDisabled() } } } @@ -184,6 +186,7 @@ private func windowResized(_ element: AXUIElement) throws { let window = Windows.list[index] window.isFullscreen = isFullscreen App.app.refreshOpenUi([window]) + Windows.checkIfShortcutsShouldBeDisabled() } } } diff --git a/src/logic/events/KeyboardEvents.swift b/src/logic/events/KeyboardEvents.swift index bbe7209f..c80476c1 100644 --- a/src/logic/events/KeyboardEvents.swift +++ b/src/logic/events/KeyboardEvents.swift @@ -24,7 +24,7 @@ private func observe_() { } private func keyboardHandler(proxy: CGEventTapProxy, type: CGEventType, cgEvent: CGEvent, userInfo: UnsafeMutableRawPointer?) -> Unmanaged? { - if type == .keyDown || type == .keyUp || type == .flagsChanged { + if (type == .keyDown || type == .keyUp || type == .flagsChanged) && !App.app.shortcutsShouldBeDisabled { if let event_ = NSEvent(cgEvent: cgEvent), // workaround: NSEvent.characters is not safe outside of the main thread; this is not documented by Apple // see https://github.com/Kentzo/ShortcutRecorder/issues/114#issuecomment-606465340 diff --git a/src/ui/App.swift b/src/ui/App.swift index 51eb3e7f..5c0ea63b 100644 --- a/src/ui/App.swift +++ b/src/ui/App.swift @@ -8,6 +8,7 @@ let cgsMainConnectionId = CGSMainConnectionID() class App: NSApplication, NSApplicationDelegate { static let name = Bundle.main.object(forInfoDictionaryKey: "CFBundleName") as! String + static let id = Bundle.main.object(forInfoDictionaryKey: "CFBundleIdentifier") as! String static let version = Bundle.main.object(forInfoDictionaryKey: "CFBundleVersion") as! String static let licence = Bundle.main.object(forInfoDictionaryKey: "NSHumanReadableCopyright") as! String static let repository = "https://github.com/lwouis/alt-tab-macos" @@ -19,6 +20,7 @@ class App: NSApplication, NSApplicationDelegate { var feedbackWindow: FeedbackWindow? var isFirstSummon = true var appIsBeingUsed = false + var shortcutsShouldBeDisabled = false override init() { super.init() @@ -71,6 +73,7 @@ class App: NSApplication, NSApplicationDelegate { GeneralTab(), AppearanceTab(), UpdatesTab(), + BlacklistsTab(), AboutTab(), AcknowledgmentsTab(), ] diff --git a/src/ui/generic-components/text/TextArea.swift b/src/ui/generic-components/text/TextArea.swift index b6293cc9..97230194 100644 --- a/src/ui/generic-components/text/TextArea.swift +++ b/src/ui/generic-components/text/TextArea.swift @@ -9,8 +9,8 @@ class TextArea: NSTextField, NSTextFieldDelegate { self.callback = callback delegate = self cell = TextFieldCell(placeholder, nLinesHigh == 1) - let width: CGFloat = font!.xHeight * nCharactersWide + TextArea.padding * 2 - let height: CGFloat = fittingSize.height * CGFloat(nLinesHigh) + TextArea.padding * 2 + let width: CGFloat = (font!.xHeight * nCharactersWide + TextArea.padding * 2).rounded() + let height: CGFloat = (fittingSize.height * CGFloat(nLinesHigh) + TextArea.padding * 2).rounded() fit(width, height) } diff --git a/src/ui/preferences-window/LabelAndControl.swift b/src/ui/preferences-window/LabelAndControl.swift index 1429f489..f3f1cd75 100644 --- a/src/ui/preferences-window/LabelAndControl.swift +++ b/src/ui/preferences-window/LabelAndControl.swift @@ -22,6 +22,17 @@ class LabelAndControl: NSObject { return views } + static func makeTextArea(_ nCharactersWide: CGFloat, _ nLinesHigh: Int, _ placeholder: String, _ rawName: String, extraAction: ActionClosure? = nil) -> [NSView] { + let textArea = TextArea(nCharactersWide, nLinesHigh, placeholder) + textArea.callback = { + controlWasChanged(textArea) + extraAction?(textArea) + } + textArea.identifier = NSUserInterfaceItemIdentifier(rawName) + textArea.stringValue = Preferences.getString(rawName)! + return [textArea] + } + static func makeLabelWithDropdown(_ labelText: String, _ rawName: String, _ values: [MacroPreference], _ suffixText: String? = nil) -> [NSView] { return makeLabelWithProvidedControl(labelText, rawName, makeDropDown(rawName, values), suffixText) } diff --git a/src/ui/preferences-window/tabs/BlacklistsTab.swift b/src/ui/preferences-window/tabs/BlacklistsTab.swift new file mode 100644 index 00000000..5abd3369 --- /dev/null +++ b/src/ui/preferences-window/tabs/BlacklistsTab.swift @@ -0,0 +1,28 @@ +import Cocoa +import Sparkle +import Preferences + +class BlacklistsTab: NSViewController, PreferencePane { + let preferencePaneIdentifier = PreferencePane.Identifier("Blacklists") + let preferencePaneTitle = NSLocalizedString("Blacklists", comment: "") + let toolbarItemIcon = NSImage(named: "NSScriptTemplate")! + + override func loadView() { + let dontShowBlacklistLabel = NSTextField(labelWithString: NSLocalizedString("Don’t show windows from these apps", comment: "")) + let dontShowBlacklist = LabelAndControl.makeTextArea(50, 3, ["com.apple.Safari", "com.apple.TextEdit"].joined(separator: "\n"), "dontShowBlacklist") + let disableShortcutsBlacklistLabel = NSTextField(labelWithString: NSLocalizedString("Ignore shortcuts while a window from these apps is active", comment: "")) + let disableShortcutsBlacklistCheckbox = LabelAndControl.makeLabelWithCheckbox(NSLocalizedString("Only if the window is fullscreen", comment: ""), "disableShortcutsBlacklistOnlyFullscreen", labelPosition: .right) + let disableShortcutsBlacklist = LabelAndControl.makeTextArea(50, 3, ["com.apple.Safari", "com.apple.TextEdit"].joined(separator: "\n"), "disableShortcutsBlacklist") + + let grid = GridView([ + [dontShowBlacklistLabel], + dontShowBlacklist, + [disableShortcutsBlacklistLabel], + disableShortcutsBlacklistCheckbox, + disableShortcutsBlacklist, + ]) + grid.row(at: 2).topPadding = GridView.interPadding * 1.5 + grid.fit() + view = grid + } +}