feat: allow per-shortcut release action preference (closes #573)

This commit is contained in:
Louis Pontoise authored and lwouis committed 2020-09-05 04:01:32 +09:00
1 parent 7218418f6d
commit 2a9c33b078
25 files changed
+28 -27

No files matched your search

+1 -1
View File
@@ -299,7 +299,7 @@
"Theme:" = "Theme:";
/* No comment provided by engineer. */
"then release:" = "then release:";
"Then release:" = "Then release:";
/* No comment provided by engineer. */
"This permission is needed to focus windows after you release the shortcut" = "This permission is needed to focus windows after you release the shortcut";
+1 -1
View File
@@ -303,7 +303,7 @@
"Theme:" = "المظهر:";
/*No comment provided by engineer.*/
"then release:" = "then release:";
"Then release:" = "Then release:";
/*No comment provided by engineer.*/
"This permission is needed to focus windows after you release the shortcut" = "This permission is needed to focus windows after you release the shortcut";
+1 -1
View File
@@ -303,7 +303,7 @@
"Theme:" = "Thema:";
/*No comment provided by engineer.*/
"then release:" = "dann loslassen:";
"Then release:" = "Dann loslassen:";
/*No comment provided by engineer.*/
"This permission is needed to focus windows after you release the shortcut" = "Diese Erlaubnis ist nötig um Fenster nach dem Drücken des Tastenkürzels anzuzeigen";
+1 -1
View File
@@ -303,7 +303,7 @@
"Theme:" = "Theme:";
/*No comment provided by engineer.*/
"then release:" = "then release:";
"Then release:" = "Then release:";
/*No comment provided by engineer.*/
"This permission is needed to focus windows after you release the shortcut" = "This permission is needed to focus windows after you release the shortcut";
+1 -1
View File
@@ -303,7 +303,7 @@
"Theme:" = "Tema:";
/*No comment provided by engineer.*/
"then release:" = "then release:";
"Then release:" = "Then release:";
/*No comment provided by engineer.*/
"This permission is needed to focus windows after you release the shortcut" = "This permission is needed to focus windows after you release the shortcut";
+1 -1
View File
@@ -303,7 +303,7 @@
"Theme:" = "Teema:";
/*No comment provided by engineer.*/
"then release:" = "sitten päästä:";
"Then release:" = "Sitten päästä:";
/*No comment provided by engineer.*/
"This permission is needed to focus windows after you release the shortcut" = "Tarvitaan ikkunoiden valitsemiseksi";
+1 -1
View File
@@ -303,7 +303,7 @@
"Theme:" = "Thème :";
/*No comment provided by engineer.*/
"then release:" = "puis relâcher :";
"Then release:" = "Puis relâcher :";
/*No comment provided by engineer.*/
"This permission is needed to focus windows after you release the shortcut" = "Cette permission est nécessaire pour afficher la fenêtre après le relâchement du raccourci clavier";
+1 -1
View File
@@ -303,7 +303,7 @@
"Theme:" = "Téma:";
/*No comment provided by engineer.*/
"then release:" = "majd engedje fel:";
"Then release:" = "Majd engedje fel:";
/*No comment provided by engineer.*/
"This permission is needed to focus windows after you release the shortcut" = "Ez a jogosultság ahhoz szükséges hogy az ablak fókuszba kerüljön miután a parancsikont elengedte";
+1 -1
View File
@@ -303,7 +303,7 @@
"Theme:" = "Tema:";
/*No comment provided by engineer.*/
"then release:" = "lalu lepaskan:";
"Then release:" = "Lalu lepaskan:";
/*No comment provided by engineer.*/
"This permission is needed to focus windows after you release the shortcut" = "Izin ini diperlukan untuk memfokuskan jendela setelah Anda melepaskan pintasan";
+1 -1
View File
@@ -303,7 +303,7 @@
"Theme:" = "Tema:";
/*No comment provided by engineer.*/
"then release:" = "then release:";
"Then release:" = "Then release:";
/*No comment provided by engineer.*/
"This permission is needed to focus windows after you release the shortcut" = "This permission is needed to focus windows after you release the shortcut";
+1 -1
View File
@@ -303,7 +303,7 @@
"Theme:" = "テーマ:";
/*No comment provided by engineer.*/
"then release:" = "離した時の動作:";
"Then release:" = "離した時の動作:";
/*No comment provided by engineer.*/
"This permission is needed to focus windows after you release the shortcut" = "こちらの許可は、ショートカットキーを離した後、ウィンドウにフォーカスするのに必要です。";
+1 -1
View File
@@ -303,7 +303,7 @@
"Theme:" = "테마:";
/*No comment provided by engineer.*/
"then release:" = "그리고 놓으면:";
"Then release:" = "그리고 놓으면:";
/*No comment provided by engineer.*/
"This permission is needed to focus windows after you release the shortcut" = "이 권한은 단축키를 사용했을 때 원하는 윈도우로 이동할 수 있게 해줍니다";
+1 -1
View File
@@ -303,7 +303,7 @@
"Theme:" = "Theme:";
/*No comment provided by engineer.*/
"then release:" = "then release:";
"Then release:" = "Then release:";
/*No comment provided by engineer.*/
"This permission is needed to focus windows after you release the shortcut" = "This permission is needed to focus windows after you release the shortcut";
+1 -1
View File
@@ -303,7 +303,7 @@
"Theme:" = "Thema:";
/*No comment provided by engineer.*/
"then release:" = "doe dan:";
"Then release:" = "Doe dan:";
/*No comment provided by engineer.*/
"This permission is needed to focus windows after you release the shortcut" = "Deze permissie is nodig om vensters te focussen na het uitvoeren van de snelkoppeling";
+1 -1
View File
@@ -303,7 +303,7 @@
"Theme:" = "Tema:";
/*No comment provided by engineer.*/
"then release:" = "så slipp:";
"Then release:" = "Så slipp:";
/*No comment provided by engineer.*/
"This permission is needed to focus windows after you release the shortcut" = "Denne tillatelsen er nødvendig for å kunne fokusere på vindu når du slipper hurtigtasten";
+1 -1
View File
@@ -304,7 +304,7 @@
"Theme:" = "Motyw:";
/*No comment provided by engineer.*/
"then release:" = "po czym wypuść:";
"Then release:" = "Po czym wypuść:";
/*No comment provided by engineer.*/
"This permission is needed to focus windows after you release the shortcut" = "To uprawnienie jest potrzebne, aby aktywować okna po zwolnieniu skrótu";
@@ -303,7 +303,7 @@
"Theme:" = "Tema:";
/*No comment provided by engineer.*/
"then release:" = "Ao soltar:";
"Then release:" = "Ao soltar:";
/*No comment provided by engineer.*/
"This permission is needed to focus windows after you release the shortcut" = "Esta permissão é necessária para focar a janela após acionar o atalho";
+1 -1
View File
@@ -303,7 +303,7 @@
"Theme:" = "Tema:";
/*No comment provided by engineer.*/
"then release:" = "depois soltar:";
"Then release:" = "Depois soltar:";
/*No comment provided by engineer.*/
"This permission is needed to focus windows after you release the shortcut" = "Esta permissão é necessária para dar foco em janelas após carregar nos atalhos";
+1 -1
View File
@@ -303,7 +303,7 @@
"Theme:" = "Тема:";
/*No comment provided by engineer.*/
"then release:" = "затем отпустить:";
"Then release:" = "Затем отпустить:";
/*No comment provided by engineer.*/
"This permission is needed to focus windows after you release the shortcut" = "Это разрешение нужно для фокусировки окна после отпускания комбинации клавиш";
+1 -1
View File
@@ -303,7 +303,7 @@
"Theme:" = "Tema:";
/*No comment provided by engineer.*/
"then release:" = "then release:";
"Then release:" = "Then release:";
/*No comment provided by engineer.*/
"This permission is needed to focus windows after you release the shortcut" = "This permission is needed to focus windows after you release the shortcut";
@@ -303,7 +303,7 @@
"Theme:" = "主题:";
/*No comment provided by engineer.*/
"then release:" = "然后松开:";
"Then release:" = "然后松开:";
/*No comment provided by engineer.*/
"This permission is needed to focus windows after you release the shortcut" = "需要此权限在释放快捷键后切换鼠标焦点";
@@ -303,7 +303,7 @@
"Theme:" = "主題:";
/*No comment provided by engineer.*/
"then release:" = "然後放開:";
"Then release:" = "然後放開:";
/*No comment provided by engineer.*/
"This permission is needed to focus windows after you release the shortcut" = "需要取得此權限,才能在放開快速鍵後聚焦視窗";
+2 -1
View File
@@ -58,6 +58,7 @@ class Preferences {
"minCellsPerRow": defaultsDependingOnScreenRatio_["minCellsPerRow"]!,
"maxCellsPerRow": defaultsDependingOnScreenRatio_["maxCellsPerRow"]!,
"shortcutStyle": "0",
"shortcutStyle2": "0",
"hideAppBadges": "false",
"hideWindowlessApps": "false",
"hideThumbnails": "false",
@@ -116,7 +117,7 @@ class Preferences {
static var appsToShow: [AppsToShowPreference] { ["appsToShow", "appsToShow2"].map { defaults.macroPref($0, AppsToShowPreference.allCases) } }
static var spacesToShow: [SpacesToShowPreference] { ["spacesToShow", "spacesToShow2"].map { defaults.macroPref($0, SpacesToShowPreference.allCases) } }
static var screensToShow: [ScreensToShowPreference] { ["screensToShow", "screensToShow2"].map { defaults.macroPref($0, ScreensToShowPreference.allCases) } }
static var shortcutStyle: ShortcutStylePreference { defaults.macroPref("shortcutStyle", ShortcutStylePreference.allCases) }
static var shortcutStyle: [ShortcutStylePreference] { ["shortcutStyle", "shortcutStyle2"].map { defaults.macroPref($0, ShortcutStylePreference.allCases) } }
static var menubarIcon: MenubarIconPreference { defaults.macroPref("menubarIcon", MenubarIconPreference.allCases) }
// derived values
+2 -2
View File
@@ -118,7 +118,7 @@ fileprivate func handleHotModifier(_ modifiers: UInt32) -> Bool {
let otherKey = key == "holdShortcut" ? "holdShortcut2" : "holdShortcut"
KeyboardEvents.holdShortcutWasDown[key] = false
}
if Preferences.shortcutStyle == .focusOnRelease && handleHotAny(key, shortcutIndex) {
if Preferences.shortcutStyle[App.app.shortcutIndex] == .focusOnRelease && handleHotAny(key, shortcutIndex) {
return true
}
}
@@ -151,7 +151,7 @@ fileprivate func localShortcutThatMatches(_ event: NSEvent) -> String? {
if shortcutId.hasPrefix("holdShortcut") {
let postfix = App.app.shortcutIndex == 0 ? "" : "2"
if event.sr_keyEventType == .up && event.type == .flagsChanged && shortcut.keyCode == .none && event.modifierFlags.isDisjoint(with: shortcut.modifierFlags) &&
shortcutId == "holdShortcut" + postfix && App.app.appIsBeingUsed && Preferences.shortcutStyle == .focusOnRelease {
shortcutId == "holdShortcut" + postfix && App.app.appIsBeingUsed && Preferences.shortcutStyle[App.app.shortcutIndex] == .focusOnRelease {
return shortcutId
}
} else if event.sr_keyEventType == .down && (shortcut.keyCode == .none || event.keyCode == shortcut.carbonKeyCode) &&
@@ -24,7 +24,6 @@ class ControlsTab {
]
static func initTab() -> NSView {
let shortcutStyle = LabelAndControl.makeLabelWithDropdown(NSLocalizedString("then release:", comment: ""), "shortcutStyle", ShortcutStylePreference.allCases)
let focusWindowShortcut = LabelAndControl.makeLabelWithRecorder(NSLocalizedString("Focus selected window", comment: ""), "focusWindowShortcut", Preferences.focusWindowShortcut, labelPosition: .right)
let previousWindowShortcut = LabelAndControl.makeLabelWithRecorder(NSLocalizedString("Select previous window", comment: ""), "previousWindowShortcut", Preferences.previousWindowShortcut, labelPosition: .right)
let cancelShortcut = LabelAndControl.makeLabelWithRecorder(NSLocalizedString("Cancel and hide", comment: ""), "cancelShortcut", Preferences.cancelShortcut, labelPosition: .right)
@@ -47,7 +46,6 @@ class ControlsTab {
let grid = GridView([
[tabView],
shortcutStyle,
[orPress, shortcuts],
[checkboxesExplanations, checkboxes],
])
@@ -81,12 +79,14 @@ class ControlsTab {
let showHiddenWindows = StackView(LabelAndControl.makeLabelWithCheckbox(NSLocalizedString("Hidden", comment: ""), "showHiddenWindows" + postfix, labelPosition: .right))
let showFullscreenWindows = StackView(LabelAndControl.makeLabelWithCheckbox(NSLocalizedString("Fullscreen", comment: ""), "showFullscreenWindows" + postfix, labelPosition: .right))
let nextWindowShortcut = LabelAndControl.makeLabelWithRecorder(NSLocalizedString("Select next window", comment: ""), "nextWindowShortcut" + postfix, Preferences.nextWindowShortcut[postfix == "" ? 0 : 1], labelPosition: .right)
let shortcutStyle = LabelAndControl.makeLabelWithDropdown(NSLocalizedString("Then release:", comment: ""), "shortcutStyle" + postfix, ShortcutStylePreference.allCases)
let toShowDropdowns = StackView([appsToShow, spacesToShow, screensToShow, showMinimizedWindows, showHiddenWindows, showFullscreenWindows], .vertical, false)
toShowDropdowns.spacing = TabView.padding
toShowDropdowns.fit()
let tab = GridView([
[toShowExplanations, toShowDropdowns],
[holdAndPress, StackView(nextWindowShortcut)],
shortcutStyle,
], TabView.padding)
tab.column(at: 0).xPlacement = .trailing
tab.fit()