Hacker News new | ask | show | jobs
by matt_daemon 1236 days ago
Would love if these tools also had the ability to save application window settings too.
3 comments

This is what I’m looking for too. I have three places I plug in displays: home office, work office, no displays (coffee shop). I have specific windows I want in specific places when plugged into external displays at home or work. Browser, Remote Desktop tool, chat client, etc. Every time I come back from the coffee shop, I have to manually re-arrange my windows. First world problem I know but every time I think “it should be smart enough to land these windows in this spot”

Similar with code editors: it should be smart enough to re-arrange my docks based on screen size. When I have big screen, expand side and bottom sub-windows. When I’m just on laptop screen, auto hide them.

Ivan Sapozhnik (https://twitter.com/iSapozhnik) is working on adding this to his Lasso app (https://thelasso.app/). It's not an easy problem to solve as there's no API that can just save and restore windows, a lot of inventive solutions have been tried and failed.

But I see Ivan very determined to solve this.

Do you know of any specific writeups? I couldn't find any obvious results, but I'm curious where the difficulties lay. Tbh, I'd be happy with just "windows with this parent process go here" list - I wonder how far off that is.
I don't have any link on hand right now for a writeup, but I've followed yabai's (https://github.com/koekeishiya/yabai) development closely ever since it was called kwm and saw the limitations of macOS's public API to managing windows.

The windows with this parent process go here thing can be solved easily, and can even be done as a one-liner with yabai. Example of moving all the windows of Sublime Text to display 2:

    yabai -m query --windows | jq '.[] | select(.app == "Sublime Text") | .id' | xargs -I '{}' -- yabai -m window '{}' --display 2
It can even be automated by adding a rule in ~/.yabairc (although that might be undesirable as it will always be enforced even if you want to move the window manually):

    yabai -m rule --add app="Sublime Text" label="sublime-display-2" display=2
Yabai can also resize the window to whatever size you want, or move it to a specific space, and it can even do that based on the window title.

It has this much power because it uses macOS's private APIs from SkyLight.framework (the macOS window and display manager): https://github.com/koekeishiya/yabai/blob/master/src/misc/ex...

Closest thing I've found for getting this done is Mosaic.