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

Guidance for betterment in MacOS support #94

Open
AshhadDevLab opened this issue Oct 2, 2024 · 1 comment
Open

Guidance for betterment in MacOS support #94

AshhadDevLab opened this issue Oct 2, 2024 · 1 comment

Comments

@AshhadDevLab
Copy link

Description

So I have cloned the repo and I am not sure where to start and what specific features I am looking to build or recreate. A little guidance or maybe some relevant data in a tabular or raw form would help.

Just point out what functions is to be modified or created and what there purpose is to be.

Thank you.

@Kalmat
Copy link
Owner

Kalmat commented Oct 3, 2024

Hi! Thank you again for your interest and help!!!

Regarding macOS it was really tough to build a module like this. Let me please explain which problems I found and which decisions I had to make I am not happy with:

  1. macOS doesn't seem to "like" controlling other apps' windows (or I didn't find how to). So, I had to use AppleScript
  2. AppleScript is extremely slow. This makes it unusable in many scenarios because of its poor performance
  3. I didn't find any way to reference a given external window appart from using its application name and window title. This is tricky since the title of a window can change at any moment, letting the Window object obsolete and useless.
  4. I didn't find any way to develop some module features which are available in other platforms

To avoid or mitigate issues above:

  1. Do you think there is a way in AppKit to address other applications' windows (a sort of id, number, code or similar)?
  2. Do you know if we can move, resize, maximize, minimize, close, check if it is alive or visible, etc, etc. an external window using AppKit (using the previous reference or id)?
  3. If using AppKit we are not able to modify an external window, then we have to use AppleScript (are you skilled in AppleScript and/or Quartz?). In this case, if there is a way of keeping the window reference using AppKit, and rapidly get the application name and window title, it would help to avoid the problem of the titlte changing and then making the Window object unusable
  4. If AppKit can do this in all or some cases, that would be fantastic, so we could replace the AppleScript version by an AppKit one, improving simplicity and performance

Specific cases I found no way to solve:

  1. getActiveWindow() could be improved using AppKit.NSWorkspace.sharedWorkspace().frontmostApplication(), but this fails after using .activateWithOptions_(). Do you know how to solve it?
  2. Do you know if there is a way to return the active windows list in their actual stacking order in getAllWindows()?
  3. I found no way to develop some features that are actually available in other platforms: alwaysOnTop(), alwaysOnBottom() and sendBehid(). I am aware these are very specific functionjs that very likely have no solution using AppKit, AppleScript, Quartz nor anything else... but if you think there is an alternative, this is welcome.

In general

  1. Any idea about how to improve the performance of the module, as well as keep a persistent reference to the window is more than welcome
  2. Anything you can find in PyWinBox._pywinbox_macos.py or PyWinCtl._pywinctl_macos.py starting by AppKit. can probably be done in a better way.,

In short, I am not able to point you to a specific feature, function or method, since the majority and most important problems are related to the fundamentals. Any idea, suggestion, alternative... it doesn't matter how "crazy" it may look lile, is welcome.

Regarding the documentation of every function and method, it is present in the README (there is also a description for every one of them, which includes a purpose/functionality, input arguments and output. Is this enough or do you need additional info?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants