Fixes a bug where if you deleted all but one character in the workspace
name, you couldn't delete the final character. To fix this, I have made
the workspace editor save a separate entry from the backend. The backend
will also only update its DB value and notify the frontend if something
was actually edited. If you delete all the characters in the name and
don't put anything new in, though, the name will be whatever the last
character you had was, since the name of a saved workspace cannot be
empty.
Also moves icon and color definitions to the backend and makes it so the
new workspaces get created with a different icon color for each index.
If an ephemeral window has more than one tab, always create a new window
when switching workspaces
Also fixes workspace accelerators on macOS
Moves the wlayout package contents to wcore to prevent import cycles.
Moves the layout calls to other wcore functions instead of being handled
by the services. Removes redundant CreateTab in EnsureInitialData and
adds a isInitialLaunch flag to the CreateTab and CreateWorkspace
functions to ensure that the initial tab is pinned and does not have the
initial tab layout (since the starter layout gets applied later)
Adds a new app menu for creating a new workspace or switching to an
existing one. This required adding a new WPS event any time a workspace
gets updated, since the Electron app menus are static.
This also fixes a bug where closing a workspace could delete it if it
didn't have both a pinned and an unpinned tab.
![image](https://github.com/user-attachments/assets/a4072368-b204-4eed-bb65-8e3884687f9a)
This functions very similarly to VSCode's pinned tab feature. To pin a
tab, you can right-click on it and select "Pin tab" from the context
menu. Once pinned, a tab will be fixed to the left-most edge of the tab
bar, in order of pinning. Pinned tabs can be dragged around like any
others. If you drag an unpinned tab into the pinned tabs section (any
index less than the highest-index pinned tab), it will be pinned. If you
drag a pinned tab out of the pinned tab section, it will be unpinned.
Pinned tabs' close button is replaced with a persistent pin button,
which can be clicked to unpin them. This adds an extra barrier to
accidentally closing a pinned tab. They can still be closed from the
context menu.
When a tab was being deleted, for instance, the last block that got
deleted would cascade to delete its parent tab, even though the
`DeleteTab` function was already going to do this. This would produce DB
collisions that would put the app into a bad state. Now we pass a
`recursive` flag that is used to determine whether to perform the
recursive close of the parents.
Also updates `DeleteWorkspace` so that named workspaces will always be
deleted if they're empty, even if `force` is false
Updates `DeleteBlock` to close its parent tab if the tab has no more
blocks. This will also cascade to close the workspace if it no longer
has any tabs, same for window.
I had to move some block-related functionality around on the backend.
This fixes a bug where closing the active tab would clean up the closed
tab view before switching to an un-closed tab view, putting the window
into an unrecoverable state. This also moves around some of the CloseTab
logic so that it's more standardized and reduces unnecessary
frontend-backend comms and DB writes