Skip to content

Volume slider fails to set volume on 4-channel audio devices  #416

@alator21

Description

@alator21

Describe the bug
The volume slider in the controls window fails to properly set volume on audio devices with more than 2 channels. When adjusting the slider, the volume briefly changes but immediately reverts to the previous value.

To Reproduce
Steps to reproduce the behavior:

  1. Use a system with a 4-channel audio device (common on Apple Silicon Macs)
  2. Open nwg-panel controls window
  3. Attempt to adjust volume slider
  4. Observe volume briefly changes then reverts, with errors in console

Expected behavior
Volume slider should set volume for all channels on the device.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • Linux distribution: Arch Linux ARM (Asahi Linux)
  • Sway version: sway version 1.11 (Note: Using Hyprland 0.49.0 as compositor)
  • Panel version: nwg-panel version 0.10.12

Additional context
Audio Device Details:
Sink: Built-in Audio Speakers
Sample Specification: s32le 4ch 48000Hz
Channel Map: front-left,front-right,rear-left,rear-right

Console Errors:
Failed to set volume: You tried to set volumes for 2 channels, whereas channel(s) supported = 4

Root Cause:
The issue is in tools.py line 579. The set_volume() function uses:
subprocess.call(f"pactl set-sink-volume @DEFAULT_SINK@ {left}% {right}%".split())

This command explicitly sets only 2 channels (left and right), which fails on devices with 4 channels. The command should either:

  1. Set all channels to the same value: pactl set-sink-volume @DEFAULT_SINK@ {percent}%
  2. Use pamixer --set-volume {percent} which handles multi-channel devices correctly

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions