emulators.desktop.Desktop
The webstation desktop, run as a session with no ROM and no save sync.
The webstation desktop, run as a session with no ROM and no save sync.
Attributes
attributename= 'desktop'Registry key, desktop.
attributedisplay_name= 'Webstation Desktop'Shown as "Webstation Desktop".
attributerequires_rom= FalseOff; a desktop session boots nothing.
attributesave_root= Path('/config')Left at /config.
attributesave_subtrees= ()Empty, so the save routes have nothing to dump or restore.
attributelog_path= Path('/config/selkies-desktop.log')/config/selkies-desktop.log, for a shell the broker starts.
attributeterm_timeout= STOP_WAITSeconds a desktop teardown waits on SIGTERM, from DESKTOP_STOP_WAIT (default 15).
Longer than the base default because the shell itself is not what it is
spent on: it is spent on the emulators the user left open, which write
their config and save data on the way out. One budget covers the shell and
those apps together, since stop signals them all before waiting on any.
attribute_tagOptional[str]= NoneThe tag launch stamped into this session, kept for when the shell is gone.
The session outlives the shell process: quitting the desktop from the GUI
ends it and leaves its apps running, and /proc only holds an environment
for as long as its process lives. The broker keeps one launcher per game
(sess["game"]["emulator_obj"]), so what launch recorded is still here at stop.
attribute_switchedbool= FalseWhether launch switched selkies to the desktop rather than starting a shell.
Functions
funcalive(self) -> boolWhether the desktop is up.
paramselfReturns
boolTrue from a switch to the desktop until stop, or while a shell
funclaunch(self, rom_path, resume_slot) -> NoneBring up the desktop, replacing any session already running.
Switches selkies to the desktop where it can. Otherwise starts the
binary from DESKTOP_BIN (default selkies-desktop) with a tag in its
environment, which every app started from the desktop inherits and
which stop then sweeps by.
Raises
OSError: When the binary cannot be started or its pid cannot be recorded; logged here since this launch failure otherwise surfaced nowhere.selkies.SessionModeError: When selkies is unreachable or refuses the switch.
paramselfparamrom_pathOptional[Path]Ignored; the desktop has no content to boot.
paramresume_slotOptional[int]Ignored; the desktop has no state.
Returns
Nonefuncstop(self) -> NoneTake the desktop down and close everything the user left open on it.
A desktop selkies runs goes through leave_desktop. The rest covers a
shell the broker started.
selkies-desktop runs a .desktop entry's Exec= line through fork,
setsid, a second fork and exec. The app that comes out is parented to
pid 1, sits in a process group whose leader has already exited, and
draws on a compositor that is a separate service, so nothing about it
ends when the shell does: an emulator opened to be configured and left
open kept running, and kept rendering into the stream, after the
session that started it had ended.
What it does still carry is the environment it inherited, which is why
launch stamps a tag into it. The tag is preferred off the live shell
and falls back to the one launch kept, because the shell is the first
thing to go: quitting the desktop from inside the GUI ends it and
leaves every app it started running, which is precisely the case this
sweep exists for and the one where there is no environment left to read.
The apps are signalled before the shell is waited on, so the one grace
period term_timeout buys is spent on both at once. Signalling them
afterwards instead put two full budgets back to back on the exit route.
paramselfReturns
None