-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Run DO - UNDO command when Client gets connected disconnected, not just Starting and Quitting Session #165
Comments
The problem here is when you share your screen with multiple users, how would you treat the do and undos for the "connect" and "disconnect"s from other users? I have plan to add webhook to connection events but that's in the future when I have better overall thoughts about the whole system. Sunshine is a total mess in its code structure and currently this is the best I can do... |
@ClassicOldSong didn't you mention in the ReadMe that when sharing screen to multiple users, only one can handle the input? then treat the connect and disconnect only from the user who has input active. And really, at that point, if someone wants to share his gameplay to many users at once, at that point, you probably should add a feature to stream to Twitch or something, lol. And others who want to watch can watch the stream from Twitch. I can say this is a very niche use case, I personally live alone and don't have to share with anyone except myself 😂 |
I didn't, but users can have different permissions. Multiple users can input at the same time, just input permissions are disabled by default for devices that are paired later. The permission system is for shared play, not for broadcasting purposes, and broadcasting requires different encoding setup so using OBS to stream might be better. But sure, it is possible to use the permission system to add scripts for different users. I'll think about it. |
With the help of ChatGPT, it wrote a PowerShell script within a minute that works beautifully This is script will run a specific batch file when client is connected, and another when disconnected: $logFilePath = "C:\Program Files\Sunshine\config\sunshine.log"
$connectedBatchFilePath = "C:\Temp\muteVolume.bat"
$disconnectedBatchFilePath = "C:\Temp\UnmuteVolume.bat"
$matchPatternClientConnected = "CLIENT CONNECTED"
$matchPatternClientDisconnected = "CLIENT DISCONNECTED"
# Check if the log file exists before proceeding
if (-Not (Test-Path $logFilePath)) {
Write-Error "Log file does not exist: $logFilePath"
exit
}
# Monitor the log file for new content
Get-Content $logFilePath -Wait | ForEach-Object {
if ($_ -match $matchPatternClientConnected ) {
# When the pattern is matched, execute the batch file
Start-Process -WindowStyle hidden -FilePath $connectedBatchFilePath
}
if ($_ -match $matchPatternClientDisconnected ) {
# When the pattern is matched, execute the batch file
Start-Process -WindowStyle hidden -FilePath $disconnectedBatchFilePath
}
} Batch files just run As executing the PowerShell script, probably Task Scheduler with "Run whether user logged in or not" will prevent terminal from showing up when executing the script at startup. |
Parsing logs is a clever idea! |
Related to audio switching issue from sunshine but different issue.
I created a similar issue on Sunshine main repo too. I hope either Apollo or Sunshine gets this implemented.
I downloaded
SetVol
app from here on github and added command forDO
andUndo
likeFor Do:
For Undo:
Which works great. The issue is, the UNDO command doesn't run when the
client gets disconnected
, but only whensession quits
. That is, if I minimize Moonlight, the client disconnects, streaming stops, but Volume still muted. If I open Moonlight and force session to quit, theUndo
command runs.When I use sunshine, I also have similar issue when running VDD trying to run UNDO command when client disconnect, for example Moonlight on Shield TV (session is on, just Moonlight minimized). The Undo command to switch back to main display doesn't run until I force quit the session from Moonlight. The host's main displplay remains black until I force quit the session even if Moonlight is disconnected.
When I used Apollo, the virtual display doesn't change to physical display when client disconnects, just when session quits.
I would like to have an option to do that, that is to Run DO and UNDO commands when client gets connected and disconnected. if changing current behavior is not feasible, at least, add and option to do so on these events.
The text was updated successfully, but these errors were encountered: