Waybar icon indicating copy to clipboard operation
Waybar copied to clipboard

[Feature Request] - Split pulseaudio module into sink and source modules

Open chron-isch opened this issue 3 years ago • 8 comments

Hi, most of all, thanks for all the work on waybar.

For most mobile system the way the pulseaudio module currently works is perfectly practical, but as soon as you start using multiple sinks and sources you run into configuration problems. That's why I wanted to ask if it was feasible to split it into separate modules for sink and source and make the actual device it's referring to configurable and just use default/fallback if no device is specified by the user. That way you could also have separate left-, middle-, right-click and on-scroll actions for sinks and sources.

chron-isch avatar Nov 27 '20 12:11 chron-isch

Any progress on this? Currently, there is no way to control the the source (microphone) volume using waybar. Scrolling on any pulseaudio module results in changing the sink (speaker) volume, which is very unintuitive IMO.

subnut avatar Feb 10 '22 07:02 subnut

@subnut Controlling source volume works for me when repeating the module twice. volume.sh is a custom script which is a wrapper for pamixer.

{
...
    "pulseaudio#input": {
        "format-source": "",
        "format-source-muted": "",
        "format": "{format_source}",
        "on-click": "volume.sh input-mute",
        "on-scroll-up": "volume.sh input-up",
        "on-scroll-down": "volume.sh input-down",
        "tooltip": false
    },
    "pulseaudio#output": {
        "format": "{volume} {icon}",
        "format-icons": {
            "default": [
                "",
                "",
                "",
                ""
            ]
        },
        "on-click": "volume.sh mute",
        "on-scroll-up": "volume.sh up",
        "on-scroll-down": "volume.sh down",
        "scroll-step": 1,
        "tooltip": false
    },
...
}

mknapik avatar Mar 24 '22 16:03 mknapik

Thanks for that - it's not a complete solution though since both will be styled 'muted' whenever the sink is; ignoring the state of the source.

OJFord avatar Apr 09 '22 16:04 OJFord

@OJFord You can use

#pulseaudio.input.source-muted {
  background: red;
}

subnut avatar Apr 09 '22 19:04 subnut

Thanks @subnut, (though that should be .input.source-muted if using the names above) ok as a workaround then but I still agree this would be more convenient if they were separate.

OJFord avatar Apr 09 '22 20:04 OJFord

Thanks @subnut, (though that should be .input.source-muted if using the names above) ok as a workaround then but I still agree this would be more convenient if they were separate.

Does this work now? In my testing it does not.

abhinandanudupa avatar Oct 19 '22 07:10 abhinandanudupa

Thanks to the comments above, I was able to control the style of the icons for input and output separately. Here's my config:

  "modules-right": [
    "pulseaudio#output",
    "pulseaudio#input",
  ],

  "pulseaudio#input": {
    "format-source": "<span size='large'></span>",
    "format-source-muted": "<span size='large'></span>",
    "format": "{format_source}"
  },

  "pulseaudio#output": {
    "format": "<span size='large'>{icon}</span> {volume}%",
    "format-muted": "<span size='large'> </span>",
    "format-bluetooth": "<span size='large'>{icon}</span> {volume}% <span size='large'>{format_source}</span>",
    "format-icons": {
      "headphone": "",
      "headset": "",
      "phone": "",
      "hdmi": "",
      "default": ["", "", ""]
    },
    "on-click": "$HOME/.config/waybar/scripts/module-actions/pulseaudio click-left",
    "on-click-right": "$HOME/.config/waybar/scripts/module-actions/pulseaudio click-right",
    "on-click-middle": "$HOME/.config/waybar/scripts/module-actions/pulseaudio click-middle",
    "on-scroll-up": "$HOME/.config/waybar/scripts/module-actions/pulseaudio scroll-up",
    "on-scroll-down": "$HOME/.config/waybar/scripts/module-actions/pulseaudio scroll-down",
    "smooth-scrolling-threshold": 5
  },

...and style.css:

#pulseaudio.input.source-muted {
  color: @fg-inactive;
  background: @bg-inactive;
}

#pulseaudio.output.muted {
  color: @fg-inactive;
  background: @bg-inactive;
}

ret2src avatar Jan 10 '23 19:01 ret2src