Skip to content

Instantly share code, notes, and snippets.

@bakkiraju
Created February 7, 2017 06:47
Show Gist options
  • Save bakkiraju/bed042bb7f659fd99c748c7a32b835d5 to your computer and use it in GitHub Desktop.
Save bakkiraju/bed042bb7f659fd99c748c7a32b835d5 to your computer and use it in GitHub Desktop.
Always on the Top, click through transparent window in Swift
import Cocoa
@NSApplicationMain
class AppDelegate: NSObject, NSApplicationDelegate {
@IBOutlet weak var window: NSWindow!
func applicationDidFinishLaunching(_ aNotification: Notification) {
self.window!.isOpaque = false;
self.window!.alphaValue = 0.7;
self.window!.level = Int(CGWindowLevelKey.draggingWindow.rawValue)
self.window!.collectionBehavior = NSWindowCollectionBehavior.stationary
self.window.ignoresMouseEvents = true
}
func applicationWillTerminate(_ aNotification: Notification) {
// Insert code here to tear down your application
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment