i3status-rust icon indicating copy to clipboard operation
i3status-rust copied to clipboard

Any way to reuse blocks or define variables?

Open frostyfalls opened this issue 9 months ago • 3 comments

i3status-rs has been fantastic for me, and works much better than any other solution I had before. However, I'm not sure if there's a way to save blocks or parts of blocks and reuse them, sort of like how YAML has anchors.

Take my 2 battery blocks for example:

[[block]]
block = "battery"
device = "BAT0"
format = "BAT0 $percentage{ ($time_remaining.dur(hms:true))|}"
full_format = "BAT1 $percentage"
missing_format = ""
interval = 60

[[block]]
block = "battery"
device = "BAT1"
format = "BAT1 $percentage{ ($time_remaining.dur(hms:true))|}"
full_format = "BAT1 $percentage"
missing_format = ""
interval = 60

Minus the device and format, they're identical. Is there a way to reuse the battery block without duplicating it manually?

This is sort of nitpicky, but I wanted to ask. Thanks so much.

frostyfalls avatar Feb 18 '25 19:02 frostyfalls

There's not currently a way to do this.

bim9262 avatar Feb 20 '25 01:02 bim9262

Gotcha, thanks; should this be closed?

frostyfalls avatar Feb 20 '25 15:02 frostyfalls

It could be implemented somehow, but I'm not convinced it is worth it.

MaxVerevkin avatar Feb 20 '25 16:02 MaxVerevkin

I'm not sure that this would be worth it. I'll close this, but if you decide you/anyone else want to tackle this issue it can be reopened.

bim9262 avatar Feb 23 '25 04:02 bim9262