Skip to main content

Module session_slots

Module session_slots 

Source
Expand description

The window slots of the open workspace: the order its windows are listed in, open and closed alike, in the version pill’s instance panel. Every window has a slot for good: closing one keeps it, reopening it returns to it, and a window that is opened for the first time takes the next one at the end. Only a window that is deleted (an open one removed from the workspace, a closed one removed from the list) gives its slot up, and the ones after it move up.

The order is the client meta workspace:window_slots, the workspace ids in slot order. It is saved with the workspace’s record (window_slots), so it survives a restart, an upgrade (the new version copies the record) and a switch of workspace (the record of the one opened brings its own). The panel asks handle_place_window_slots with the windows it shows; srv appends the ones it has no slot for and answers with the whole order, which every window’s panel then follows.

Constants§

MAX_SLOTS 🔒
Far more windows than a workspace holds; only here so a long-lived workspace can’t grow the list without end. The oldest slots go first.
RECORD_KEY 🔒
Its key in a workspace’s record.
SLOTS_META_KEY 🔒
The client meta key holding the order.

Functions§

adopt 🔒
A record was loaded (a start, a new version’s first start, a switch of workspace): its order is the open workspace’s. A record without one (an older version’s) leaves the order as it is.
forget 🔒
A window’s contents were deleted: its slot goes and the ones after it move up.
handle_place_window_slots 🔒
window.PlaceWindowSlots(keys): the panel shows the windows keys (their workspace ids); the ones with no slot take the next ones. Answers with the whole order.
into_record 🔒
Add the order to a workspace’s record, so it is saved with it.
place 🔒
Give each of keys that has no slot the next one at the end, in the order given, and return every slot.
renamed 🔒
A window’s contents were rebuilt under a new id: it keeps its slot.
slots 🔒
The slots, in order.
strings 🔒
update 🔒
Change the slots in one transaction (a place and a forget can run together) and return them. A change counts as one to the workspace’s windows, so the saver saves it.