nikitabobko / AeroSpace

AeroSpace is an i3-like tiling window manager for macOS
https://nikitabobko.github.io/AeroSpace/guide
MIT License
7.96k stars 129 forks source link

AeroSpace confused by Discord and Mattermost windows #503

Closed patricorgi closed 2 months ago

patricorgi commented 2 months ago

AeroSpace has been doing great job with if.app-id = "blabla" on window detection, for all my applications except for Discord and Mattermost.

Instead of moving the new window from these two apps to the designated workspace, it considered the new window from my last application. To be more accurate, if I open Discord while I'm in Safari, it will consider Discord window as a new Safari window, and move it according to my rules set for new Safari window.

Even worse, if I now try to immediately manually move Discord window using the keymap I set alt-shift-q = 'move-node-to-workspace Q'. It will end up moving my Safari window, despite the Discord window is focus and frontmost.

Same thing happens to my another application Mattermost, which is a Slack-like app (I don't want to get to the details here).

I don't know what are the similarity between Discord and Mattermost. I thought it may be because they are both Electron apps, but my other Electron apps are fine with AeroSpace.

[[on-window-detected]]
if.app-id = 'com.apple.Safari'
run = 'move-node-to-workspace 1'

[[on-window-detected]]
if.app-id = 'com.hnc.Discord'
run = 'move-node-to-workspace Q'

[[on-window-detected]]
if.app-id = 'Mattermost.Desktop'
run = 'move-node-to-workspace Q'

Checklist

aerospace CLI client version: 0.14.2-Beta 0cb8dbdfc5ee73b8cbc200f175f467ebead55201
AeroSpace.app server version: 0.14.2-Beta 0cb8dbdfc5ee73b8cbc200f175f467ebead55201
nikitabobko commented 2 months ago

It happens because Discord instead of closing windows uses "hide application" macOS feature. See #77

AeroSpace could hardcode this knowledge about Discord misbehavior and run the on-window-detected callback every time Discord application unhides. But it will surprise people who directly use "hide application" on Discord, so I don't think that it could be fixed on AeroSpace side, it's a Discord bug.

On the related note, in the next version, windows will preserve their workspace assignment even when hidden #425 which might be coincidentally the behaviour you want.

patricorgi commented 2 months ago

Hi @nikitabobko , many thanks for the explanation. It makes sense to me now. My apologies for forgetting to search in the closed issues, otherwise I would not have created this duplicate.

patricorgi commented 1 month ago

In case someone is also looking for a solution. I found a very good workaround for now: uninstall the official Discord app and use Safari Web App instead. It works seamlessly the same.