omarchy icon indicating copy to clipboard operation
omarchy copied to clipboard

Audio output switch OSD shows (null) for sinks with non-ASCII names (emoji, em dash)

Open roehrbacher opened this issue 1 month ago • 2 comments

System details

Omarchy 4.0.4 on two machines (Dell XPS 14 with Intel Panther Lake, and a desktop with Ryzen 7 7700 / RX 9060 XT). PipeWire with pipewire-pulse, pactl 17.0-98-gb096.

What's wrong?

When switching audio outputs with omarchy-audio-output-switch (Shift + Mute), the OSD shows (null) instead of the device name for any sink whose description contains non-ASCII characters. Switching itself works, only the name is wrong. I see it on both machines with a Bluetooth headphone named 🕺🏽Bose and with a filter sink called Calibrated Speakers — Protected (em dash).

Steps to reproduce

  1. Give a Bluetooth audio device a name with an emoji (or use any sink with a non-ASCII description) and connect it.
  2. Press Shift + Mute until that output is selected.
  3. The OSD shows (null).

Cause

The script reads the name with:

next_sink_description=$(jq -r '.description // .properties."device.description" // .name' <<<"$next_sink")

pactl -f json can't escape non-ASCII. It prints Invalid ASCII character: 0xffffffe2 to stderr and emits the literal string "(null)" for description and device.description. Since that's a real string, the // fallbacks never kick in.

This looks like a regression: #1695 and #2205 reported the same thing and #1859 fixed it with a (null) check, but that check went away when the script was rewritten in 1eab0cff ("Integrate swaybg and swayosd into the new shell"). Upstream PulseAudio fixed the JSON escaping (pulseaudio#1310), but it isn't in a tagged release yet (latest is still v17.0). As far as I can see, this script is the only place in Omarchy that reads names from pactl -f json; the audio panel shows the names correctly.

Suggested fix

Read the description from pw-dump, which keeps UTF-8 intact, and fall back to the sink name:

sink_description() {
  local d
  d=$(pw-dump 2>/dev/null | jq -r --arg n "$1" \
    'first(.[] | select(.type == "PipeWire:Interface:Node" and .info.props."node.name" == $n) | .info.props."node.description") // empty')
  [[ -n $d && $d != "(null)" ]] && { echo "$d"; return; }
  echo "$1"
}

next_sink_description=$(sink_description "$next_sink_name")

The smaller option would be to treat "(null)" as missing again, but then the OSD shows the raw bluez_output... name. I'm running the pw-dump version locally and it works on both machines.

roehrbacher avatar Oct 10 '26 09:10 roehrbacher

Another trigger that needs no custom name: a non-English locale. PipeWire localizes the default sink descriptions, so on fr_CH two of my three stock outputs hit this out of the box: Radeon High Definition Audio Controller Stéréo numérique (HDMI) [DELL U4025QW] and Ryzen HD Audio Controller Stéréo analogique both show (null), while Scarlett Solo (3rd Gen.) Headphones / Line 1-2 (pure ASCII) is fine. So this likely affects most users of accented languages, not just people who rename devices. Same versions: Omarchy 4.0.4, pactl 17.0-98-gb096.

Filed by Claude Opus 5.5 via Claude Code.

tm-newslang avatar Oct 19 '26 12:10 tm-newslang

Thanks for the precise report — the cause is as you describe, and it is a regression.

bin/omarchy-audio-output-switch reads the name with .description // .properties."device.description" // .name. jq's // only falls through on JSON null or false, and PulseAudio 17's pactl -f json encoder refuses any byte outside ASCII and writes the string "(null)" instead, so the fallback never fires and the OSD shows (null). The (null) check that used to handle this went away when the script was rewritten in 1eab0cffc, which shipped in 4.0.x. The LC_ALL=C since added to that pactl call does not help: the description comes from the server, so localized default names like the Stéréo outputs in the comment above hit it with no renaming at all. This is the only script that takes a display name from pactl -f json; the audio panel reads PipeWire directly and is unaffected.

The fix is already open as #14839, which closes this issue: it treats (null) and empty descriptions as missing, recovers the UTF-8 name from pw-dump, and falls back to the sink name. That pull request is reviewed and tested on its own, and this issue now waits on the maintainer's decision there.

Checked by reading the script and its history on quattro; nothing was run, since the mechanism is fixed in the open pull request rather than here. Codex Medium and Muse Spark 1.3 (thinking high) reviewed the diagnosis and agreed, adding the PulseAudio source lines that produce the (null) string; their independence from this review is not guaranteed.

omarchybot avatar Oct 22 '26 08:10 omarchybot