-
The scripts must have an interval at which they are triggered, but is there a way to execute a script not depending on an interval but on a keystroke for example ? (I'm using i3, and a keystroke to change the theme from light to dark and vice versa, but the script to display the current theme is updating every 1 second even if the theme didn't change) |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 1 reply
-
There's no straightforward way to achieve this. You could have your script listen for events somehow (e.g. on a socket or some other communication channel) and wrap whatever command you use to change themes with an extra command that signals your script to update. So, it's possible, but pretty involved. |
Beta Was this translation helpful? Give feedback.
-
Wouldn't that mean that the script is always running ? I may have misunderstood what you said but what I'm searching for a way to send something like a signal to polybar to tell it to run the script, but only when this signal is catched |
Beta Was this translation helpful? Give feedback.
-
Yeah I tested some things with the pokybar-msg commands but I couldn't manage to launch the script like this, I could only show/hide the module Edit : I just saw a thing on the link you send me that I didn't see when searching, so I'm gonna try that! |
Beta Was this translation helpful? Give feedback.
-
Thanks, the ipc module was indeed the way to go for it to work! |
Beta Was this translation helpful? Give feedback.
Yes. The script would manage the entire lifecycle here and would just be idly running listen for a signal (the script module does support with
tail = true
)Now that I think about it though, if you don't need to run at an interval at all and only on a signal, you could use the ipc module. For that module, you can use
polybar-msg
to trigger commands on the module.