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

On Mac OS, set $WINDOWID to OS's window number #2877

Merged
merged 5 commits into from Jul 24, 2020

Conversation

eraserhd
Copy link
Contributor

The API used is rather plain, not private or suspicious. (I did research, though, and AFAICT, private APIs will pass the notary, but Apple threatened that they wouldn't when they first introduced the notary, so ... ??.)

I'm running this locally, and the window ids are stable and agree with yabai's window numbers (apparently in spite of the vague comment in windowNumber's documentation):

jfelice@C02X421DJHD4 src 
$ echo $WINDOWID
20273

jfelice@C02X421DJHD4 src 
$ yabai -m query --windows --window | jq '.id'
20273

I chose to reuse the WINDOWID variable because it seems like the same purpose and it is possible that some scripts might now work on Mac OS.

Let me know about any code quality issues, and I'll fix them up.

(See #2552 and koekeishiya/yabai#625)

@Luflosi
Copy link
Contributor

Luflosi commented Jul 23, 2020

I think you need to put the definition of cocoa_window_id() in an #ifdef __APPLE__ so it compiles on non-macOS.

@eraserhd
Copy link
Contributor Author

@Luflosi doh, thanks. Updated.

kitty/tabs.py Show resolved Hide resolved
@Luflosi
Copy link
Contributor

Luflosi commented Jul 23, 2020

The definition of x11_window_id() should probably not be in the #ifdef __APPLE__.

@eraserhd
Copy link
Contributor Author

The definition of x11_window_id() should probably not be in the #ifdef __APPLE__.

😭

So that its import in tabs.py doesn't have to be conditional.
@kovidgoyal kovidgoyal merged commit b0876fa into kovidgoyal:master Jul 24, 2020
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

Successfully merging this pull request may close these issues.

None yet

3 participants