docs: clarify that prep-cmds fire on app start/termination, not client connect/disconnect - #5562
Open
cttech-io wants to merge 1 commit into
Open
Conversation
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.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Description
Documents that
global_prep_cmd/prep-cmdfire 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:
undodoes 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).dodoes 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 yourdocommand 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_cmddriving a monitor layout swap. TheCLIENT CONNECTED/CLIENT DISCONNECTEDlog lines make it easy to confirm: on a reconnect to a live session, noExecuting Do Cmd:line appears.Docs-only change; no behaviour change. Uses the existing
@note{...}style from this file.Type of Change
Checklist