背景

系统从debian 12升到debian 13后,一直有个地方很不爽:鼠标放到状态栏的音量图标上时无法显示当前的具体音量。但是,由于升级过程出了点状况(详见Debian从12升到13的翻车记),一时不确定是自己搞出来的问题还是本来就有bug。

过程

新发现

今天无意间查看~/.xsession-errors内容时,看到大段如下重复的内容:

1
2
(wrapper-2.0:1621): Gtk-WARNING **: 21:29:52.802: Failed to set text '音量 30%
</b><small>内置音频 模拟立体声</small>' from markup due to error parsing markup: 第 2 行第 5 个字符出错: 元素“b”已经闭合,当前仍开放的元素是“markup”

然后瞬间就觉得这可能是个bug!查看插件的关于信息:xfce4-pulseaudio-plugin 0.4.9,卸载并重装插件:

1
2
3
4
5
6
# 卸载
sudo apt purge xfce4-pulseaudio-plugin
# 重新安装
sudo apt install xfce4-pulseaudio-plugin
# 重启面板
xfce4-panel -r

重启后,问题仍在。全盘搜索相关文件:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
sudo find / -name "*xfce4-pulseaudio-plugin*"
# 部分结果如下
/usr/share/icons/hicolor/48x48/apps/xfce4-pulseaudio-plugin.png
/usr/share/icons/hicolor/scalable/apps/xfce4-pulseaudio-plugin.svg
/usr/share/doc/xfce4-pulseaudio-plugin
/usr/share/locale/zh_TW/LC_MESSAGES/xfce4-pulseaudio-plugin.mo
/usr/share/locale/da/LC_MESSAGES/xfce4-pulseaudio-plugin.mo
/usr/share/locale/sv/LC_MESSAGES/xfce4-pulseaudio-plugin.mo
/usr/share/locale/hy_AM/LC_MESSAGES/xfce4-pulseaudio-plugin.mo
/usr/share/locale/ar/LC_MESSAGES/xfce4-pulseaudio-plugin.mo
/usr/share/locale/de/LC_MESSAGES/xfce4-pulseaudio-plugin.mo
/usr/share/locale/sr/LC_MESSAGES/xfce4-pulseaudio-plugin.mo
...

出现了很多xfce4-pulseaudio-plugin.mo的文件,都是在/usr/share/locale/xxx/LC_MESSAGES/这样的文件夹下,很明显这些都是不同语言的翻译。查看简体中文的文件:

1
cat /usr/share/locale/zh_CN/LC_MESSAGES/xfce4-pulseaudio-plugin.mo

果然发现了日志中相似的内容:

1
2
3
4
Plural-Forms: nplurals=1; plural=0;
音量 %d%% (已静音)
</b><small>%s</small>音量 %d%%
</b><small>%s</small><big><b>运行命令 "%s" 失败。</b></big>

再查看繁体中文的文件:

1
cat /usr/share/locale/zh_TW/LC_MESSAGES/xfce4-pulseaudio-plugin.mo

相似的内容如下:

1
2
3
4
Plural-Forms: nplurals=1; plural=0;
<b>音量 %d%%(已靜音)</b>
<small>%s</small><b>音量 %d%%</b>
<small>%s</small><big><b>執行指令「%s」失敗。</b></big>

两相对比,果然与~/.xsession-errors中记录的日志一致,bug实锤了!

问题修复

邪修

既然是xfce4-pulseaudio-plugin.mo文件的问题,那就改一下好了:

1
2
3
4
5
# 先备份
sudo cp /usr/share/locale/zh_CN/LC_MESSAGES/xfce4-pulseaudio-plugin.mo /usr/share/locale/zh_CN/LC_MESSAGES/xfce4-pulseaudio-plugin.mo.bak
# 再修改
# 注意:*.mo 文件实际是二进制文件,当做文本文件修改是有风险的
sudo vi /usr/share/locale/zh_CN/LC_MESSAGES/xfce4-pulseaudio-plugin.mo

保存后重启面板。

现在有提示了,但是是中英混合的,虽然能看了,但还是不完美。

正修

网上查了下,*.mo文件是由*.po编译出来的,那就找一下xfce4-pulseaudio-pluginpo吧。

在插件的关于信息中有网站的链接,进去后有gitlab仓库地址,然后就看到源码的po目录,找到zh_CN.po文件,下载下来,编译一下:

1
sudo msgfmt -o /usr/share/locale/zh_CN/LC_MESSAGES/xfce4-pulseaudio-plugin.mo zh_CN.po

重启面板。OK!搞定了!

回头看了下源码下的NEWS0.5.1 (2025-04-24)才更新了一些*.po文件,估计是已经过了debian 13的合并窗口期,所以debian 13的仓库中还只是有问题的0.4.9

总结

邪修不靠谱,还得正经来。

  1. 官方仓库地址下载po/zh_CN.po文件

  2. *.po编译为*.mo

1
sudo msgfmt -o /usr/share/locale/zh_CN/LC_MESSAGES/xfce4-pulseaudio-plugin.mo zh_CN.po
  1. 重启面板
1
xfce4-panel -r