-
Notifications
You must be signed in to change notification settings - Fork 1
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
State Check on Startup #8
base: main
Are you sure you want to change the base?
Conversation
I'm glad to hear you this extension has been useful for you! I like the idea of this, but have a few questions/issues after testing this out a bit:
Let me know your thoughts! |
Hi! I am trying to use this button with my Philips TV. There is an utility called |
You can wrap the |
I understand... I know I can do |
I agree with @Jules-Bertholet - good idea. @psihozefir The way @luguenth has this set up, you just enter the command you what to run to check the exit code. For you, you would just enter the command to run your script. Here is the example script I was using to test this:
|
To address your questions @StorageB : I was admittedly a bit sloppy with the code. Initially, I wanted to implement a regex check on stdout, but I soon realized I couldn't retrieve the stdout from the async process call. I ended up using the exit code since it was the only information I could get about whether my command did anything. This might also answer @psihozefir's question about why I'm only looking at the exit code. If anyone can find a way to properly check the command output, that would be really helpful, as we could then set the state based on a regex pattern. Regarding the Toggle On/Off on startup issue (even without the option being active) - I'll look into it, but I'm short on time right now, so it might take me 2-3 weeks. And yes, I agree that delaying the state check would be much better. I'll also work on cleaning up the code for the multiple buttons. |
@luguenth After thinking about this a bit more, I think your original idea of looking at the command output and doing a regex check on an input word/phrase the user specifies would be the best option instead of looking at the exit code. Then it could work for use cases like what @psihozefir was trying to set up. I've had some luck getting command output using I can continue working with the code you provided to see if I can get this to work - unless you've already made some progress, and in that case I could share what I have so far. Edit - I think I finally have a working concept. I'll post a new version here for testing once it's fully working. |
Hey there! 👋 Thanks for creating this awesome extension - it's been really helpful for my workflow!
I wanted to contribute a small but useful feature that I think others might benefit from too:
feat: Add state checking functionality for toggle commands
I added the ability to check the current state of services/commands before toggling. The extension now uses command exit codes to determine toggle states:
For example, I'm using it with Docker like this:
systemctl is-active docker.service
This is super helpful if you (like me) frequently start/stop services and want the UI to always show the correct state.
Let me know if you'd like me to adjust anything or if you have questions! Happy to help make this even better. 😊