We need to update the most recently used workspace stack when adding and
removing workspaces.
To make this less of a pain we make spaces.stack track all spaces, not just the
ones that aren't visible. Prefering instead to filter out the visible spaces on
`selectSpace`, this is a lot cleaner.
On startup we want to add windows «manually» and not through signals, eg.
because we want to reconstruct an old space. So while we should construct the
spaces as fast as possible to startup look good, we need to defer connecting
most signals until everything has settled (ie. after `startup-complete`).
We introduce `Spaces.init` and `Space.init` which connect signals and take care
of things that can't be done on `enable`, but rather after `startup-complete`.
Some more stuff:
Use `Main.layoutManger._startingUp` to detect startup, this is actually the
thing that's set when `startup-complete` is emitted.
Since we're using the window mru to construct the initial workspace order we
need to wait for all the windows to actually be available.
Installing and enabling the extension didn't work, as some stuff accessed
`TopBar.menu` too early. This was a pretty bad bug, that was fixed, but then
reverted.
The code isn't all that pretty, but it's easy to modify and tune to test what
works well.
I've opted to keep the workspace menu's smooth scroll implementation. When
swiping it's necessary to wait for a button press on the desired space since the
pointer can be anywhere. As such making sure that the workspace stack always
ends up in a discrete state isn't that useful, so I opted for more control when
swiping.
We should add some preferences that users can use to tune the speed of swiping.
I assume that this can vary quite a lot between different touchpads.
Having the hot corner activate the overview works rather poorly with scrolling
through the workspaces.
We disable the functionality by default. The preference `override-hot-corner`
controls the functionality, so set it to false if you want it back.
A possibility is having the hot-corner force the top bar to be visible when
a fullscreen window has focus, but it's not yet implemented.
We only need to calculate visible windows when we're ready to show window
actors again. This makes the tracking more robust as it should always be called
at the correct time.
`fixVisible` is replaced by `space.isPlaceable(metaWindow)` which checks if the
window actor can be placed at its clone's position. We simply call isPlaceable
from the main `moveDone` loop.
This way we won't have to compute dX all over the place, instead the clones are
correctly aligned with the window frame by default.
This also seems to mostly fix the resize problem on wayland, so we no longer
need to update the clone size on `size-changed`.
`monitor.index` is a number, not a function. So the guard doesn't seem to work
as it just happened to prevent moving windows to other monitors/workspaces.