sindresorhus / get-windows

Get metadata about the active window and open windows (title, id, bounds, owner, etc)
MIT License
783 stars 161 forks source link

Feature getOpenWindows to have list of open windows #151

Closed miniben-90 closed 1 year ago

miniben-90 commented 1 year ago

Why

In my case I need to have access to the active window and the list of open windows.

Changes

sindresorhus commented 1 year ago

Thanks for working on this. Make sure you look over your own diff and try to improve it. This will save me time so I don't have to point out lots of nitpick stuff.

sindresorhus commented 1 year ago

Maybe you can find some inspiration here: https://github.com/glsorre/amethystwindows/blob/340d54a076b8c04e74b5f096af7c34b5c2f41ba5/AmethystWindows/DesktopWindowsManager/DesktopWindow.cs#L28-L36

And here: https://github.com/newlooper/VirtualSpace/blob/815e5dc8f10dcec99b2ab997e2053261cb6fe2ad/VirtualSpace/VirtualDesktop/Filters.cs#L26-L33

Basically, this search: https://github.com/search?q=dwmapi.DwmGetWindowAttribute+DWMWA_CLOAKED&type=code

sindresorhus commented 1 year ago

And: https://github.com/adamecr/AppSwitcherBar/blob/b73103e376b2e06262c94e0ec99b7a980fea64c3/readme.md?plain=1#L275-L283

miniben-90 commented 1 year ago

Hi,

I added the modification to filter for win32 system like your links (I use this https://stackoverflow.com/a/62126899 to help me with the condition). He's code work like alt+tab of Microsoft and return only window who are not cloaked or it's not a window toolbar.

Can you be more specific about your links?

sindresorhus commented 1 year ago

Can you be more specific about your links?

The projects I linked to are mature and have a lot of code to handle edge-cases. We can borrow some of that, which are the lines I linked to.

miniben-90 commented 1 year ago

I make some big breaking change for windows cause of a issue with ffi-napi end Workers. I change it for a native node addon (with node-addon-api, node-gyp).

I also change your main.yml to update version and add node 18 to the test.

I created a release.yml file to generate binary for windows at release (it's important to change version of package.json before a release).

For your previous links, it's not logical to filter with className (example with terminal), I just keep the idea of the last link.

sindresorhus commented 1 year ago

This is starting to look good. Although, I'm not super excited to have to maintain C++ code. I would much have preferred Rust and https://napi.rs. Which would have made the code easier to maintain, read, and build.

miniben-90 commented 1 year ago

This is starting to look good. Although, I'm not super excited to have to maintain C++ code. I would much have preferred Rust and https://napi.rs. Which would have made the code easier to maintain, read, and build.

Unfortunately, I don't have time to learn a new language at the moment. But you are welcome to make the change on the basis of the main.cc :).

sindresorhus commented 1 year ago

@miniben-90 The binary publish step failed: https://github.com/sindresorhus/active-win/actions/runs/3686184879

sindresorhus commented 1 year ago

@miniben-90 Different failure: https://github.com/sindresorhus/active-win/actions/runs/3686737172