Skip to content
Merged
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
5 changes: 5 additions & 0 deletions Amethyst/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,11 @@ class AppDelegate: NSObject, NSApplicationDelegate {
windowManager?.markAllScreensForReflow(withChange: .unknown)
}

@IBAction func resetLayouts(_ sender: AnyObject) {
UserDefaults.standard.removeObject(forKey: AppDelegate.windowManagerEncodingKey)
windowManager?.reset()
}

@IBAction func relaunch(_ sender: AnyObject) {
AppManager.relaunch()
}
Expand Down
14 changes: 10 additions & 4 deletions Amethyst/Base.lproj/MainMenu.xib
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="23504" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="23727" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="23504"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="23727"/>
<capability name="Image references" minToolsVersion="12.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
Expand Down Expand Up @@ -45,10 +45,16 @@
<action selector="checkForUpdates:" target="494" id="l9Y-Ct-Bzq"/>
</connections>
</menuItem>
<menuItem title="Relaunch Amethyst" id="8DH-wG-R1x">
<menuItem title="Reset Layouts" id="8DH-wG-R1x">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="relaunch:" target="494" id="SdJ-ap-5Vy"/>
<action selector="resetLayouts:" target="494" id="Osy-WG-Dy8"/>
</connections>
</menuItem>
<menuItem title="Relaunch Amethyst" id="crd-PN-Vy2">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="relaunch:" target="494" id="EeN-oj-Mtv"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="553"/>
Expand Down
8 changes: 7 additions & 1 deletion Amethyst/Managers/WindowManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ final class WindowManager<Application: ApplicationType>: NSObject, Codable {

private var applications: [pid_t: AnyApplication<Application>] = [:]
private var applicationObservations: [pid_t: UndeterminedApplication] = [:]
private let screens: Screens
private var screens: Screens
private let windows = Windows()
private var lastReflowTime = Date()
private var lastFocusDate: Date?
Expand Down Expand Up @@ -103,6 +103,12 @@ final class WindowManager<Application: ApplicationType>: NSObject, Codable {
NotificationCenter.default.removeObserver(self)
}

func reset() {
screens = Screens()
reevaluateWindows()
screens.updateScreens(windowManager: self)
}

private func addWorkspaceNotificationObserver(_ name: NSNotification.Name, selector: Selector) {
let workspaceNotificationCenter = NSWorkspace.shared.notificationCenter
workspaceNotificationCenter.addObserver(self, selector: selector, name: name, object: nil)
Expand Down
Loading