i3status-rust
i3status-rust copied to clipboard
Feature suggestion. Custom block lists
An example user case: I would like to have some buttons for the windows currently in the scratchpad. I can't really see how I could have that using the custom block (without making it extremely convoluted) since I can't know beforehand how many windows would be in the scratchpad.
My suggestion is that you could have a custom block-type, which has a command that returns a list of block configurations in json form. That way I could supply i3status-rust with one block for each window.
This would enable a lot of functionality that's not currently possible, you could have a custom block could enumerate all Bluetooth devices currently connected without making a block for each possible device beforehand etc.
Like this?
https://github.com/MaxVerevkin/swaystatus/blob/4e343dfc0711888aa5d8a63b26390ac53bb7ffec/src/blocks/custom.rs#L77-L91
(This is how my rewrite of i3status-rs
(previously swaystatus, then "async" branch in this repo) used to implement custom
block before this commit)
P.S. I probably misunderstood your suggestion. Can you please give some concrete examples?
They want to be able to create multiple blocks from one command essentially. One script that returns a json list of custom blocks to display, in a way that can change the number of blocks with each update
They want to be able to create multiple blocks from one command essentially. One script that returns a json list of custom blocks to display, in a way that can change the number of blocks with each update
Yes, that is what I mean. Another example use would would be that you would be able to use this feature in order to replace the sway provided workspace_buttons with your own version that could, for example, make the buttons different colours depending on what output they are displayed on.
P.S. I probably misunderstood your suggestion. Can you please give some concrete examples?
My rust is a bit rusty, so I might not understand what you are showing me, but I think your implementation is close to what I'm asking for. Only difference is that instead of retrieving one whole block you get a list of blocks instead.
Can you please give some concrete examples?
My rust is a bit rusty
I meant the example of JSON
I meant the example of JSON
I'm not putting forth a recommendation for a specific implementation, but something like:
{
"foldable": false,
"blocks": [
{
"icon": xx,
"state": xx,
"text": xx,
"on_click": xx,
...
},
{
...
}
]
}
It does seem like a very interesting idea, I look forward to seeing what can be done with it if implemented!