Python Quartz.kCGNullWindowID() Examples
The following are 10
code examples of Quartz.kCGNullWindowID().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
Quartz
, or try the search function
.
Example #1
Source File: PlatformManagerDarwin.py From lackey with MIT License | 5 votes |
def _get_window_list(self): """ Returns a dictionary of details about open windows """ window_list = Quartz.CGWindowListCopyWindowInfo(Quartz.kCGWindowListExcludeDesktopElements, Quartz.kCGNullWindowID) return window_list ## Highlighting functions
Example #2
Source File: _pygetwindow_macos.py From PyGetWindow with BSD 3-Clause "New" or "Revised" License | 5 votes |
def getAllTitles(): """Returns a list of strings of window titles for all visible windows. """ # Source: https://stackoverflow.com/questions/53237278/obtain-list-of-all-window-titles-on-macos-from-a-python-script/53985082#53985082 windows = Quartz.CGWindowListCopyWindowInfo(Quartz.kCGWindowListExcludeDesktopElements | Quartz.kCGWindowListOptionOnScreenOnly, Quartz.kCGNullWindowID) return ['%s %s' % (win[Quartz.kCGWindowOwnerName], win.get(Quartz.kCGWindowName, '')) for win in windows]
Example #3
Source File: _pygetwindow_macos.py From PyGetWindow with BSD 3-Clause "New" or "Revised" License | 5 votes |
def getActiveWindow(): """Returns a Window object of the currently active Window.""" # Source: https://stackoverflow.com/questions/5286274/front-most-window-using-cgwindowlistcopywindowinfo windows = Quartz.CGWindowListCopyWindowInfo(Quartz.kCGWindowListExcludeDesktopElements | Quartz.kCGWindowListOptionOnScreenOnly, Quartz.kCGNullWindowID) for win in windows: if win['kCGWindowLayer'] == 0: return '%s %s' % (win[Quartz.kCGWindowOwnerName], win.get(Quartz.kCGWindowName, '')) # Temporary. For now, we'll just return the title of the active window. raise Exception('Could not find an active window.') # Temporary hack.
Example #4
Source File: _pygetwindow_macos.py From PyGetWindow with BSD 3-Clause "New" or "Revised" License | 5 votes |
def getWindowsAt(x, y): windows = Quartz.CGWindowListCopyWindowInfo(Quartz.kCGWindowListExcludeDesktopElements | Quartz.kCGWindowListOptionOnScreenOnly, Quartz.kCGNullWindowID) matches = [] for win in windows: w = win['kCGWindowBounds'] if pygetwindow.pointInRect(x, y, w['X'], w['Y'], w['Width'], w['Height']): matches.append('%s %s' % (win[Quartz.kCGWindowOwnerName], win.get(Quartz.kCGWindowName, ''))) return matches
Example #5
Source File: _pygetwindow_macos.py From PyGetWindow with BSD 3-Clause "New" or "Revised" License | 5 votes |
def getWindowGeometry(title): # TEMP - this is not a real api, I'm just using this name to stoe these notes for now. windows = Quartz.CGWindowListCopyWindowInfo(Quartz.kCGWindowListExcludeDesktopElements | Quartz.kCGWindowListOptionOnScreenOnly, Quartz.kCGNullWindowID) for win in windows: if title in '%s %s' % (win[Quartz.kCGWindowOwnerName], win.get(Quartz.kCGWindowName, '')): w = win['kCGWindowBounds'] return (w['X'], w['Y'], w['Width'], w['Height'])
Example #6
Source File: _pygetwindow_macos.py From PyGetWindow with BSD 3-Clause "New" or "Revised" License | 5 votes |
def isVisible(title): # TEMP - this is not a real api, I'm just using this name to stoe these notes for now. windows = Quartz.CGWindowListCopyWindowInfo(Quartz.kCGWindowListExcludeDesktopElements | Quartz.kCGWindowListOptionOnScreenOnly, Quartz.kCGNullWindowID) for win in windows: if title in '%s %s' % (win[Quartz.kCGWindowOwnerName], win.get(Quartz.kCGWindowName, '')): return win['kCGWindowAlpha'] != 0.0
Example #7
Source File: local_client.py From galaxy_blizzard_plugin with MIT License | 5 votes |
def _is_main_window_open(self): """Main window, not login one""" windows = CGWindowListCopyWindowInfo(kCGWindowListExcludeDesktopElements, kCGNullWindowID) for window in windows: try: if 'Blizzard Battle.net' == window['kCGWindowName']: log.debug('Main Battle.net window was found') return True except KeyError: continue return False
Example #8
Source File: utils.py From happymac with MIT License | 5 votes |
def get_screen_pixel(x, y): image = CG.CGWindowListCreateImage( CoreGraphics.CGRectMake(x, y, 2, 2), CG.kCGWindowListOptionOnScreenOnly, CG.kCGNullWindowID, CG.kCGWindowImageDefault) bytes = CG.CGDataProviderCopyData(CG.CGImageGetDataProvider(image)) b, g, r, a = struct.unpack_from("BBBB", bytes, offset=0) return (r, g, b, a)
Example #9
Source File: utils.py From happymac with MIT License | 5 votes |
def get_all_windows(): global all_windows if not all_windows: all_windows = Quartz.CGWindowListCopyWindowInfo(Quartz.kCGWindowListExcludeDesktopElements, Quartz.kCGNullWindowID) for window in all_windows: if False and window.valueForKey_('kCGWindowIsOnscreen') : print(window) return all_windows
Example #10
Source File: screen_capturer.py From ptest with Apache License 2.0 | 5 votes |
def get_pixels(self, monitor): width, height = monitor[b'width'], monitor[b'height'] left, top = monitor[b'left'], monitor[b'top'] rect = Quartz.CGRect((left, top), (width, height)) options = Quartz.kCGWindowListOptionOnScreenOnly winid = Quartz.kCGNullWindowID default = Quartz.kCGWindowImageDefault self.image = Quartz.CGWindowListCreateImage(rect, options, winid, default) if not self.image: raise ScreenshotError('MSS: CGWindowListCreateImage() failed.') return self.image