ianyh / Amethyst

Automatic tiling window manager for macOS à la xmonad.
https://ianyh.com/amethyst/
MIT License
14.81k stars 487 forks source link

Support for negative regular expressions in the window title restrictions for floating windows #1674

Open digitalcohesion opened 2 months ago

digitalcohesion commented 2 months ago

Is your feature request related to a problem? Please describe. I would like to be able to use a negative regular expression for floating window title restrictions. For example, in Messages I would like the main window which is called "Messages" to be constrained as normal, but if I open up a new window to a particular person I am messaging at the moment, I would like it to float.

Describe the solution you'd like I was under the impression from another comment in other github issues that I could use regex patterns in the title restrictions. I have used some basic substring matching with Mail to achieve something similar where new messages that contain Re: or Fwd: are floated. In Messages however, the windows show up with titles based on the contact name so it could vary a lot. I tried using a regex like ^((?!Messages).)*$ which seems to work the way I want in regex testing tools, but still seems to match the Messages window when I use it in Amethyst.

Describe alternatives you've considered I've tried multiple versions of "negative" regex's and nothing has worked. I don't have any other solutions besides manually managing the floating of Messages windows which is tedious enough that I am looking for alternative software options.

digitalcohesion commented 2 months ago

I was wrong about the cause of this. It turns out that the title in the Window menu of Messages does not match the title property of the window object.

In looking at UI inspector I did discover there is a property on the window called main that some apps seem to use to mark the main window of the app versus other windows. Messages seems to use this flag for the "Messages" window. I'm wondering if an option to use that flag would work. Something like float non-main windows?

Or maybe there is some other option that would be better. Maybe float all windows but the first one or float all windows but one. Then if the float status is manually changed on a window it automatically toggles the status to just keep one window in the snapped position.