kasper / phoenix

A lightweight macOS window and app manager scriptable with JavaScript
https://kasper.github.io/phoenix/
Other
4.39k stars 128 forks source link

space.windows() only returns windows for current space #303

Closed saurabhsharan closed 2 years ago

saurabhsharan commented 2 years ago

I have a simple script that tries to print out all windows from all spaces:

Key.on('z', ['ctrl', 'shift'], () => {
  const allSpaces = Space.all();

  for (var i = 0; i < allSpaces.length; ++i) {
    let space = allSpaces[i];
    let spaceWindows = space.windows({});

    for (const wndow of spaceWindows) {
      let app = wndow.app();
      console.log(`space ${i} app ${app.name()} window ${wndow.title()}`);
    }
  }
});

However for the call to space.windows({}) it only works when the space is the current space. For all other spaces, it only returns the windows that are assigned to all spaces by default. Is this a known issue / is there a workaround?

kasper commented 2 years ago

Hi! Yes, this is a known limitation of the APIs Phoenix is using. See #131.

saurabhsharan commented 2 years ago

Gotcha, thanks very much for the reply!