greshake / i3status-rust

Very resourcefriendly and feature-rich replacement for i3status, written in pure Rust
GNU General Public License v3.0
2.81k stars 472 forks source link

Implement format_alt for sound block #2036

Closed heitorPB closed 2 months ago

heitorPB commented 3 months ago

I was looking at how to show the audio out/in device, but thought that would be more interesting to have the sound block be able to alternate between volume level/scroll and device used.

For that, we need a format_alt for the audio block.

bim9262 commented 3 months ago

Are you saying that you want to change the scroll behavior so that when it is in "volume mode" and you scroll the volume would change and that while in "device mode" scrolling would change the default sink/source?

As a side note: you can make the output device show up as an icon by using the mappings option like:

[[block]]
block = "sound"
driver = "pulseaudio"
format = " $icon $output_name {$volume|} "
[block.mappings]
"alsa_output\\..*\\.hdmi-stereo.*" = "\uf390"
"alsa_output\\.usb-Focusrite_Scarlett_Solo_USB_Y7RRZHQ19D3BE3-00\\..*" = "\U000f02cb"

Perhaps showing your desired config/output would help me understand what you're trying to achieve (not trying to say we can't/shouldn't add the format_alt).

heitorPB commented 3 months ago

Are you saying that you want to change the scroll behavior

Oh, no! Not the scroll.

I wasn't clear enough. Let me rephrase it.

In the memory block, we have an alt_format than can be used to show Swap instead of RAM. So, clicking on the block alternates between showing RAM and showing Swap.

My idea is something like this: the format shows the volume level. The alt_format shows the device used. This is very useful information in laptops, with tons of outputs and inputs + headset + webcams with mic; I never know which device i'm using (specially mics).

Does it makes sense now?

I like your mappings idea, getting icons there is very handy. But still, a left-click to get the full info would be helpful.

bim9262 commented 3 months ago

Gotcha, thanks for explaining. Should be easy enough to add. There's no default left click behavior today. Feel free to open a PR, if you want. Otherwise it can get picked up by someone else.

heitorPB commented 2 months ago

@bim9262 I opened #2041 to add it. Could you take a look at it?