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

app.windows() is empty when not an the same space as the application #290

Open
ckruse opened this issue Feb 7, 2022 · 11 comments
Open

app.windows() is empty when not an the same space as the application #290

ckruse opened this issue Feb 7, 2022 · 11 comments

Comments

@ckruse
Copy link

ckruse commented Feb 7, 2022

  • Version: 2.7.0, Build 115
  • macOS: 12.2 (21D49)

In my config I iterate over a set of applications and move them to spaces when a second monitor attaches or detaches. This worked really nice before macOS 12.2, but now app.windows() seems to be empty when I am not on the same space as the application. Given this config:

const singleScreenConfig = [
  ["iTerm2", 2],
  ["Element", 3],
  ["Signal", 3],
  ["Nachrichten", 3],
  ["Google Chat", 3],
  ["Mastonaut", 3],
  ["Tweetbot", 3],
  ["MailMate", 4],
  ["Things", 4],
];

function setSingleScreenConfig() {
  const spaces = Space.all();

  singleScreenConfig.forEach(([appName, spaceIdx]) => {
    const app = App.get(appName);
    if (!app) {
      Phoenix.log("app not found", appName);
      return;
    }

    console.log(app.name(), app.windows().length);
    spaces[spaceIdx].moveWindows(app.windows());
  });
}

Key.on("p", ["control", "alt", "cmd"], setSingleScreenConfig);

In this scenario app.windows().length is 0 for e.g. iTerm when I am on the first space and iTerm is on space 2, and thus the window doesn't get moved to space 3. It doesn't matter if I set {visible: true} or {visible: false} or neither.

Am I doing something wrong?

@ckruse
Copy link
Author

ckruse commented Feb 9, 2022

Ping? :-)

@ckruse
Copy link
Author

ckruse commented Feb 13, 2022

No need to „thumbs down.“ Just trying to be constructive, no reaction normally means there is important information missing in the report. Am I missing something important?

@mafredri
Copy link
Contributor

I can't speak for Kasper but as an open-source developer that gives away his time for free I have to strongly disagree with both your statements. A ping is not constructive, nor is "no reaction" indicative of missing information. No response simply means that e.g. Kasper has a life outside of this project and hasn't had time to respond to you. If you look at past issues in this repo you will see that he pretty much responds to all issues, he's a really nice guy. Not sure how you think you were being constructive with the ping...

In my view, a ping is very disrespectful, hence the thumb down. I would advice you not to do it in the future.

@kasper
Copy link
Owner

kasper commented Feb 13, 2022

@ckruse Hey! Not sure what this might be caused by, but it’s likely that Apple has been changing some other private Spaces APIs as well. I will need to investigate more.

@mafredri Indeed, life has been quite hectic lately with personal stuff and work. 😄 I’m really happy to keep this project going, nothing better than doing something that helps other people at the same time.

@ckruse
Copy link
Author

ckruse commented Feb 14, 2022

@mafredri Look, I am an OSS developer myself, I write and maintain OSS since 1998 or 1999, don't really remember. As such I absolutely know that life happens, and thats exactly why I appreciate a ping. I more than often just forgot that there is an open issue waiting, and a friendly ping reminds me. I'm sorry if it bothered you, it was not meant to be pushy. If you want to take an advice from an old fart like me: don't assume that people's intents are malicious.

@kasper no hurry :-) If I can help you, just say so; I don't really have much knowledge about macOS internals, but when I can help I will!

@kasper
Copy link
Owner

kasper commented Feb 14, 2022

By all means, if you find the cause it makes fixing much more faster for me. 😄

@ckruse
Copy link
Author

ckruse commented Feb 14, 2022

I just found this issue form 2016: #131

By the comments it looks like it is a known problem with spaces and application windows. I will create a PR later documenting this limitation.

@mafredri
Copy link
Contributor

@ckruse two days isn’t really enough for an issue to be forgotten 😅. That’s hasty no matter how you turn the cake. Not making any assumptions about your intent, just calling it as I see it.

But enough about that. An issue tracker is not the right place to be discussing such “issues” (pun intended).

@ckruse
Copy link
Author

ckruse commented Feb 14, 2022

@mafredri I forget issues at the same day they‘re opened… 🤷‍♂️ I always need an unread email or an entry in my todo list, otherwise I won‘t remember.

@mafredri
Copy link
Contributor

mafredri commented Feb 14, 2022

@ckruse why are you applying your own workflow on others?

Edit: This can be surmised in one sentence. Respect other peoples inboxes.

Edit 2: Would advice you to read https://blog.sindresorhus.com/issue-bumping-e3b9740e2a0.

@ckruse
Copy link
Author

ckruse commented Feb 14, 2022

@mafredri I don't? I was trying to give you a different perspective.

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 a pull request may close this issue.

3 participants