Part of an application that I maintain plays audio lectures held in a database. A browser is used for the user interface and Tcl is used as a local server.
If all the user does is listen to the lectures without interacting with the interface, it appears that this is considered a period of inactivity; and, if the system settings for power management are set to sleep, for example, the audio stops playing.
(The interface updates the time and track information as the lecture segments play in turn but that doesn’t appear considered user interaction.)
I realize that the user should increase the time in power management; but, if they do not, is there any way either through Tcl or the browser to programmatically indicate to the OS that the application is active?
Or, is there some way to listen for a sleep or wake event in Tcl? If the OS sleeps in the middle of playing the audio, that would not be an issue except for the fact that the audio stops without changing the UI player controls and I want to capture the UI state. In other words, the player controls show pause instead of play at awake and, if the user were to shutdown immediately upon awake, I wouldn’t capture the exact point that the audio paused.
A listener in the browser for an audio pause event appears to still fire upon sleep such that I can update the player controls to reflect that; but will an OS sleep give applications time to capture the last state? For example, if at the pause event the code updates the UI player controls and sends a message over a web socket to the local Tcl server to store some state data (such as the current time of the audio track) will the OS reliably permit that to complete before sleep? [Adding that it is working such that, upon sleep, the UI updates and the web socket request to Tcl completes a write to a SQLite database capturing the state before sleeping. But is that just “lucky” or is it guaranteed?]
Where can I read about how Manjaro/arch handles sleep?
Thank you.