ubuntu syslog中appindicator报错解决

前言

之前观察syslog中总有报错:

shell 复制代码
gnome-shell[3325]: Unhandled promise rejection. To suppress this warning, add an error handler to your promise chain with .catch() or a try-catch block around your await expression. Stack trace of the failed promise:#012 refreshPropertyOnProxy@/usr/share/gnome-shell/extensions/ubuntu-appindicators@ubuntu.com/util.js:43:38#012 _translateNewSignals/<@/usr/share/gnome-shell/extensions/ubuntu-appindicators@ubuntu.com/appIndicator.js:212:18#012 _translateNewSignals@/usr/share/gnome-shell/extensions/ubuntu-appindicators@ubuntu.com/appIndicator.js:211:50#012 _onProxySignal/<@/usr/share/gnome-shell/extensions/ubuntu-appindicators@ubuntu.com/appIndicator.js:228:56#012 _onProxySignal@/usr/share/gnome-shell/extensions/ubuntu-appindicators@ubuntu.com/appIndicator.js:228:38

定位到是 gnome-shell托盘插件报的js错误,系统自带的版本有些古老

虽然对我没有任何影响,当时强迫症患者不想看到任何报错,所有花时间解决了一下

解决

卸载系统自带的托盘插件:

bash 复制代码
sudo apt purge gnome-shell-extension-appindicator

我的gnome-shell版本是 GNOME Shell 42.9

用的托盘插件版本是v47

clone最新的项目:

bash 复制代码
git clone https://github.com/ubuntu/gnome-shell-extension-appindicator.git

切换到v47版本

bash 复制代码
git checkout v47

编译安装:

bash 复制代码
meson gnome-shell-extension-appindicator /tmp/g-s-appindicators-build
ninja -C /tmp/g-s-appindicators-build install
gnome-extensions enable appindicatorsupport@rgcjonas.gmail.com

可以在拓展程序中看到安装的拓展

插件安装的目录在:

复制代码
~/.local/share/gnome-shell/extensions/

正常编译安装完成后,需要重启gnome-shell (否者在拓展中看不到)

重启gnome-shell:

复制代码
同时按下 Alt + F2 组合键,调出命令窗口。
输入字母 r(小写),按回车执行。