Skip to content

docs: clarify that prep-cmds fire on app start/termination, not client connect/disconnect - #5562

Open
cttech-io wants to merge 1 commit into
LizardByte:masterfrom
cttech-io:docs/prep-cmd-connect-disconnect
Open

docs: clarify that prep-cmds fire on app start/termination, not client connect/disconnect#5562
cttech-io wants to merge 1 commit into
LizardByte:masterfrom
cttech-io:docs/prep-cmd-connect-disconnect

Conversation

@cttech-io

Copy link
Copy Markdown

Description

Documents that global_prep_cmd / prep-cmd fire on application start and termination, which is not the same as client connect and disconnect.

The current wording — "run before/after all applications" — reads naturally as "before and after a stream", and that is how I initially read it. In practice the application session outlives a disconnect so the client can resume, which has two consequences that are easy to hit and hard to diagnose:

  • undo does not run when a client disconnects. It runs only on actual termination — quitting from the client, stopping the app in the Web UI, or Sunshine shutting down. This half is already known: Run DO - UNDO command when Client gets connected disconnected, not just Starting and Quitting Session #3481 (closed as duplicate).
  • do does not run when a client reconnects, because reconnecting resumes the existing session rather than launching the app again. I could not find this documented anywhere, and it is the more confusing of the two: the stream comes back up without the state your do command was supposed to set.

This matters for any prep-command that changes machine state a stream depends on — display layout, resolution, audio routing. The state is applied on the first connect, reverted whenever the app finally terminates, and silently not reapplied on a resume in between.

Observed on Sunshine 2026.516.143833 (Arch package) on Linux, with global_prep_cmd driving a monitor layout swap. The CLIENT CONNECTED / CLIENT DISCONNECTED log lines make it easy to confirm: on a reconnect to a live session, no Executing Do Cmd: line appears.

Docs-only change; no behaviour change. Uses the existing @note{...} style from this file.

Type of Change

  • Documentation update

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation

Prep-commands run on application start and termination, which is not the same
as a client connecting and disconnecting. A disconnect keeps the session alive
so the client can resume, so undo does not run then, and a reconnect resumes
that session rather than relaunching, so do does not run either.

The undo half is known (LizardByte#3481). The reconnect half does not appear to be
documented, and is the more confusing of the two: the stream returns without
the state the do command was meant to establish.
@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant