-
-
Notifications
You must be signed in to change notification settings - Fork 330
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add option to minimize other windows when switching #2290
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -114,6 +114,14 @@ class Windows { | |
return list.count > focusedWindowIndex ? list[focusedWindowIndex] : nil | ||
} | ||
|
||
static func minimizeOtherWindows() { | ||
Windows.list.enumerated().forEach { | ||
if $0.offset != focusedWindowIndex && !$0.element.isMinimized && !$0.element.isWindowlessApp && $0.element.shouldShowTheUser { | ||
$0.element.minDemin() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You check Same logic will keep some windows on-screen, depending on the shortcut filtereing logic behind Another point: I wonder if people will expect this single-window mode to be per-Space and/or per-Screen. I'm not sure users expect windows in every Space and on every Screen to minimize when they go for this type of workflow. Maybe they would like to have a "main window" per Screen? What do you think? |
||
} | ||
} | ||
} | ||
|
||
static func cycleFocusedWindowIndex(_ step: Int) { | ||
let nextIndex = windowIndexAfterCycling(step) | ||
if ((step > 0 && nextIndex < focusedWindowIndex) || (step < 0 && nextIndex > focusedWindowIndex)) && | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,11 +5,11 @@ class ControlsTab { | |
static var shortcuts = [String: ATShortcut]() | ||
static var shortcutControls = [String: (CustomRecorderControl, String)]() | ||
static var shortcutsActions = [ | ||
"holdShortcut": { App.app.focusTarget() }, | ||
"holdShortcut2": { App.app.focusTarget() }, | ||
"holdShortcut3": { App.app.focusTarget() }, | ||
"holdShortcut4": { App.app.focusTarget() }, | ||
"holdShortcut5": { App.app.focusTarget() }, | ||
"holdShortcut": { App.app.handleHold(0) }, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure about the name of this function, but I can't think of a better one :-) |
||
"holdShortcut2": { App.app.handleHold(1) }, | ||
"holdShortcut3": { App.app.handleHold(2) }, | ||
"holdShortcut4": { App.app.handleHold(3) }, | ||
"holdShortcut5": { App.app.handleHold(4) }, | ||
"focusWindowShortcut": { App.app.focusTarget() }, | ||
"nextWindowShortcut": { App.app.showUiOrCycleSelection(0) }, | ||
"nextWindowShortcut2": { App.app.showUiOrCycleSelection(1) }, | ||
|
@@ -26,6 +26,7 @@ class ControlsTab { | |
"minDeminWindowShortcut": { App.app.minDeminSelectedWindow() }, | ||
"quitAppShortcut": { App.app.quitSelectedApp() }, | ||
"hideShowAppShortcut": { App.app.hideShowSelectedApp() }, | ||
"minimizeOtherWindowsShortcut": { App.app.minimizeOtherWindows() }, | ||
] | ||
static var arrowKeysCheckbox: NSButton! | ||
|
||
|
@@ -37,6 +38,7 @@ class ControlsTab { | |
let minDeminWindowShortcut = LabelAndControl.makeLabelWithRecorder(NSLocalizedString("Minimize/Deminimize window", comment: ""), "minDeminWindowShortcut", Preferences.minDeminWindowShortcut, labelPosition: .right) | ||
let quitAppShortcut = LabelAndControl.makeLabelWithRecorder(NSLocalizedString("Quit app", comment: ""), "quitAppShortcut", Preferences.quitAppShortcut, labelPosition: .right) | ||
let hideShowAppShortcut = LabelAndControl.makeLabelWithRecorder(NSLocalizedString("Hide/Show app", comment: ""), "hideShowAppShortcut", Preferences.hideShowAppShortcut, labelPosition: .right) | ||
let minimizeOtherWindowsShortcut = LabelAndControl.makeLabelWithRecorder(NSLocalizedString("Minimize other windows", comment: ""), "minimizeOtherWindowsShortcut", Preferences.minimizeOtherWindowsShortcut, labelPosition: .right) | ||
let enableArrows = LabelAndControl.makeLabelWithCheckbox(NSLocalizedString("Arrow keys", comment: ""), "arrowKeysEnabled", extraAction: ControlsTab.arrowKeysEnabledCallback, labelPosition: .right) | ||
arrowKeysCheckbox = enableArrows[0] as? NSButton | ||
let enableMouse = LabelAndControl.makeLabelWithCheckbox(NSLocalizedString("Mouse hover", comment: ""), "mouseHoverEnabled", labelPosition: .right) | ||
|
@@ -45,7 +47,7 @@ class ControlsTab { | |
let selectWindowCheckboxes = StackView([StackView(enableArrows), StackView(enableMouse)], .vertical) | ||
let miscCheckboxesExplanations = LabelAndControl.makeLabel(NSLocalizedString("Miscellaneous:", comment: "")) | ||
let miscCheckboxes = StackView([StackView(enableCursorFollowFocus)], .vertical) | ||
let shortcuts = StackView([focusWindowShortcut, previousWindowShortcut, cancelShortcut, closeWindowShortcut, minDeminWindowShortcut, quitAppShortcut, hideShowAppShortcut].map { (view: [NSView]) in StackView(view) }, .vertical) | ||
let shortcuts = StackView([focusWindowShortcut, previousWindowShortcut, cancelShortcut, closeWindowShortcut, minDeminWindowShortcut, quitAppShortcut, hideShowAppShortcut, minimizeOtherWindowsShortcut].map { (view: [NSView]) in StackView(view) }, .vertical) | ||
let orPress = LabelAndControl.makeLabel(NSLocalizedString("While open, press:", comment: ""), shouldFit: false) | ||
let (holdShortcut, nextWindowShortcut, tab1View) = toShowSection(0) | ||
let (holdShortcut2, nextWindowShortcut2, tab2View) = toShowSection(1) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think adding the option to minimize other windows is not adding much noise in the existing dropdown "on release:". However, as a secondary shortcut like quit/hide/etc, I think it's too niche to have such a prominent UI in the preferences. This shortcut
1
would also conflict with #210. I think the feature is a bit too niche to have a dedicated shortcut as such.