Xubuntu 22.04下Discord Snap版托盘图标间歇性消失的调试方法咨询
Xubuntu 22.04下Discord Snap版托盘图标间歇性消失的调试方法咨询
嗨,针对你遇到的Discord Snap版托盘图标时有时无的问题,我整理了几个实用的调试方向,你可以一步步排查:
一、先明确托盘图标归属与插件状态
- 首先确认Xfce面板上同时启用了Indicator插件和Status Tray Icons插件,因为Snap版Discord可能会使用其中一种托盘协议(StatusNotifierItem对应Indicator,传统X11托盘对应Status Tray Icons)。你可以右键面板→添加新项目,把这两个插件都加上,再启动Discord观察图标是否出现。
- 另外,检查插件的设置界面,看看有没有隐藏图标的选项,确保Discord没有被意外加入隐藏列表。
二、修复Snap应用的权限问题
从你提供的终端日志里,能看到明显的权限错误:
[8716:0418/090019.221117:ERROR:object_proxy.cc(623)] Failed to call method: org.freedesktop.login1.Manager.Inhibit: object_path= /org/freedesktop/login1: org.freedesktop.DBus.Error.AccessDenied: An AppArmor policy prevents this sender from sending this message to this recipient; type="method_call", sender=":1.147" (uid=1000 pid=8716 comm="/snap/discord/151/usr/share/discord/Discord --use-" label="snap.discord.discord (enforce)") interface="org.freedesktop.login1.Manager" member="Inhibit" error name="(unset)" requested_reply="0" destination="org.freedesktop.login1" (uid=0 pid=1014 comm="/lib/systemd/systemd-logind " label="unconfined")
这说明Discord作为Snap应用,缺少访问某些系统DBus接口的权限,可能影响托盘图标注册。尝试给它添加必要的权限:
sudo snap connect discord:system-observe sudo snap connect discord:desktop sudo snap connect discord:hardware-observe
添加后重启Discord,看看图标是否正常显示。
三、深度调试Xfce面板的托盘组件
你已经用PANEL_DEBUG=1 xfce4-panel获取了面板日志,接下来可以重点关注这两个部分:
- 观察
systray-17和indicator-2的日志输出,当启动Discord后,看看面板是否检测到了Discord的托盘注册请求。如果没有任何相关日志,说明Discord没有发送注册信号,或者被权限拦截。 - 尝试单独重启托盘相关进程(不用重启整个系统):
- 先彻底关闭Discord:
killall Discord - 从日志里找到systray和indicator插件的PID(比如你日志里的8659和8660),用
kill <PID>终止它们,Xfce面板会自动重启这些插件 - 重新启动Discord,观察图标是否出现
- 先彻底关闭Discord:
四、解决Discord的GPU初始化异常
日志里还有不少GPU相关错误:
libGL error: MESA-LOADER: failed to open i965: /snap/discord/151/gnome-platform/usr/lib/x86_64-linux-gnu/dri/i965_dri.so: cannot open shared object file: No such file or directory (search paths /snap/discord/151/gnome-platform/usr/lib/x86_64-linux-gnu/dri, suffix _dri) libGL error: failed to load driver: i965 [8837:0418/090018.704384:ERROR:viz_main_impl.cc(186)] Exiting GPU process due to errors during initialization
GPU异常可能导致Discord的UI组件(包括托盘图标)无法正常加载,尝试禁用硬件加速:
- 打开Discord,进入「设置」→「高级」
- 关闭「硬件加速」选项,重启Discord后观察图标状态
五、重置Discord的配置文件
有时候损坏的配置文件会导致托盘异常,你可以备份并重置Discord的配置:
- 关闭Discord
- 备份配置文件夹:
cp -r ~/snap/discord/151/.config/discord/ ~/discord-config-backup/ - 删除原配置文件夹:
rm -rf ~/snap/discord/151/.config/discord/ - 重新启动Discord,让它生成新的配置,再检查托盘图标
附你提供的原始终端日志:
当图标消失时启动面板的日志:
~$ PANEL_DEBUG=1 xfce4-panel xfce4-panel(main): version 4.16.3 on gtk+ 3.24.33 (3.24.29), glib 2.72.4 (2.68.3) xfce4-panel(module-factory): reading /usr/share/xfce4/panel/plugins xfce4-panel(application): found window manager after 1 tries xfce4-panel(base-window): 0x564b8f52ff30: rgba visual=0x564b8f4fad90, compositing=true xfce4-panel(base-window): 0x564b8f52ff30: rgba visual=0x564b8f4fad90, compositing=true xfce4-panel(display-layout): 0x564b8f52ff30: display=:0.0{comp=true}, screen-0[0x564b8f4ee020]=[3520,1080] (eDP1=[0,180;1600,900], HDMI2=[1600,0;1920,1080]) xfce4-panel(positioning): 0x564b8f52ff30: screen=0x564b8f4ee020, monitors=2, output-name=(null), span-monitors=false, base=720,11 xfce4-panel(positioning): 0x564b8f52ff30: working-area: screen=0x564b8f4ee020, x=0, y=180, w=1600, h=900 xfce4-panel(struts): 0x564b8f52ff30: top=201, start_x=0, end_x=1599 xfce4-panel(external): register dbus path /org/xfce/Panel/Wrapper/1 xfce4-panel(module): new item (type=external-wrapper, name=whiskermenu, id=1) xfce4-panel(external): whiskermenu-1: child spawned; pid=8657, argc=7 xfce4-panel(module): new item (type=object-type, name=launcher, id=13) xfce4-panel(module): new item (type=object-type, name=launcher, id=15) xfce4-panel(module): new item (type=object-type, name=launcher, id=14) xfce4-panel(module): new item (type=object-type, name=directorymenu, id=18) xfce4-panel(module): new item (type=object-type, name=tasklist, id=3) xfce4-panel(module): new item (type=object-type, name=separator, id=4) xfce4-panel(module): new item (type=object-type, name=clock, id=12) xfce4-panel(external): register dbus path /org/xfce/Panel/Wrapper/6 xfce4-panel(module): new item (type=external-wrapper, name=notification-plugin, id=6) xfce4-panel(external): notification-plugin-6: child spawned; pid=8658, argc=7 xfce4-panel(external): register dbus path /org/xfce/Panel/Wrapper/17 xfce4-panel(module): new item (type=external-wrapper, name=systray, id=17) xfce4-panel(external): systray-17: child spawned; pid=8659, argc=7 xfce4-panel(external): register dbus path /org/xfce/Panel/Wrapper/2 xfce4-panel(module): new item (type=external-wrapper, name=indicator, id=2) xfce4-panel(external): indicator-2: child spawned; pid=8660, argc=7 xfce4-panel(external): register dbus path /org/xfce/Panel/Wrapper/9 xfce4-panel(module): new item (type=external-wrapper, name=power-manager-plugin, id=9) xfce4-panel(external): power-manager-plugin-9: child spawned; pid=8661, argc=7 xfce4-panel(external): register dbus path /org/xfce/Panel/Wrapper/10 xfce4-panel(module): new item (type=external-wrapper, name=pulseaudio, id=10) xfce4-panel(external): pulseaudio-10: child spawned; pid=8662, argc=7 xfce4-panel(external): register dbus path /org/xfce/Panel/Wrapper/16 xfce4-panel(module): new item (type=external-wrapper, name=xfce4-clipman-plugin, id=16) xfce4-panel(external): xfce4-clipman-plugin-16: child spawned; pid=8665, argc=7 xfce4-panel(external): systray-17: child is embedded; 7 properties in queue xfce4-panel(systray): rgba visual is 0x560cb9491590 xfce4-panel(systray): registered manager on screen 0 xfce4-panel(external): whiskermenu-1: child is embedded; 7 properties in queue xfce4-panel(external): pulseaudio-10: child is embedded; 7 properties in queue xfce4-panel(external): power-manager-plugin-9: child is embedded; 7 properties in queue xfce4-panel(external): indicator-2: child is embedded; 7 properties in queue xfce4-panel(external): xfce4-clipman-plugin-16: child is embedded; 7 properties in queue xfce4-panel(external): notification-plugin-6: child is embedded; 7 properties in queue (wrapper-2.0:8658): Gtk-WARNING **: 09:00:12.357: Attempting to add a widget with type GtkToggleButton to a container of type XfcePanelPlugin, but the widget is already inside a container of type XfcePanelPlugin, please remove the widget from its existing container first. (wrapper-2.0:8660): Gtk-WARNING **: 09:00:12.430: Theme parsing error: <data>:1:46: The style property GtkWidget:focus-padding is deprecated and shouldn't be used anymore. It will be removed in a future version (wrapper-2.0:8660): Gtk-WARNING **: 09:00:12.430: Theme parsing error: <data>:1:78: The style property GtkWidget:focus-line-width is deprecated and shouldn't be used anymore. It will be removed in a future version (wrapper-2.0:8660): Gtk-WARNING **: 09:00:12.430: Theme parsing error: <data>:1:108: The style property GtkButton:default-border is deprecated and shouldn't be used anymore. It will be removed in a future version (wrapper-2.0:8660): Gtk-WARNING **: 09:00:12.430: Theme parsing error: <data>:1:136: The style property GtkButton:inner-border is deprecated and shouldn't be used anymore. It will be removed in a future version (wrapper-2.0:8662): Gtk-WARNING **: 09:00:12.431: Negative content width -3 (allocation 1, extents 2x2) while allocating gadget (node button, owner PulseaudioButton) (wrapper-2.0:8657): Gtk-WARNING **: 09:00:12.464: Negative content width -3 (allocation 1, extents 2x2) while allocating gadget (node button, owner GtkToggleButton) (wrapper-2.0:8658): Gtk-WARNING **: 09:00:12.467: Negative content width -3 (allocation 1, extents 2x2) while allocating gadget (node button, owner GtkToggleButton) (wrapper-2.0:8665): Gtk-WARNING **: 09:00:12.485: Negative content width -3 (allocation 1, extents 2x2) while allocating gadget (node button, owner GtkToggleButton) (wrapper-2.0:8661): Gtk-WARNING **: 09:00:12.532: Negative content width -3 (allocation 1, extents 2x2) while allocating gadget (node button, owner PowerManagerButton)
启动Discord后的日志:
Discord 0.0.26 [8716:0418/090018.625660:ERROR:zygote_host_impl_linux.cc(273)] Failed to adjust OOM score of renderer with pid 8837: Permission denied (13) libGL error: MESA-LOADER: failed to open i965: /snap/discord/151/gnome-platform/usr/lib/x86_64-linux-gnu/dri/i965_dri.so: cannot open shared object file: No such file or directory (search paths /snap/discord/151/gnome-platform/usr/lib/x86_64-linux-gnu/dri, suffix _dri) libGL error: failed to load driver: i965 Starting app. Starting updater. 2023-04-18T08:00:18.641Z [Modules] Modules initializing 2023-04-18T08:00:18.641Z [Modules] Distribution: remote 2023-04-18T08:00:18.641Z [Modules] Host updates: disabled 2023-04-18T08:00:18.641Z [Modules] Module updates: enabled 2023-04-18T08:00:18.641Z [Modules] Module install path: /home/[my-user-name]/snap/discord/151/.config/discord/0.0.26/modules 2023-04-18T08:00:18.641Z [Modules] Module installed file path: /home/[my-user-name]/snap/discord/151/.config/discord/0.0.26/modules/installed.json 2023-04-18T08:00:18.642Z [Modules] Module download path: /home/[my-user-name]/snap/discord/151/.config/discord/0.0.26/modules/pending [8837:0418/090018.704384:ERROR:viz_main_impl.cc(186)] Exiting GPU process due to errors during initialization [8716:0418/090018.713061:ERROR:zygote_host_impl_linux.cc(273)] Failed to adjust OOM score of renderer with pid 8874: Permission denied (13) [8874:0418/090018.738772:ERROR:gpu_memory_buffer_support_x11.cc(44)] dri3 extension not supported. [8846:0418/090018.811681:ERROR:command_buffer_proxy_impl.cc(128)] ContextResult::kTransientFailure: Failed to send GpuControl.CreateCommandBuffer. 2023-04-18T08:00:18.852Z [Modules] No updates to install 2023-04-18T08:00:18.859Z [Modules] Host is up to date. 2023-04-18T08:00:18.866Z [Modules] Checking for module updates at https://discord.com/api/modules/stable/versions.json 2023-04-18T08:00:19.055Z [Modules] No module updates available. Optional module ./ElectronTestRpc was not included. [8716:0418/090019.221117:ERROR:object_proxy.cc(623)] Failed to call method: org.freedesktop.login1.Manager.Inhibit




