prevent sleep on Windows when playing

This commit is contained in:
Drew Weymouth
2024-07-18 18:25:14 -07:00
parent 867e2c44b6
commit bc89cc20fc
3 changed files with 39 additions and 0 deletions
+10
View File
@@ -127,6 +127,16 @@ func StartupApp(appName, displayAppName, appVersionTag, latestReleaseURL string)
_, _ = a.ImageManager.GetCoverThumbnail(coverID)
})
a.PlaybackManager.OnPlaying(func() {
SetSystemSleepDisabled(true)
})
a.PlaybackManager.OnPaused(func() {
SetSystemSleepDisabled(false)
})
a.PlaybackManager.OnStopped(func() {
SetSystemSleepDisabled(false)
})
// Start IPC server if another not already running in a different instance
if cli == nil {
ipc.DestroyConn() // cleanup socket possibly orphaned by crashed process