Replies: 3 comments 1 reply
-
No way to do this at the moment, but I can explore adding an environment variable to indicate the first launch. Do you see any difference between the first launch(i.e. SwiftBar launched and kicked off the plugin) and plugin start after waking up from sleep? I don't seem to see any... |
Beta Was this translation helpful? Give feedback.
0 replies
-
(Keep in mind, this is a streaming plugin, so I’m not getting periodically run — I’m always running)
For me, the issue is that my plugin isn’t the only thing that can control the service I monitor and control. The service is terminated (and does not automatically resume) by sleep. The service can also be terminated by other software programs. Worse, the service can be temporarily interrupted and restored. When these fluctuations happen (sometimes failing and coming back within a couple of seconds), I don’t want to trigger secondary effects from within my plugin, such as notifications about state changes, or kick off the process of re-activating secondary services that only shut down if the main service fails for more than a minute or so.
For that reason, I maintain a “last state” variable in my bash script so that I can watch to see if the state has changed since the last time I checked it, and if the state changes, I actually pretend it didn’t change, and look again five seconds later — if the service is still down after the five seconds, then, and only then do I react as if the service has dropped offline.
Something during the sleep/awaken process is causing the plugin to become confused about the state in a way that it doesn’t properly understand what needs to be done to restore the state of things to what it was before sleep, which is one of the major purposes of the plugin. Knowing that sleep occurred would let me handle this intelligently.
Eric Shepherd
Senior Developer Writer
Amazon Web Services
On Feb 4, 2022, at 1:58 PM, Alex Mazanov ***@***.******@***.***>> wrote:
Do you see any difference between the first launch(i.e. SwiftBar launched and kicked off the plugin) and plugin start after waking up from sleep? I don't seem to see any...
|
Beta Was this translation helpful? Give feedback.
1 reply
-
Yes, that would do the job!
Eric Shepherd
Senior Developer Writer
Amazon Web Services
On Feb 4, 2022, at 7:23 PM, Alex Mazanov ***@***.******@***.***>> wrote:
Knowing that sleep occurred would let me handle this intelligently
Ok, this is quite a different thing from what I thought. So, if I give you a ENV variable with the time of wake, this will suffice?
—
Reply to this email directly, view it on GitHub<#276 (reply in thread)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ARUXQXNYLDNO3V25YZA7KXDUZRUWRANCNFSM5NSLQQFA>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Is there a way for a plugin to know that it's being run for the first time since the computer was awakened from sleep? Since my plugin works with a service that it needs to log into, I keep a value recorded that lets me share the fact that it's connected across the various sub-scripts involved in my plugin's operation, so they don't each have to check the connection state and slow things down.
But the service gets disconnected when the computer goes to sleep, which means that recorded status becomes incorrect and everything starts to work wrong. The easiest way to fix this is to have the ability to detect wake-from-sleep when I'm supposedly connected, and begin the reconnect process automatically. To do that, I need to know that wake-from-sleep occurred.
Beta Was this translation helpful? Give feedback.
All reactions