I have Conky display my current volume with ${exec bash /path/to/script/getvolume.sh}
. However I have noticed that after changing the volume, I have to wait a while for Conky to update. Is it possible for me to write another script changevolume.sh
, so that ./changevolume.sh 12
would not only change the volume but also make Conky update itself immediately afterwards so that I don't have to wait for the usual update interval period?

- 2,685
-
possible duplicate of How to use command line to change volume? – Joseph R. Oct 10 '13 at 00:51
-
Not an exact duplicate, I know. But it's what your question boils down to. – Joseph R. Oct 10 '13 at 00:52
-
1@JosephR. It is related but i'm not sure that's what it boils down to. Changing the volume is easy, but after changing it, I have to wait a few seconds for the results to be updated on Conky. What I want is a way for Conky to display the correct volume immediately after the volume has changed – math4tots Oct 10 '13 at 00:54
-
You're right. My bad. I wasn't paying attention. Close vote retracted. – Joseph R. Oct 10 '13 at 00:55
1 Answers
As far as I know, there is no way of externally forcing conky
to update short of killing and restarting it. The good news is that you don't need to, you can just set conky
to update more often using the update_interval
setting:
update_interval 1
This is a configuration option, so it has to be placed in the header of your .conkyrc
, before the TEXT
block.
Bear in mind that the lower the interval, the higher conky
's CPU usage since it will be running more often. It is up to you to decide if it is worth it.
The only other option would be to have your getvolume.sh
script kill and restart conky
. Add this line to the end of your script:
killall conky; conky &
@Joseph R found this in conky
's man page:
An easy way to force Conky to reload your ~/.conkyrc: "killall -SIGUSR1
conky". Saves you the trouble of having to kill and then restart. You
can now also do the same with SIGHUP.
So you could force conky
to reread its init file by adding this command to the end of your getvolume.sh
:
killall -SIGUSR1 conky

- 242,166
-
2The
execi
interval can't be lower than the update interval (see the man page). FWIW, no need to restartconky
, if you send itSIGUSR1
orSIGHUP
it will reload its rc file (again see man page). I had posted this as an answer but deleted it because its effect will be disconcerting to the OP and is definitely not what he/she is looking for. – Joseph R. Oct 10 '13 at 16:56 -
@JosephR. I never suggested the execi interval be shorter than the update one. They are just two different ways of getting the desired behavior. And yes, I saw your answer (it's still visible to >10k users) but thought it was actually killing and restarting, just checked and saw that it doesn't. Should I add this to mine, or will you undelete your answer? Conky almost certainly forks for
exec
calls but thekillall
call causes it to rerun them so your answer seems fine to me. – terdon Oct 10 '13 at 17:02 -
Feel free to add my answer's content to yours. I still don't believe it's what the OP is looking for. – Joseph R. Oct 10 '13 at 17:04
-
-
I'm more inclined to think that your first solution (lowering the update interval) is much better if the higher CPU usage is tolerable. – Joseph R. Oct 10 '13 at 17:11
-
@JosephR. the best would be
execi
, that way only one command needs to be run every second, not everything in theconkyrc
. Mind you, my ownconky
updates every second and I have no issues with it. – terdon Oct 10 '13 at 17:15 -
-
1Looking at the source code, conky decides to update if
select
returns -1. You could ptrace it and hook around theselect
syscall to return -1 when desired… It would be as much work as adding the feature to update upon receipt of a signal. – Gilles 'SO- stop being evil' Oct 11 '13 at 00:51 -
2Worth noting - reloading the init file does not re-execute
texeci
blocks with a long interval. – Iiridayn May 31 '19 at 18:59