[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/hyperbole 943dba1 28/53: Added 'topwin' Python script t
From: |
Robert Weiner |
Subject: |
[elpa] externals/hyperbole 943dba1 28/53: Added 'topwin' Python script to determine topmost app window at a screen position under macOS. |
Date: |
Wed, 15 Nov 2017 22:47:03 -0500 (EST) |
branch: externals/hyperbole
commit 943dba13b5a24778c88af80413c87224fe65bfbb
Author: Bob Weiner <address@hidden>
Commit: Bob Weiner <address@hidden>
Added 'topwin' Python script to determine topmost app window at a screen
position under macOS.
---
Changes | 2 ++
MANIFEST | 1 +
topwin | 46 ++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 49 insertions(+)
diff --git a/Changes b/Changes
index 35cebdb..4a47140 100644
--- a/Changes
+++ b/Changes
@@ -1,3 +1,5 @@
+----
+
2017-10-16 Bob Weiner <address@hidden>
* hib-debbugs.el (debbugs-query:at-p): eliminated match of #id-number and
always required
diff --git a/MANIFEST b/MANIFEST
index 250ba99..a1cbfcd 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -87,6 +87,7 @@ hsettings.el - Hyperbole settings which may require
customization
hvar.el - Variable manipulation routines for GNU Hyperbole
hyperbole-banner.png- Graphic of GNU Hyperbole for display with About Hyperbole
smart-clib-sym - Test whether symbol appears within a set of C libraries
+topwin - Python script to find the topmost macOS app window at a
screen position
.hypb & _hypb - Button data files used by the Hyperbole DEMO file
--- EXTERNAL SYSTEM ENCAPSULATIONS ---
diff --git a/topwin b/topwin
new file mode 100755
index 0000000..b6f3dce
--- /dev/null
+++ b/topwin
@@ -0,0 +1,46 @@
+#!python2
+#
+# SUMMARY: Outputs the [application name] of the topmost window at mouse
screen position or nothing if none
+# USAGE: <script> <x-screen-coordinate> <y-screen-coordinate>
+#
+# REQUIRES: macOS window system and the python2 and the PyObjC libraries
available here: https://pythonhosted.org/pyobjc/install.html
+#
+# AUTHOR: Bob Weiner <address@hidden>
+# ORIG-DATE: 14-Oct-17 at 16:21:53
+#
+# DESCRIPTION:
+# DESCRIP-END.
+
+import Quartz
+from sys import argv, exit
+
+if len(argv) < 3:
+ print "%s: ERROR - Call with 2 numeric arguments, X and Y representing an
absolute screen position" % argv[0]
+ exit(1)
+
+x = int(argv[1]); y = int(argv[2])
+
+# Return the first window only that x,y falls within since the windows are
listed in z-order (top of stack to bottom)
+def filter_and_print_top_window(x, y):
+ win_x = win_y = win_width = win_height = 0
+
+ for v in Quartz.CGWindowListCopyWindowInfo(
Quartz.kCGWindowListOptionOnScreenOnly |
Quartz.kCGWindowListExcludeDesktopElements, Quartz.kCGNullWindowID ):
+ val = v.valueForKey_
+ bounds_val = val('kCGWindowBounds').valueForKey_
+
+ # If item has a non-zero WindowLayer, it is not an app and is probably
system-level, so skip it.
+ if not val('kCGWindowIsOnscreen') or val('kCGWindowLayer'):
+ continue
+
+ win_x = int(bounds_val('X')); win_y = int(bounds_val('Y'))
+ win_width = int(bounds_val('Width')); win_height =
int(bounds_val('Height'))
+
+ if win_x <= x and x < win_x + win_width and win_y <= y and y < win_y +
win_height:
+ print ('[' + ((val('kCGWindowOwnerName') or '') +
']')).encode('utf8')
+ # Add this line back in if you need to see the specific window
within the app at the given position.
+ # + ('' if val('kCGWindowName') is None else (' ' +
val('kCGWindowName') or '')) \
+
+ break
+
+# Filter to just the topmost window at (x,y) screen coordinates and print the
bracketed [window name], if any.
+filter_and_print_top_window(x, y)
- [elpa] externals/hyperbole 992870d 12/53: Speeded up search for and addition of a single git project to the dir cache., (continued)
- [elpa] externals/hyperbole 992870d 12/53: Speeded up search for and addition of a single git project to the dir cache., Robert Weiner, 2017/11/15
- [elpa] externals/hyperbole 1b40c4e 14/53: hib-social.el: When a git-reference is activated, trigger an error if `locate' command is not found., Robert Weiner, 2017/11/15
- [elpa] externals/hyperbole ddd114d 01/53: 2016-08-12 Bob Weiner <address@hidden>, Robert Weiner, 2017/11/15
- [elpa] externals/hyperbole 4ace769 17/53: Added brief pulsing/flashing from source line to line in destination buffer., Robert Weiner, 2017/11/15
- [elpa] externals/hyperbole 632789b 18/53: Made Action Key display selected buffer menu item in the same window as the buffer menu., Robert Weiner, 2017/11/15
- [elpa] externals/hyperbole fed1547 09/53: * hib-social.el (hibtypes-social-default-service): Changed to use a radio, Robert Weiner, 2017/11/15
- [elpa] externals/hyperbole a933051 19/53: Supported Emacs button mouse action; improved Lisp outlining support; improved load library links, Robert Weiner, 2017/11/15
- [elpa] externals/hyperbole 06d6cf1 16/53: V6.0.2a; Action Key drag from buffer, file and helm buffer item menus to another window to display., Robert Weiner, 2017/11/15
- [elpa] externals/hyperbole 9457b27 03/53: * hmouse-drv.el (hkey-help-show): Modified to invoke help-mode only if buffer name includes 'Help' to, Robert Weiner, 2017/11/15
- [elpa] externals/hyperbole 2b9d47e 33/53: Merge branch 'master' of git.sv.gnu.org:/srv/git/hyperbole with Mats assist-flag fix., Robert Weiner, 2017/11/15
- [elpa] externals/hyperbole 943dba1 28/53: Added 'topwin' Python script to determine topmost app window at a screen position under macOS.,
Robert Weiner <=
- [elpa] externals/hyperbole 2e55c34 31/53: Add defvar for assist-flag, Robert Weiner, 2017/11/15
- [elpa] externals/hyperbole 620685a 11/53: Add git and github reference support for branches, issues, pull requests and tags., Robert Weiner, 2017/11/15
- [elpa] externals/hyperbole 6b68100 40/53: Fixed predicate test in kbd-key:key-and-arguments., Robert Weiner, 2017/11/15
- [elpa] externals/hyperbole bf0e9fb 24/53: Added new git-find-file command and associated git#=file implicit button type., Robert Weiner, 2017/11/15
- [elpa] externals/hyperbole 1a85b83 10/53: * DEMO (Git References): Added., Robert Weiner, 2017/11/15
- [elpa] externals/hyperbole 67c00f5 42/53: Added additional Hyperbole Manual section changes., Robert Weiner, 2017/11/15
- [elpa] externals/hyperbole ff17563 44/53: Use replace-regexp-in-string instead of replace-in-string, Robert Weiner, 2017/11/15
- [elpa] externals/hyperbole e2f6fbd 21/53: V6.0.2b; Fixed ebut creation argument prompting; Normal key seqs and ESC for meta allowed in HyControl, Robert Weiner, 2017/11/15
- [elpa] externals/hyperbole 70b6a79 29/53: Added modeline drag to window to replace dest. buffer with source buffer; showed Hyperbole key bindings in menu, Robert Weiner, 2017/11/15
- [elpa] externals/hyperbole 8f70846 45/53: Correct spelling, Robert Weiner, 2017/11/15