Closed ammgws closed 3 years ago
IIUC #1015 is click related and not about signals?
Related in this way: adding both on_click_right support and signal support would achieve their use case
But what are the use cases for sending signals to blocks (except for custom)?
To force updates early. For example the pacman block could have an interval of 1 hour but if you send a signal you could trigger an update without waiting.
Well, I still don't get it. Is writing pkill -SIGRTMIN+x i3status-rs
simpler that just checkupdates
? I know, I can set a keybinding to send a signal, but still.
It is already possible to update every block with USR1
signal, right?
I originally thought of it as a way to solve https://github.com/greshake/i3status-rust/issues/1015 without introducing any block-specific stuff. In that case, the on_click
for the diskspace block could be set to run pkill -SIGRTMIN+x i3status-rs
and the signal
set appropriately to catch it. Another way without using signal
might be to overhaul on_click
and give it some special syntax so you can choose to force update the block instead of running a custom command, but the signal
way seemed the easier way to go (yet could be seen as a bit hackish)
So if it can be generically implemented for every block like on_click
then I don't see the harm in signal
also having the same treatment. Depending on the config, reloading every block in the bar can take some time so I can see the point of being able to pinpoint force update a block. So basically the argument is, if it can be implemented fairly trivially then it seems like a good way to allow power users finer control over their i3status-rs bar.
and give it some special syntax so you can choose to force update the block instead of running a custom command
IMO, every block should always update when clicked, even if on_click
is set.
Interesting idea, though I could imagine misclicking on a long blocking block might be annoying (though not so bad if it was async?)
Also, would that just be for left clicks, or any button click? Ignore scrolling?
Also, would that just be for left clicks, or any button click? Ignore scrolling?
I'm not sure.
Maybe it worth adding additional on_click_sync
or something like that to run the command, wait for it to finish and then update the block.
Use case: keyboard_layout
: on click command may toggle layout, and it would be nice if the block updated.
By the way, that's how https://github.com/MaxVerevkin/swaystatus works (almost, I didn't implement the "wait" part yet, but it'll be super easy since it's async).
though not so bad if it was async?
Yep.
OK so I will remove this from the 0.2 milestone because:
1) As mentioned, signal functionality isn't really useful for blocks other than Custom.
2) The whole bar can be signalled to update, which is probably good enough to cover any expected use-cases.
3) Forcing updates per-block can be better achieved through the on_click
feature
Right now only the Custom block supports setting an update signal, however other blocks should be able to use it too as mentioned in https://github.com/greshake/i3status-rust/pull/822 (and there are requests for that e.g. https://github.com/greshake/i3status-rust/issues/1015).