Skip to content
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 Window class for Mac OS using AppleScript #183

Merged
merged 7 commits into from
Dec 18, 2019
Merged

Conversation

drmfinlay
Copy link
Member

Re: #8, #35.

This is a work-in-progress Window class implementation for Mac OS using py-applescript. It is based on Aenea's Mac OS server implementation (located here).

This implements the following:
- get_foreground() class method
- get_position() method
- class_name property via the _get_class_name() method
- executable property via the _get_window_module() method
- title property via the _get_window_text() method
AppleScript is used by the DarwinWindow class.
@drmfinlay drmfinlay added MacOS Issue regarding Apple PC OS WIP Work in progress labels Dec 13, 2019
@drmfinlay drmfinlay self-assigned this Dec 13, 2019
This should allow app names and app bundle IDs to be used and
makes the test suite pass again on Mac OS.
The method only returns a Window object for each foreground
application because Mac OS doesn't have easily accessible unique
identifiers for each window.
This also adds the full_screen(), get_attribute() and
get_properties() methods.
This also mocks the 'applescript' module in documentation/conf.py.
@drmfinlay
Copy link
Member Author

I think is ready for merging now. All seems to be working for me on macOS 10.15. The minimize() method sometimes doesn't work, but the main class methods (e.g. get_foreground()) seem to work nicely.

One caveat with this class is that it is unable to differentiate between multiple windows belonging to the same application. Windows in macOS do have IDs, however they are tricky to use, are useless if you don't also have the app ID and don't really seem to be designed for use from other applications. I'm happy to review pull requests on fixing this or other problems.

@drmfinlay drmfinlay merged commit d44b2e7 into master Dec 18, 2019
@LexiconCode LexiconCode removed the WIP Work in progress label Dec 18, 2019
@drmfinlay drmfinlay deleted the macos-window-class branch December 19, 2019 00:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
MacOS Issue regarding Apple PC OS
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants