Skip to content

Conversation

@mmstick
Copy link
Member

@mmstick mmstick commented Oct 20, 2025

Closes #1325
Closes pop-os/cosmic-osd#158
Closes pop-os/cosmic-epoch#655
Closes pop-os/cosmic-epoch#787
Closes pop-os/cosmic-epoch#946
Closes pop-os/cosmic-epoch#1001
Closes pop-os/cosmic-epoch#568
Closes pop-os/cosmic-epoch#1368

  • Device profiles have been moved into a new Device Profiles sub-page for selecting profiles per device
    • Set with wpctl set-profile {{device-id}} {profile-index}} instead of pactl
  • Setting the default sink (output) and source (input) now operates independently
    • Set with wpctl set-default {{node-id}}
  • All of our devices now have stable node object and device IDs from pipewire-rs
    - Enables using wpctl for setting card profiles, default sinks/sources, volume, and mute
    - Significant performance and stability improvements
    - Wireplumber state no longer gets corrupted
  • Fixed early return on debounced volume events dropping pipewire and pulse events
  • Update pipewire-rs to version 0.9
  • Most of our dependency on libpulse has been eliminated
    • It is only used for getting and setting volume, volume balance, and watching default sink/source changes

@mmstick mmstick requested review from a team October 20, 2025 14:18
Copy link
Member

@jacobgkau jacobgkau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First, there's an overflow/sizing issue with the drop-down box on the Device Profiles page. By default, I had no profile selected (not even "Off"), which seems impossible. In that state, most of the drop-down items flowed out of the end of the window:

Image

It seems like longer labels being selected allowed the drop-down to display more of its contents:

Image Image

Separate issue, but after I selected "Off" as my profile, the device disappeared from the list, making it impossible to turn on again. The point of the "Off" option is to still show the device in the list while it's disabled, so that shouldn't happen.

Image

@mmstick
Copy link
Member Author

mmstick commented Oct 20, 2025

What's the output of pw-dump on this system? This is what I see on a system with a Realtek card, Radeon HDMI audio, and a USB-C sound card.

Screenshot_2025-10-20_19-25-58 Screenshot_2025-10-20_19-27-00

@mmstick
Copy link
Member Author

mmstick commented Oct 21, 2025

Fixed the devices on the device profiles page disappearing when setting their profile to off. Which also fixes the device briefly disappearing when the device's nodes are replaced.

wash2
wash2 previously approved these changes Oct 21, 2025
@jackpot51 jackpot51 requested a review from jacobgkau October 21, 2025 16:31
Copy link
Member

@jacobgkau jacobgkau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On the same machine as yesterday, I still had one of the devices not have any profile visibly selected at first, which shouldn't be possible:

Screenshot_2025-10-21_11-21-24

Here is pw-dump from that system: pw-dump-oryp8.txt

If I set the device to "Off", it initially shows itself as "Off", but if I reboot, I end up in the same state as shown above (it boots up set to nothing instead of showing as set to "Off".)

@jacobgkau
Copy link
Member

jacobgkau commented Oct 21, 2025

I'm still also seeing menu items getting cut off at the edge of the window. Is that a libcosmic bug? Dropdown menus in other COSMIC apps seem to be able to run out the side of the window.

@mmstick
Copy link
Member Author

mmstick commented Oct 21, 2025

It's a different dropdown widget. I will switch to it

wash2
wash2 previously approved these changes Oct 21, 2025
@mmstick
Copy link
Member Author

mmstick commented Oct 21, 2025

The index of the selected profile on that Built-in Audio device should be fixed now

@mmstick mmstick requested a review from jacobgkau October 21, 2025 18:08
@jacobgkau
Copy link
Member

jacobgkau commented Oct 21, 2025

On 8688b54 and oryp8, the profile of Built-in Audio keeps defaulting to Digital Surround 5.1 (IEC958/AC3) Output. I think this corresponds to the S/PDIF output, but attempting to change the volume does nothing. Going directly to Digital Stereo (IEC958) Output doesn't work, but if I choose Off, then I can go to Digital Stereo (IEC958) Output to get sound out of the S/PDIF port (the Digital Surround option then gives distorted audio if I select that again).

If I just boot (defaulting to Digital Surround 5.1 (IEC958/AC3) Output) and change directly to one of the Analog Stereo options, that also doesn't work (changing the volume doesn't work & there's no sound). Again, I have to select Off first, then go back to Analog Stereo for it to work.

I know some of this might be audio card weirdness that's outside the scope of COSMIC Settings, but does any of this sound like a COSMIC Settings thing? The two distinct problems are the default/last selected profile not being saved between sessions, and not being able to switch from the default to one of the others successfully without first selecting Off (or possibly just sound not working at all until it's turned Off).

@jacobgkau
Copy link
Member

jacobgkau commented Oct 21, 2025

From @WatchMkr in Mattermost (posting here so it doesn't get lost)-- the design also calls for the device description to be prepended to the profile name when selecting an input/output device (e.g. Speakers - Built-in Audio). The string to be prepended appears to be labeled "description" in pw-dump.

@mmstick
Copy link
Member Author

mmstick commented Oct 22, 2025

Seems I'll need to add the different routes (ports) to the output/input dropdown lists. Pavucontrol puts those on a separate port dropdown.

@jacobgkau
Copy link
Member

Not sure if you were ready for me to look at this again yet, but just to corroborate, on f787c83, I'm seeing the Output device as Analog Stereo - Built-in Audio, when it should say Speakers - Built-in Audio. As you noted, it should be the description of the route, not the profile.

The other problems I mentioned before are still occurring.

@mmstick mmstick force-pushed the sound branch 2 times, most recently from cdbd2a9 to 089d65e Compare October 27, 2025 14:11
Copy link
Member

@jacobgkau jacobgkau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

35e3127 still has reliability issues on oryp8.

If I set Built-in Audio's profile to Analog Stereo Duplex and then reboot, it defaults to Digital Surround 5.1 (IEC958/AC3) Output again.

If I change the profile to Analog Stereo Duplex, then both Output device and Input device show their only option as Built-in Audio, with no route name/description prepended. Changing the speaker volume with hotkeys doesn't work in this state.

If I change the profile to Analog Stereo Output, then Output device changes to Speakers - Built-in Audio, and the speaker hotkeys work. Alternatively, if I open up an app and start playing audio, then the Output device does not change, but the speaker hotkeys do start working.

@mmstick
Copy link
Member Author

mmstick commented Oct 28, 2025

What's the output of pw-dump when set to Analog Stereo Duplex? Particularly the Pipewire:Interface:Node associated with it. Changing the profile changes the active route, and a PipeWire:Interface:Node is created from that.

Based on the logic that I have, the most likely problem is that the node failed to parse. The node ID is required to set a default sink/source, and the route won't be added to the device name if a node isn't associated with it.

.info({
let state = Rc::downgrade(&state);
move |info| {
if let Some(node) = Node::from_node(info) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is where the node is parsed. This could be wrapped with dbg!(Node::from_node(info)) to check if all nodes are getting parsed.

Copy link
Member

@jacobgkau jacobgkau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here is pw-dump after booting on 4a14492, defaulting to S/PDIF: oryp8-4a14492-default-spdif.txt
Here is pw-dump after changing the profile to Analog Stereo Duplex: oryp8-4a14492-duplex.txt

On 4a14492, the speaker hotkeys work immediately after changing the profile to Analog Stereo Duplex, but the Output device is only labeled Built-in Audio, while the Input device is labeled Speakers - Built-in Audio.

@mmstick
Copy link
Member Author

mmstick commented Oct 28, 2025

I think I see the issue

@mmstick
Copy link
Member Author

mmstick commented Oct 29, 2025

Hoping this fixes the issue you're seeing.

@jacobgkau
Copy link
Member

After looking at WirePlumber's debug logs, I think Pop!_OS is configured to have WirePlumber handle auto-selecting/remembering device profiles, not the PipeWire daemon itself. (PipeWire has an ALSA option for it, but the docs note it's usually disabled so the session manager can handle it instead.)

I think it's working correctly. But again, on a44fc56, I'm seeing COSMIC Settings not update to reflect the profile change when I unplug HDMI, until I exit and re-enter the Device profiles page. It does update to go from Off to Digital Stereo (HDMI) Output when I plug in; it's only when I unplug that it's not updating to Off until I manually re-enter the page.

@jacobgkau
Copy link
Member

I'm tearing my hair out trying to test at this point. I'm getting the following crash on this branch very often after trying to reset the config files:

system76@pop-os:~/cosmic-settings$ RUST_BACKTRACE=full COLORBT_SHOW_HIDDEN=1 cosmic-settings
  ERROR  shortcuts custom config error: GetKey("custom", Os { code: 2, kind: NotFound, message: "No such file or directory" })
    at /build/cosmic-settings-eJXdZR/cosmic-settings-0.1.0~1763999493~24.04~6f4c755/vendor/cosmic-settings-config/src/shortcuts/mod.rs:43 on main

  ERROR  Failed to load Panel system config., err: GetKey("padding_overlap", Os { code: 2, kind: NotFound, message: "No such file or directory" })
    at cosmic-settings/src/pages/desktop/panel/mod.rs:90 on main

  ERROR  Error when loading Panel container config., err: GetKey("padding_overlap", Os { code: 2, kind: NotFound, message: "No such file or directory" })
    at cosmic-settings/src/pages/desktop/panel/inner.rs:71 on main

  ERROR  Error when loading Panel container config., err: GetKey("padding_overlap", Os { code: 2, kind: NotFound, message: "No such file or directory" })
    at cosmic-settings/src/pages/desktop/panel/inner.rs:71 on main

  ERROR  Failed to load Dock system config., err: GetKey("padding_overlap", Os { code: 2, kind: NotFound, message: "No such file or directory" })
    at cosmic-settings/src/pages/desktop/dock/mod.rs:139 on main

  ERROR  Error when loading Panel container config., err: GetKey("padding_overlap", Os { code: 2, kind: NotFound, message: "No such file or directory" })
    at cosmic-settings/src/pages/desktop/panel/inner.rs:71 on main

  ERROR  Error when loading Panel container config., err: GetKey("padding_overlap", Os { code: 2, kind: NotFound, message: "No such file or directory" })
    at cosmic-settings/src/pages/desktop/panel/inner.rs:71 on main

  ERROR  shortcuts custom config error: GetKey("custom", Os { code: 2, kind: NotFound, message: "No such file or directory" })
    at /build/cosmic-settings-eJXdZR/cosmic-settings-0.1.0~1763999493~24.04~6f4c755/vendor/cosmic-settings-config/src/shortcuts/mod.rs:43 on main

The application panicked (crashed).
Message:  assertion failed: self.is_char_boundary(idx)
Location: cosmic-settings/src/pages/sound/mod.rs:484

  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ BACKTRACE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   1: __libc_start_main<unknown>
      at <unknown source file>:<unknown line>

Run with COLORBT_SHOW_HIDDEN=1 environment variable to disable frame filtering.
Aborted (core dumped)
system76@pop-os:~/cosmic-settings$

I don't think any of the ERROR lines are relevant (they also happen on master), but do you know why the assertion failed thing would be happening? I can downgrade to master, Settings opens fine, then I upgrade back to this branch and it won't launch in this state.

@jacobgkau
Copy link
Member

Just now, I saw Settings start working after I suspended for a while and then resumed. But after removing the config files and rebooting again, it stopped working again.

Here is a more complete output doing a cargo run with the debug log: sound-crash.txt

@mmstick
Copy link
Member Author

mmstick commented Nov 24, 2025

I think that code isn't needed anymore, so we can remove it.

Copy link
Member

@jacobgkau jacobgkau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That last commit solved the crash I was seeing.

I'm seeing the following occur when the Sound applet is in the panel:

  1. Plug in HDMI for the first time; it gets a profile auto-selected, and that's marked as saved according to pw-cli e ## Profile.
  2. Unplug HDMI; the profile's changed to Off, still marked as saved in pw-cli e ## Profile.
  3. On all subsequent plug-ins of HDMI, the profile stays on Off since it was saved.

After removing the Sound applet from the panel (and resetting WirePlumber's state), the Param:Profile:save parameter remains false, both when plugging in HDMI and getting its auto-selected profile, and unplugging it to go to Off again. When I reset my COSMIC settings to get the Sound applet running again, the broken behavior returns.

This suggests to me that the updated Sound applet (which is pointing towards this branch at this time) is saving the profile when it gets auto-selected. It either needs to not do that on auto-selection (and only save if it's an actual user action-- which can't be done through the Applet, anyway), or at least set Param:Profile:save to false when it's (auto-)set to Off.

@mmstick
Copy link
Member Author

mmstick commented Nov 25, 2025

The applet is pointing to an older commit, so I'll update it.

@mmstick
Copy link
Member Author

mmstick commented Nov 25, 2025

The applet PR has been rebased. The current behavior is to only save when manually saving a profile.

Copy link
Member

@jacobgkau jacobgkau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HDMI plug/unplug is working great now. It switches between the default profile & Off as expected by default; if I set a different profile, then it switches between that profile and Off.

  • The broken test case from the current version works (hotkeys & sound work immediately after changing the profile).
  • The selected profile is saved across reboots.
  • The input & output volume sliders independently work as expected.
  • The output balance isn't reset by changing the volume in Settings.
    • It's still reset by using the volume hotkeys, but I assume that's a cosmic-osd issue.
  • Input & output device names update immediately when plugging/unplugging.
    • There's still a delay before the Confirm Device Type dialog shows up (it waits until the volume slider or any other OSDs have timed out first), but that's not a regression, and is also a cosmic-osd issue.
  • The amplification toggles work as expected (and default to on for output & off for input).
  • Pro Audio devices that don't have a physical device attached are labeled with numbers as expected.
  • When changing a sole device from a Duplex profile to an Output-only profile, the Input section disappears; when changing to an Input-only profile, the Output section has its device change to Dummy Output, and the Input section shows up normally.
    • This seems a little inconsistent, but doesn't seem to present a problem.
  • Hotplugging/unplugging entire devices now updates their available profiles as expected.
  • Mixing & matching audio profiles between different devices works fine.
  • S/PDIF output is able to be configured

I've mostly been testing on laptops, so I'm going to take a quick look on a desktop as well before approving.

Copy link
Member

@jacobgkau jacobgkau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Working as expected on a desktop as well.

@mmstick mmstick merged commit 2c9f60c into master Nov 25, 2025
13 checks passed
@mmstick mmstick deleted the sound branch November 25, 2025 20:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment