0

What is the best way to refresh some blocks like the volume and keyboard layout in i3blocks when I change them from somewhere else. I was thinking of someway to refresh them on command execution like when I do amixer command the volume block refreshes but I couldn't find a way to do it. I found people using persist intervals is it a good idea to use this or it will be like executing the command every millisecond?

1 Answer 1

0

You can define signals which you can send to i3blocks to refresh individual blocks, example:

bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume 0 +3% && pkill -SIGRTMIN+10 i3blocks

i3blocks:

[volume]
label=♪
interval=60
instance=Master
signal=10

This is perfect for cases where you have mapped an action in your i3 config. I'm still using an interval as a fallback when I change the volume over pavucontrol. I think I found the configuration I'm using either from the Arch wiki or the repo linked below, in case you are wondering.

To clarify: persist is for scripts that don't exit but instead write to stdout whenever there is new / changed information. repeat is for scripts/command that run until something occurs and should be rerun immediately after they exit. If your command/script doesn't follow this practice, yeah it's probably a bad idea.

Look here for more info: https://github.com/vivien/i3blocks#signal

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .