-
-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from dado3212/Settings
Open Settings Update (v1.3.1)
- Loading branch information
Showing
7 changed files
with
118 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
// | ||
// NameChangeWindow.swift | ||
// SpacesRenamer | ||
// | ||
// Created by Alex Beals on 4/1/18. | ||
// Copyright © 2018 Alex Beals. All rights reserved. | ||
// | ||
|
||
import Cocoa | ||
|
||
class NameChangeWindow: NSWindow { | ||
override init(contentRect: NSRect, styleMask style: NSWindow.StyleMask, backing backingStoreType: NSWindow.BackingStoreType, defer flag: Bool) { | ||
super.init(contentRect: contentRect, styleMask: style, backing: backingStoreType, defer: flag) | ||
self.title = "Spaces Renamer" | ||
self.isOpaque = false | ||
self.isMovable = false | ||
self.backgroundColor = NSColor(calibratedHue: 0, saturation: 0.0, brightness: 100, alpha: 0.95) | ||
// To make it auto-hide on F3 | ||
self.collectionBehavior = [.transient, .ignoresCycle, .canJoinAllSpaces] | ||
self.level = .modalPanel | ||
|
||
// Adapted from https://stackoverflow.com/a/27613308/3951475 for rounded corners | ||
self.styleMask = [.resizable, .titled, .fullSizeContentView] | ||
self.titlebarAppearsTransparent = true | ||
self.titleVisibility = .hidden | ||
self.showsToolbarButton = false | ||
|
||
self.standardWindowButton(.miniaturizeButton)?.isHidden = true | ||
self.standardWindowButton(.closeButton)?.isHidden = true | ||
self.standardWindowButton(.zoomButton)?.isHidden = true | ||
} | ||
|
||
func refresh() { | ||
DispatchQueue.main.async { | ||
if let appDelegate = NSApplication.shared.delegate as? AppDelegate, let button = appDelegate.statusItem.button { | ||
// Use the hidden popover to get the dimensions, and then immediately hide it | ||
appDelegate.hiddenPopover.show(relativeTo: button.bounds, of: button, preferredEdge: .minY) | ||
if let frame = appDelegate.hiddenPopover.contentViewController?.view.window?.frame { | ||
appDelegate.nameChangeWindow.setFrame(frame, display: true) | ||
} | ||
appDelegate.hiddenPopover.close() | ||
|
||
if let viewController = appDelegate.nameChangeWindow.contentViewController as? ViewController { | ||
viewController.refreshViews() | ||
} | ||
|
||
appDelegate.nameChangeWindow.makeKeyAndOrderFront(nil) | ||
NSApp.activate(ignoringOtherApps: true) | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
+6.92 KB
(110%)
...eproj/project.xcworkspace/xcuserdata/alexbeals.xcuserdatad/UserInterfaceState.xcuserstate
Binary file not shown.