Skip to content

feat: run session hooks on client connect and disconnect - #27

Open
maryny4 wants to merge 1 commit into
MuNeNiCK:mainfrom
maryny4:feat/session-hooks
Open

feat: run session hooks on client connect and disconnect#27
maryny4 wants to merge 1 commit into
MuNeNiCK:mainfrom
maryny4:feat/session-hooks

Conversation

@maryny4

@maryny4 maryny4 commented Aug 6, 2026

Copy link
Copy Markdown

Add on_client_connect / on_client_disconnect options (config file and CLI) that run a shell command when the first client connects and the last one disconnects, wired through ironrdp's existing ConnectionHandler.

Connections are counted so parallel sessions or port probes during an active session do not retrigger the hooks; spawned commands are reaped in the background and a non-zero exit lands in the log as a warning. With no hooks configured nothing changes — the connection handler is not installed at all.

The model follows Sunshine's prep-cmd do/undo pattern. Typical uses: switch the captured output's scale to match the remote client's DPI for the session and restore it on disconnect, wake DPMS, send a notification.

Known limitation: ironrdp's on_accept fires on TCP accept, before authentication, so a lone port probe while idle runs the hooks once. Probes during an active session are filtered by the connection counter.

cargo fmt --check, clippy -- -D warnings, cargo test (both feature sets) pass; unit tests cover the edge-transition counting including the parallel-probe sequence.

Add on_client_connect / on_client_disconnect options (config and CLI)
that run a shell command when the first client connects and the last
one disconnects. Connections are counted so parallel sessions or port
probes during an active session do not retrigger the hooks.

Useful for adjusting monitor scale for the remote session, waking
DPMS, or sending notifications.

(cherry picked from commit 5a451b2)
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