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.
attributeterm_timeout= float(os.environ.get('DESKTOP_STOP_WAIT', '15'))Seconds 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 session
(sess["emulator_obj"]), so what launch recorded is still here at stop.
Functions
funclaunch(self, rom_path, resume_slot) -> NoneStart selkies-desktop, replacing any session already running.
The binary comes from DESKTOP_BIN (default selkies-desktop). It is
launched 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.
paramselfparamrom_pathOptional[Path]Ignored; the desktop has no content to boot.
paramresume_slotOptional[int]Ignored; the desktop has no state.
Returns
Nonefuncstop(self) -> NoneStop the shell and close everything the user left open on the desktop.
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