i3 / i3status

Generates status bar to use with i3bar, dzen2 or xmobar
BSD 3-Clause "New" or "Revised" License
608 stars 254 forks source link

Volume config uses Pulseaudio port name instead of description #480

Open milaq opened 2 years ago

milaq commented 2 years ago

Commit https://github.com/i3/i3status/commit/09358d26982431702c3652e8f07ebff7166a1181 introduced an odd behavior for the volume setting: Using the port name instead of the device name. The rationale was to have "much friendlier names" which seems certainly not the case for many other systems. Moreover, the port name can not be easily renamed by the user like the device decription.

If the user find themselves in the situation of unfriendly names, they can always rename their Pulse description for sane names in i3status with the old behavior. With the new behavior from https://github.com/i3/i3status/commit/09358d26982431702c3652e8f07ebff7166a1181 this is not possible anymore.

Additionally the rationale of the setting in i3status is (from my understanding) to show the audio device not the active port, as the port may change while the respective volume handler stays the same.

Attached below are screenshots of both behaviors on one of my systems. I have two sound devices with the port "Digital Output (S/PDIF)" and cannot tell them apart with the new behavior. screenshot_20220130_155737 screenshot_20220130_155815 screenshot_20220130_155900 screenshot_20220130_155920

When reverting the commit I can easily tell them apart after renaming the device description ("AVR" and "Headphones") in Pulseaudio or Pipewire. Pavucontrol even has a gui option for that (right-click on the device). With the new behavior I am stuck with non-identifiable names.

So here goes my humble request to revert the commit https://github.com/i3/i3status/commit/09358d26982431702c3652e8f07ebff7166a1181 or at least make the bahavor optional.

mikelward commented 2 years ago

Sorry this broke you @milaq

From memory, I couldn't find a way to change the description that would persist logouts/reboots.

Trying pavucontrol just now, the UI seems to only support renaming the port, not changing the device description, and it doesn't work with Pipewire on my system.

But I'm fine with reverting.

Thanks

johannesneyer commented 2 years ago

I have the same problem, both of my devices are named Speakers now. PipeWire allows changing the device description property but I did not find a way to change the port description.

milaq commented 2 years ago

Same for me.

Ever since I used Pipewire with both pipewire-media-session and Wireplumber, the port ID renaming is not as straightforward as changing the device description, even impossible in some configurations. Furthermore, in pavucontrol, when assigning output/input devices, the port name does not show up, only the device description.

For a streamlined behavior, as the device description is shown in many places around the OS, I think it'd be best to revert.

@mikelward Thanks for your reply and understanding. Pavucontrol does not work in every regard with PipeWire. But you may automatically change the device description based on rules. This also persists reboots. For Wireplumber see https://wiki.archlinux.org/title/WirePlumber#Changing_a_device/node_property

Personally I use something like this

rule = {
  matches = {
    {
      { "alsa.card_name", "matches", "Xonar DGX" },
    },
  },
  apply_properties = {
    ["node.description"] = "Headphones",
  },
}
table.insert(alsa_monitor.rules,rule)

rule = {
  matches = {
    {
      { "alsa.card_name", "matches", "Yealink*" },
    },
  },
  apply_properties = {
    ["node.description"] = "Yealink",
  },
}
table.insert(alsa_monitor.rules,rule)

rule = {
  matches = {
    {
      { "api.alsa.path", "matches", "iec958*" },
    },
  },
  apply_properties = {
    ["node.description"] = "AVR",
  },
}
table.insert(alsa_monitor.rules,rule)

You may customize the dev description based on various sink or source attributes. You may inspect them with: wpctl status and wpctl inspect <num> respectively.

milaq commented 2 years ago

I just created a revert PR for the discussed behavior. Thanks to everyone for their input.

johannesneyer commented 2 years ago

But this still does not work on computers where all you want is switch between ports right? Like on a laptop where the speakers and headphone jack are on two different ports on the same device.

milaq commented 2 years ago

That's correct.

Maybe an option to switch between both behaviours in i3status.conf would be worth a future implementation. What also could be an option is to combine device description and port name or even exposing both entities as variables in the config so that every user may decide on their own which one takes priority or even combining it in a appropriate string themselves. E.g.:

format = "Vol: %devicename/%deviceport %volume"

For now though, I deem the use-case very narrow as most people switch between distinct PA sinks. Furthermore with modern audio backends like PipeWire, port renaming is not as straightforward as device description renaming.