Skip to content

Commit 363865a

Browse files
committed
v0.7 pre-release
1 parent 78c70d3 commit 363865a

22 files changed

+818
-4771
lines changed

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ instance/
1010
.coverage
1111
htmlcov/
1212

13-
dist/
1413
build/
1514
*.egg-info/
1615
.vscode/
17-
/make_dev_wheel.bat
16+
dist/
17+
*.whl

CHANGES.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
0.4, 2023/10/11 -- ALL: Added getMonitor() as alias for getDisplay()
2-
LINUX: Fixed getAllMonitors() returns empty list if XDG_CURRENT_DESKTOP is not set, improved getClientFrame() and getExtraFrameSize() by properly using _NET_EXTENTS and GTK_EXTENTS, Added a new Window.LEGACY_NAME="WM_NAME" property (for apps not setting _NET_WM_NAME)
3-
(ewmhlib): Fixed Mint returning str (not bytes) in some properties. Fixed Mint not having get_monitors() method in xrandr extension.
4-
MACOS: Fixed lowerWindow(), raiseWindow() and isAlive. Fixed test_pywinctl.py to avoid crashing in small screens
2+
LINUX: Added ewmhlib as separate module. Fixed getAllMonitors() returns empty list if XDG_CURRENT_DESKTOP is not set. Improved getClientFrame() and getExtraFrameSize() by properly using _NET_EXTENTS and GTK_EXTENTS, Added a new Window.LEGACY_NAME="WM_NAME" property (for apps not setting _NET_WM_NAME)
3+
(ewmhlib): Fixed Mint returning str (not bytes) in some properties. Fixed Mint not having get_monitors() method in xrandr extension.
4+
MACOS: Removed MacOSNSWindow. Fixed lowerWindow(), raiseWindow() and isAlive. Fixed test_pywinctl.py to avoid crashing in small screens
55
0.3, 2023/09/20 -- LINUX: Improved Wayland support for some apps which (surprisingly) work using X11/XOrg (thanks to SamuMazzi for his help!).
66
0.2, 2023/09/09 -- LINUX: Added experimental Wayland support (only if unsafe mode enabled and only for some apps).
77
Fixed ewmhlib freezing in Wayland when connecting to display ":1", and added some performance improvements

README.md

Lines changed: 34 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ My most sincere thanks and acknowledgement. amongst many others (see AUTHORS.txt
2525

2626
## Window Features <a name="window-features"></a>
2727

28-
There are three kind of function to be used within PyWinCtl:
28+
There are three kinds of functions to be used within PyWinCtl:
2929
- General, independent functions: These functions can be directly invoked at module level, without the need of referencing a Window object
3030
- Window class:
31-
- Methods: You need a Window object to control or get info on the target window on screen. It's possible to get a Window object by using any of the general methods (e.g. getActiveWidow() or getWindowsWithTitle()). You can also use windows id, as returned by PyQt's self.winId() or tkinter's root.frame(), which is very handy to get the Window object for your own application.
31+
- Methods: You need a Window object to control or get info on the target window on screen. It is possible to get a Window object by using any of the general methods (e.g. getActiveWidow() or getWindowsWithTitle()). You can also use the window id, as returned by PyQt's self.winId() or tkinter's root.frame(), which is very handy to get the Window object for your own application.
3232
- Properties: Window attributes, getters and setters, that also require to use a Window object
3333

3434
A very simple example:
@@ -54,43 +54,41 @@ A very simple example:
5454

5555
These functions are available at the moment, in all three platforms (Windows, Linux and macOS)
5656

57-
| General, independent functions: | Window class methods: | Window class properties: |
58-
|:------------------------------------------------------------------:|:----------------------------------------------------:|:-------------------------------------------------------------------:|
59-
| [getActiveWindow](docstrings.md#getactivewindow) | [close](docstrings.md#close) | (GET) [title](docstrings.md#title) |
60-
| [getActiveWindowTitle](docstrings.md#getactivewindowtitle) | [minimize](docstrings.md#minimize) | (GET) [updatedTitle](docstrings.md#updatedtitle) (MacOSWindow only) |
61-
| [getAllWindows](docstrings.md#getallwindows) | [maximize](docstrings.md#maximize) | (GET) [isMaximized](docstrings.md#ismaximized) |
62-
| [getAllTitles](docstrings.md#getalltitles) | [restore](docstrings.md#restore) | (GET) [isMinimized](docstrings.md#isminimized) |
63-
| [getWindowsWithTitle](docstrings.md#getwindowswithtitle) | [hide](docstrings.md#hide) | (GET) [isActive](docstrings.md#isactive) |
64-
| [getAllAppsNames](docstrings.md#getallappsnames) | [show](docstrings.md#show) | (GET) [isVisible](docstrings.md#isvisible) |
65-
| [getAppsWithName](docstrings.md#getappswithname) | [activate](docstrings.md#activate) | (GET) [isAlive](docstrings.md#isvisible) |
66-
| [getAllAppsWindowsTitles](docstrings.md#getallappswindowstitles) | [resize / resizeRel](docstrings.md#resize) | (GET/SET) position (x, y) |
67-
| [getWindowsAt](docstrings.md#getwindowsat) | [resizeTo](docstrings.md#resizeto) | (GET/SET) left (x) |
68-
| [getTopWindowAt](docstrings.md#gettopwindowat) | [move / moveRel](docstrings.md#move) | (GET/SET) top (y) |
69-
| [displayWindowsUnderMouse](docstrings.md#displaywindowsundermouse) | [moveTo](docstrings.md#moveto) | (GET/SET) right (x) |
70-
| [version](docstrings.md#version) | [raiseWindow](docstrings.md#raisewindow) | (GET/SET) bottom (y) |
71-
| [checkPermissions](docstrings.md#checkpermissions) (macOS only) | [lowerWindow](docstrings.md#lowerwindow) | (GET/SET) topleft (x, y) |
72-
| | [alwaysOnTop](docstrings.md#alwaysontop) | (GET/SET) topright (x, y) |
73-
| | [alwaysOnBottom](docstrings.md#alwaysonbottom) | (GET/SET) bottomleft (x, y) |
74-
| | [sendBehind](docstrings.md#sendbehind) | (GET/SET) bottomright (x, y) |
75-
| | [acceptInput](docstrings.md#acceptinput) | (GET/SET) midtop (x, y) |
76-
| | [getAppName](docstrings.md#getappname) | (GET/SET) midleft (x, y) |
77-
| | [getHandle](docstrings.md#gethandle) | (GET/SET) midbotton (x, y) |
78-
| | [getParent](docstrings.md#getparent) | (GET/SET) midright (x, y) |
79-
| | [setParent](docstrings.md#setparent) | (GET/SET) center (x, y) |
80-
| | [getChildren](docstrings.md#getchildren) | (GET/SET) centerx (x, y) |
81-
| | [isParent](docstrings.md#isparent) | (GET/SET) centery (x, y) |
82-
| | [isChild](docstrings.md#ischild) | (GET/SET) size (width, height) |
83-
| | [getDisplay](docstrings.md#getdisplay) | (GET/SET) width |
84-
| | [getExtraFrameSize](docstrings.md#getextraframesize) | (GET/SET) height |
85-
| | [getClientFrame](docstrings.md#getclientframe) | (GET/SET) box (x, y, width, height) |
86-
| | | (GET/SET) rect (x, y, right, bottom) |
87-
57+
| General, independent functions: | Window class methods: | Window class properties: |
58+
|:------------------------------------------------------------------:|:----------------------------------------------------:|:------------------------------------------------------------------------------------------:|
59+
| [getActiveWindow](docstrings.md#getactivewindow) | [close](docstrings.md#close) | (GET) [title](docstrings.md#title) |
60+
| [getActiveWindowTitle](docstrings.md#getactivewindowtitle) | [minimize](docstrings.md#minimize) | (GET) [updatedTitle](docstrings.md#updatedtitle) (MacOSWindow only) |
61+
| [getAllWindows](docstrings.md#getallwindows) | [maximize](docstrings.md#maximize) | (GET) [isMaximized](docstrings.md#ismaximized) |
62+
| [getAllTitles](docstrings.md#getalltitles) | [restore](docstrings.md#restore) | (GET) [isMinimized](docstrings.md#isminimized) |
63+
| [getWindowsWithTitle](docstrings.md#getwindowswithtitle) | [hide](docstrings.md#hide) | (GET) [isActive](docstrings.md#isactive) |
64+
| [getAllAppsNames](docstrings.md#getallappsnames) | [show](docstrings.md#show) | (GET) [isVisible](docstrings.md#isvisible) |
65+
| [getAppsWithName](docstrings.md#getappswithname) | [activate](docstrings.md#activate) | (GET) [isAlive](docstrings.md#isvisible) |
66+
| [getAllAppsWindowsTitles](docstrings.md#getallappswindowstitles) | [resize / resizeRel](docstrings.md#resize) | **Position / Size** (inherited from [PyWinBox module](https://github.com/Kalmat/PyWinBox)) |
67+
| [getWindowsAt](docstrings.md#getwindowsat) | [resizeTo](docstrings.md#resizeto) | (GET/SET) position (x, y) |
68+
| [getTopWindowAt](docstrings.md#gettopwindowat) | [move / moveRel](docstrings.md#move) | (GET/SET) left (x) |
69+
| [displayWindowsUnderMouse](docstrings.md#displaywindowsundermouse) | [moveTo](docstrings.md#moveto) | (GET/SET) top (y) |
70+
| [version](docstrings.md#version) | [raiseWindow](docstrings.md#raisewindow) | (GET/SET) right (x) |
71+
| [checkPermissions](docstrings.md#checkpermissions) (macOS only) | [lowerWindow](docstrings.md#lowerwindow) | (GET/SET) bottom (y) |
72+
| | [alwaysOnTop](docstrings.md#alwaysontop) | (GET/SET) topleft (x, y) |
73+
| | [alwaysOnBottom](docstrings.md#alwaysonbottom) | (GET/SET) topright (x, y) |
74+
| | [sendBehind](docstrings.md#sendbehind) | (GET/SET) bottomleft (x, y) |
75+
| | [acceptInput](docstrings.md#acceptinput) | (GET/SET) bottomright (x, y) |
76+
| | [getAppName](docstrings.md#getappname) | (GET/SET) midtop (x, y) |
77+
| | [getHandle](docstrings.md#gethandle) | (GET/SET) midleft (x, y) |
78+
| | [getParent](docstrings.md#getparent) | (GET/SET) midbotton (x, y) |
79+
| | [setParent](docstrings.md#setparent) | (GET/SET) midright (x, y) |
80+
| | [getChildren](docstrings.md#getchildren) | (GET/SET) center (x, y) |
81+
| | [isParent](docstrings.md#isparent) | (GET/SET) centerx (x) |
82+
| | [isChild](docstrings.md#ischild) | (GET/SET) centery (y) |
83+
| | [getDisplay](docstrings.md#getdisplay) | (GET/SET) size (width, height) |
84+
| | [getExtraFrameSize](docstrings.md#getextraframesize) | (GET/SET) width |
85+
| | [getClientFrame](docstrings.md#getclientframe) | (GET/SET) height |
86+
| | | (GET/SET) box (x, y, width, height |
87+
| | | (GET/SET) rect (x, y, right, bottom) |
8888

8989
***Important macOS notice <a name="macos-notice"></a>***
9090

91-
macOS doesn't "like" controlling windows from other apps, so there are two separate classes you can use:
92-
- To control your own application's windows: MacOSNSWindow() is based on NSWindow Objects (you have to pass the NSApp() and the NSWindow() objects reference).
93-
- To control other applications' windows: MacOSWindow() is based on Apple Script, so it is non-standard, slower and, in some cases, tricky (uses window name as reference, which may change or be duplicate), but it's working fine in most cases. You will likely need to grant permissions on Settings -> Security&Privacy -> Accessibility. ***Notice some applications will have limited Apple Script support or no support at all, so some or even all methods may fail!***
91+
macOS doesn't "like" controlling windows from other apps. MacOSWindow() class is based on Apple Script, so it is non-standard, slower and, in some cases, tricky (uses window name as reference, which may change or be duplicate), but it's working fine in most cases. You will likely need to grant permissions on Settings -> Security&Privacy -> Accessibility. ***Notice some applications will have limited Apple Script support or no support at all, so some or even all methods may fail!***
9492

9593
***Important Linux notice <a name="linux-notice"></a>***
9694

@@ -280,7 +278,3 @@ To test this module on your own system, cd to "tests" folder and run:
280278

281279
python3 test_pywinctl.py
282280

283-
MacOSNSWindow class and methods can be tested by running this, also on "tests" folder:
284-
285-
python3 test_MacNSWindow.py
286-

dist/PyWinCtl-dev0.1-py3-none-any.whl

-213 KB
Binary file not shown.

docs/requirements.txt

Lines changed: 0 additions & 8 deletions
This file was deleted.

setup.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,16 @@
3333
license='BSD 3',
3434
packages=find_packages(where='src'),
3535
package_dir={'': 'src'},
36-
package_data={"pywinctl": ["py.typed"], "ewmhlib": ["py.typed"]},
36+
package_data={"pywinctl": ["py.typed"]},
3737
test_suite='tests',
3838
install_requires=[
3939
"pywin32>=302; sys_platform == 'win32'",
4040
"python-xlib>=0.21; sys_platform == 'linux'",
41+
"ewmhlib>=0.1; sys_platform == 'linux'",
4142
"pyobjc>=8.1; sys_platform == 'darwin'",
4243
"typing_extensions>=4.4.0",
43-
"pywinbox>=0.6",
44-
"pymonctl>=0.6"
44+
"pywinbox>=0.7",
45+
"pymonctl>=0.8"
4546
],
4647
extras_require={
4748
'dev': [

src/pywinctl/__init__.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,6 @@
1010
"getAllScreens", "getScreenSize", "getWorkArea", "getMousePos"
1111
]
1212

13-
import sys
14-
15-
# Mac only
16-
if sys.platform == "darwin":
17-
__all__ += ["NSWindow"]
18-
1913
__version__ = "0.4"
2014

2115

@@ -30,6 +24,3 @@ def version(numberOnly: bool = True) -> str:
3024
getTopWindowAt, getWindowsAt, displayWindowsUnderMouse,
3125
getAllScreens, getScreenSize, getWorkArea, getMousePos
3226
)
33-
34-
if sys.platform == "darwin":
35-
from ._main import NSWindow

0 commit comments

Comments
 (0)