Created
May 3, 2018 04:40
-
-
Save jasonm23/465d00708d67a069e902645a3d16800e to your computer and use it in GitHub Desktop.
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
// | |
// NSScreen+currentScreenForMouseLocation.swift | |
// CutBox | |
// | |
import Cocoa | |
extension NSScreen { | |
static func currentScreenForMouseLocation() -> NSScreen? { | |
let mouseLocation = NSEvent.mouseLocation | |
return screens.first(where: { NSMouseInRect(mouseLocation, $0.frame, false) }) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment