Pause and Unpause Commands #408
Replies: 3 comments 2 replies
-
Hello, I'm trying to figure it out also. Would you mind sharing your script ? Thanks. |
Beta Was this translation helpful? Give feedback.
-
I created an feature request in the issue tracker here regarding this. I hope it gets implemented. |
Beta Was this translation helpful? Give feedback.
-
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. |
Beta Was this translation helpful? Give feedback.
-
I currently have a script that uses Nyrna to suspend and resume my games on start (do command) and stop (undo) of the stream. It helps keep game states and also helps with power consumtion. Problem is there is no way to quit the apps as there are no pause commands so I am using the quit (undo) one.
It would be amazing if we could have intermediate commands that would run when a game is paused and unpaused - aka. when someone stops the stream (and opens it) without quitting the app. That way, it would be possible to have the suspend/resume and also add a quit option.
I suspect this might not be hard to implement as Sunshine already tracks when a stream is paused - the tray notification states it.
Thank you.
Beta Was this translation helpful? Give feedback.
All reactions