]> git.r.bdr.sh - rbdr/captura/blob - Captura/Core Extensions/NSScreen+screenWithMouse.swift
8c7f5669cbe621245916cc24fcb6ea3de2fb6cb0
[rbdr/captura] / Captura / Core Extensions / NSScreen+screenWithMouse.swift
1 import Cocoa
2
3 extension NSScreen {
4 static var screenWithMouse: NSScreen? {
5 let mouseLocation = NSEvent.mouseLocation
6 for screen in NSScreen.screens {
7 if NSMouseInRect(mouseLocation, screen.frame, false) {
8 return screen
9 }
10 }
11 return NSScreen.main
12 }
13 }