-
Notifications
You must be signed in to change notification settings - Fork 75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add additional Window classes and change the old one #102
Merged
Conversation
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
- Add BaseWindow class containing many things from the old Window class. - Add FakeWindow class imported as 'Window' on unsupported platforms, including on Linux if X11 isn't detected. - Add X11Window class requiring the psutil package and the xdotool and xprop commandline programs. - Import the Window class for the current platform as 'Window' in window.py. - Rename old Window class to Win32Window and move it into win32_window.py. - Use 'id' instead of 'handle' in BaseWindow, but keep the latter around for backwards-compatibility.
Both of these have been replaced by the FakeWindow class.
This is used by the X11Window class.
drmfinlay
added
New Feature
A new feature that is distinct from the implemented features
Linux/X11
Issue regarding Linux or X11 support
labels
Jul 16, 2019
This commit mostly improves the performance of the X11Window class. - Add get_window() and get_matching_windows() methods to Window classes. - Only retrieve required properties from xprop instead of everything. - Only return visible windows with associated pids from the get_all_windows() and get_matching_windows() methods. - Simplify how arguments are passed to xdotool/xprop. - Use Window.get_matching_windows() in FocusWindow (removes delay on X11).
This is done via the 'xdotool windowsize' command. The Win32Window class also allows this.
This works on Windows and X11 through the Window classes for those platforms and through the FakeWindow class on unsupported platforms.
This should be ready for merging. There is a delay the first time |
drmfinlay
added a commit
that referenced
this pull request
Jul 18, 2019
Add additional Window classes and change the old one
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Linux/X11
Issue regarding Linux or X11 support
New Feature
A new feature that is distinct from the implemented features
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Related issues: #8 #35 #77
This PR does quite a few things. This is a summary of the changes:
Add
X11Window
class using xdotool and xprop.Big thanks to @calmofthestorm for Aenea's xdotool/xprop code!
This class can do pretty much everything the Windows-only class can do:
AppContext
to work on X11! 🎉🎉get_position()
,set_position()
andmove()
. This includes the fun window movement functionality inwindow_movers.py
, which animates windows as they move.Add
FakeWindow
class that replaces the mocked classes indragonfly/os_dependent_mock.py
.It is also used on Linux if the
XDG_SESSION_TYPE
environment variable isn't set to"X11"
. So the Travis CI tests will useFakeWindow
because they don't run in an X11 session.This class may be useful for testing contexts.
Add
BaseWindow
class containing many things from the old Window class.Rename the old
Window
class toWin32Window
and move it intowin32_window.py
. It is still imported asWindow
though.Import the current platform's window class as
Window
inwindow.py
.This should make these changes backwards-compatible.
Unmock
WaitWindow
,FocusWindow
,StartApp
andBringApp
dragonfly actions.TheThis should be fixed now.FocusWindow
action executes very slowly at the moment on X11 because of the large number of xdotool processes that it spawns via theX11Window
properties and methods. I have some ideas on fixing this problem before merging.Add documentation page on window classes.