如何摆脱:警告:忽略 Gnome 上的 XDG_SESSION_TYPE=way​​land。无论如何,使用 QT_QPA_PLATFORM=wayland 在 Wayland 上运行。(Ubuntu 22.04)

如何摆脱:警告:忽略 Gnome 上的 XDG_SESSION_TYPE=way​​land。无论如何,使用 QT_QPA_PLATFORM=wayland 在 Wayland 上运行。(Ubuntu 22.04)

我在 Ubuntu 22.04.2 LTS 上,收到很多有关 syslog 的日志消息

Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway.

提供此功能的程序包括notepadqq.desktopgsd-media-keysorg.flameshot.Flameshot。下面是示例。我从 Dock 上的快捷方式启动 notepadqq,然后会得到以下结果var/log/syslog

Apr 14 13:16:34 niko-ubuntu systemd[1853]: Started Application launched by gnome-shell.
Apr 14 13:16:34 niko-ubuntu notepadqq.desktop[12430]: Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway.
Apr 14 13:16:34 niko-ubuntu notepadqq.desktop[12430]: QSocketNotifier: Can only be used with threads started with QThread

查看 notepadqq 进程 (12430) 的环境变量时,我发现它具有QT_QPA_PLATFORM=wayland

niko@niko-ubuntu:/var/log$ cat /proc/12430/environ | tr '\0' '\n'
GJS_DEBUG_TOPICS=JS ERROR;JS LOG
LC_TIME=fi_FI.UTF-8
USER=niko
XDG_SESSION_TYPE=wayland
SHLVL=0
HOME=/home/niko
DESKTOP_SESSION=ubuntu
GIO_LAUNCHED_DESKTOP_FILE=/usr/share/applications/notepadqq.desktop
GTK_MODULES=gail:atk-bridge
GNOME_SHELL_SESSION_MODE=ubuntu
LC_MONETARY=fi_FI.UTF-8
MANAGERPID=1853
SYSTEMD_EXEC_PID=2068
DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus
GIO_LAUNCHED_DESKTOP_FILE_PID=12430
IM_CONFIG_PHASE=1
WAYLAND_DISPLAY=wayland-0
LOGNAME=niko
_=/usr/bin/gnome-session
JOURNAL_STREAM=8:31438
PYTHONBREAKPOINT=IPython.embed
XDG_SESSION_CLASS=user
USERNAME=niko
GNOME_DESKTOP_SESSION_ID=this-is-deprecated
PATH=/home/niko/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/snap/bin
SESSION_MANAGER=local/niko-ubuntu:@/tmp/.ICE-unix/2047,unix/niko-ubuntu:/tmp/.ICE-unix/2047
INVOCATION_ID=335082c2c31843c5974cbbe32e6a44ea
LC_ADDRESS=fi_FI.UTF-8
XDG_RUNTIME_DIR=/run/user/1000
XDG_MENU_PREFIX=gnome-
GNOME_SETUP_DISPLAY=:1
DISPLAY=:0
LANG=en_US.UTF-8
LC_TELEPHONE=fi_FI.UTF-8
XDG_CURRENT_DESKTOP=ubuntu:GNOME
XDG_SESSION_DESKTOP=ubuntu
XMODIFIERS=@im=ibus
XAUTHORITY=/run/user/1000/.mutter-Xwaylandauth.G2DN31
SSH_AGENT_LAUNCHER=gnome-keyring
SSH_AUTH_SOCK=/run/user/1000/keyring/ssh
LC_NAME=fi_FI.UTF-8
SHELL=/bin/bash
QT_ACCESSIBILITY=1
GDMSESSION=ubuntu
LC_MEASUREMENT=fi_FI.UTF-8
LC_IDENTIFICATION=fi_FI.UTF-8
GJS_DEBUG_OUTPUT=stderr
QT_IM_MODULE=ibus
PWD=/home/niko
QT_QPA_PLATFORM=wayland
XDG_DATA_DIRS=/usr/share/ubuntu:/usr/local/share/:/usr/share/:/var/lib/snapd/desktop
XDG_CONFIG_DIRS=/etc/xdg/xdg-ubuntu:/etc/xdg
LC_NUMERIC=fi_FI.UTF-8
LC_PAPER=fi_FI.UTF-8

我在我的 中有这个设置~/.profile

export QT_QPA_PLATFORM=wayland 

从终端启动程序时我也会看到同样的警告:

niko@niko-ubuntu:/var/log$ echo $QT_QPA_PLATFORM
wayland
niko@niko-ubuntu:/var/log$ notepadqq
Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway.
QSocketNotifier: Can only be used with threads started with QThread

为什么我会收到此警告?我该如何消除它?

相关内容