Show touch bar window during customization (#37)

* Show touch bar window during customization
* Add extra cases to NSWindow.Level
This commit is contained in:
ThatsJustCheesy 2019-04-16 16:08:48 -04:00 committed by GitHub
parent 6544744392
commit 23f7c1ca46
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 0 deletions

View file

@ -146,6 +146,7 @@ final class TouchBarWindow: NSPanel {
backing: .buffered,
defer: false
)
self.level = .assistiveTechHigh
self._setPreventsActivation(true)
self.isRestorable = true

View file

@ -220,3 +220,22 @@ func pressKey(keyCode: CGKeyCode, flags: CGEventFlags = []) {
keyDown?.post(tap: .cghidEventTap)
keyUp?.post(tap: .cghidEventTap)
}
extension NSWindow.Level {
private static func level(for cgLevelKey: CGWindowLevelKey) -> NSWindow.Level {
return NSWindow.Level(rawValue: Int(CGWindowLevelForKey(cgLevelKey)))
}
public static let desktop = level(for: .desktopWindow)
public static let desktopIcon = level(for: .desktopIconWindow)
public static let backstopMenu = level(for: .backstopMenu)
public static let dragging = level(for: .draggingWindow)
public static let overlay = level(for: .overlayWindow)
public static let help = level(for: .helpWindow)
public static let utility = level(for: .utilityWindow)
public static let assistiveTechHigh = level(for: .assistiveTechHighWindow)
public static let cursor = level(for: .cursorWindow)
public static let minimum = level(for: .minimumWindow)
public static let maximum = level(for: .maximumWindow)
}