Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions Amethyst/Managers/WindowManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -958,6 +958,18 @@ extension WindowManager: ApplicationObservationDelegate {
}

func applicationDidActivate(_ application: AnyApplication<Application>) {
if userConfiguration.unminimizeOnActivate() {
// The window list is cached and may predate windows opened since; refresh it.
application.dropWindowsCache()
// Ignore panels/utility/invisible windows, which are never "minimized" and would block the check below.
let standardWindows = application.windows().compactMap { $0 as? SIWindow }.filter { $0.isNormalWindow() }
let minimizedWindows = standardWindows.filter { $0.isWindowMinimized() }
// Only when every window is minimized (the cmd+tab case), so clicking an app with a visible window leaves the rest alone.
if !minimizedWindows.isEmpty && minimizedWindows.count == standardWindows.count {
minimizedWindows.forEach { $0.unMinimize() }
}
}

NSObject.cancelPreviousPerformRequests(
withTarget: self,
selector: #selector(applicationActivated(_:)),
Expand Down
25 changes: 18 additions & 7 deletions Amethyst/Preferences/GeneralPreferencesViewController.xib
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
</customObject>
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customView id="LsO-9M-hEw" userLabel="General Preferences">
<rect key="frame" x="0.0" y="0.0" width="548" height="580"/>
<rect key="frame" x="0.0" y="0" width="548" height="600"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<subviews>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="luh-Gm-ZV0">
Expand Down Expand Up @@ -385,7 +385,7 @@
</textFieldCell>
</textField>
<button fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="pGc-zn-uC7">
<rect key="frame" x="192" y="534" width="133" height="18"/>
<rect key="frame" x="192" y="554" width="133" height="18"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="check" title="Ignore menu bars" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="LKn-n5-1ay">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
Expand All @@ -396,7 +396,7 @@
</connections>
</button>
<button fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Xay-gW-zGw">
<rect key="frame" x="192" y="514" width="223" height="18"/>
<rect key="frame" x="192" y="534" width="223" height="18"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="check" title="Send new windows to main pane" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="stG-cM-1bg">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
Expand All @@ -407,7 +407,7 @@
</connections>
</button>
<button fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="hed-5T-mt5">
<rect key="frame" x="192" y="494" width="265" height="18"/>
<rect key="frame" x="192" y="514" width="265" height="18"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="check" title="Follow thrown windows between spaces" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="1GI-LA-8ET">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
Expand All @@ -418,7 +418,7 @@
</connections>
</button>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="eDY-rg-FIm">
<rect key="frame" x="132" y="533" width="56" height="17"/>
<rect key="frame" x="132" y="553" width="56" height="17"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="General:" id="oHM-Bk-m8H">
<font key="font" metaFont="system"/>
Expand Down Expand Up @@ -453,7 +453,7 @@
</connections>
</button>
<button fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="W2T-GM-Abn">
<rect key="frame" x="192" y="472" width="265" height="18"/>
<rect key="frame" x="192" y="492" width="265" height="18"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="check" title="Hide menu bar icon" bezelStyle="regularSquare" imagePosition="left" inset="2" id="Tdh-J4-2ut">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
Expand All @@ -464,7 +464,7 @@
</connections>
</button>
<button fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="R8T-3J-dLf">
<rect key="frame" x="192" y="452" width="265" height="18"/>
<rect key="frame" x="192" y="472" width="265" height="18"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="check" title="Start with tiling disabled" bezelStyle="regularSquare" imagePosition="left" inset="2" id="A9W-Ze-p4M">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
Expand All @@ -474,6 +474,17 @@
<binding destination="XhK-Tn-zrU" name="value" keyPath="values.start-with-tiling-disabled" id="8cg-jb-rY7"/>
</connections>
</button>
<button fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="umz-cm-tab">
<rect key="frame" x="192" y="452" width="300" height="18"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="check" title="Restore minimized windows on app switch" bezelStyle="regularSquare" imagePosition="left" inset="2" id="umz-cm-tab-cell">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
<connections>
<binding destination="XhK-Tn-zrU" name="value" keyPath="values.unminimize-on-activate" id="umz-cm-tab-bind"/>
</connections>
</button>
</subviews>
<point key="canvasLocation" x="561" y="274"/>
</customView>
Expand Down
5 changes: 5 additions & 0 deletions Amethyst/Preferences/UserConfiguration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ enum ConfigurationKey: String {
case disablePaddingOnBuiltinDisplay = "disable-padding-on-builtin-display"
case hideMenuBarIcon = "hide-menu-bar-icon"
case startWithTilingDisabled = "start-with-tiling-disabled"
case unminimizeOnActivate = "unminimize-on-activate"
}

extension ConfigurationKey: CaseIterable {}
Expand Down Expand Up @@ -777,6 +778,10 @@ class UserConfiguration: NSObject {
return storage.bool(forKey: .restoreLayoutsOnLaunch)
}

func unminimizeOnActivate() -> Bool {
return storage.bool(forKey: .unminimizeOnActivate)
}

func hideMenuBarIcon() -> Bool {
return storage.bool(forKey: .hideMenuBarIcon)
}
Expand Down
3 changes: 2 additions & 1 deletion Amethyst/default.amethyst
Original file line number Diff line number Diff line change
Expand Up @@ -234,5 +234,6 @@
"screen-padding-right": 0,
"debug-layout-info": false,
"restore-layouts-on-launch": true,
"start-with-tiling-disabled": false
"start-with-tiling-disabled": false,
"unminimize-on-activate": false
}
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,10 @@ This layout does not have a main pane in the way that other layouts do. When add

Custom layouts can be implemented via JavaScript. See [Custom Layouts](docs/custom-layouts.md).

### Restore Minimized Windows on App Switch

By default, switching to an app with cmd+tab leaves its windows minimized unless you hold option before releasing cmd. Enable "Restore minimized windows on app switch" in Preferences → General (or set `unminimize-on-activate` in the configuration file) to restore the app's windows automatically when all of them are minimized.

### Configuration File

Amethyst supports configuration via YAML in the home directory. See [Configuration Files](docs/configuration-files.md). Note that if configuration file is present, it will override the settings defined via the GUI.
Expand Down
1 change: 1 addition & 0 deletions docs/configuration-files.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ Amethyst will pick up a config file located at `~/.amethyst.yml` or `~/.config/a
| `screen-padding-top` | Padding to apply between windows and the top edge of the screen (in px, default `0`). |
| `screen-padding-bottom` | Padding to apply between windows and the bottom edge of the screen (in px, default `0`).
| `restore-layouts-on-launch` | `true` to maintain layout state across application executions (default `true`). |
| `unminimize-on-activate` | `true` to restore an application's minimized windows when it is activated (e.g. via cmd+tab) and none of its windows are visible, like holding option during cmd+tab (default `false`). |
| `debug-layout-info` | `true` to display some optional debug information in the layout HUD (default `false`). |
| `disable-padding-on-builtin-display` | `true` to disable screen padding on in-built display (default `false`). |
| `hide-menu-bar-icon` | `true` to hide the menu bar icon (default `false`). |
Expand Down