Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
[plugin|tiling] Support for moving spaces to different monitors #583
changed the title
[chunkwm-sa] Support for moving spaces to different monitors
Mar 10, 2019
@koekeishiya, does the new command move the active space to the specified desktop? I've been trying to use it after rebuilding from head, but it just seems to shift focus to the specified monitor without moving any spaces. I've got chwm-sa installed and have been using it to focus desktops for awhile. I'm also on Mojave 10.14.3, which I'm assuming means I'm good with regard to the Mojave requirement.
I haven't actually tested the full solution on 10.14.3, but in theory it should work yes. I had a working POC on 10.14.3 before I upgraded to 10.14.4 and finished the rest of it.
Try to open Console.app and filter on Dock, see if you see the following logs when chwm-sa is injected into the Dock:
@koekeishiya, I'm not seeing that in the console. If I restart chunkwm, I see the following:
And occasionally I see some other logs like:
This is after I rebooted and ensured that I had recently run
If I enable debug logging, running chunkc tiling::desktop --move 2 from monitor 1 on space 2 yields this output:
On monitor 1, I have an instance of Firefox and multiple instances of the kitty terminal running, so it seems like it thought it moved everything? But everything remained on monitor 1. I was on space 2, and eventually focus shifted to monitor 2 where it focused on the only existing space 10.
Try to stop chunkwm, pkill the Dock, then start chunkwm, and you should see the messages I mentioned, or something saying that pointer to whatever could not be located.
The command is supposed to move the active desktop to the specified monitor index, and make it the new focused desktop on the target monitor. Windows should be moved with and layout restored, upscaled to the new monitors resolution.
@koekeishiya, that worked!
It looks like everything is shifted right now when I do it, though. Is that expected? It makes sense to add the new space to the end of the existing spaces (I think?), but everything shifting is a little disorienting, especially since I label my spaces and intend to use 1 for dev, 2 for web, 3 for schedule, etc.
I guess this is where I could try to write a script to have a virtual mapping of spaces to the actual space locations. I wanted to try to use this feature to make chunkwm a little closer to i3's behavior when navigating between monitors so I don't need to remember or deal with key bindings for monitor traversal.
On monitor 1, I had spaces 1 through 6. On monitor 2, I had spaces 7 through 10.
if from space 1, I open a new terminal and run
[EDIT] Oh, it looks like moving the space to another monitor tries to place it at the current space of that monitor. Didn't realize that, either.
So, if I had been on monitor 1 space 1 and run the command to send to monitor 2 which was on space 8, then it looks like it drops the results into space 8 and shifts everything from 8 to the left.
We move the space after the currently active space of the target monitor.
If you have 3 spaces on monitor1 and 5 spaces on monitor2. The active space of monitor2 is 3. When you move a space from monitor1 to monitor2, the moved space will become the new space4 on monitor2, and all the spaces behind it are shifted up by 1 desktop number. All the spaces before it will be shifted down by one number, the same way as if you had opened expose and dragged the space to reorder. This is due to how macOS enumerate desktops.
Spaces have a unique UUID internally that remain even after reordering. They also have an internal ID that remain through reordering, but they all get reset if you delete the space and create a new one.