Want to start a graphical application from console, using sudo? You might get an error like
qt.qpa.xcb: could not connect to display :0
qt.qpa.plugin: From 6.5.0, xcb-cursor0 or libxcb-cursor0 is needed to load the Qt xcb platform plugin.
qt.qpa.plugin: Could not load the Qt platform plugin “xcb” in “” even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
Because sudo doesn’t have any display attached to it. Settings the environment variable WAYLAND_DISPLAY fixes the issue
sudo /bin/env WAYLAND_DISPLAY="$XDG_RUNTIME_DIR/$WAYLAND_DISPLAY" APPLICATIONNAME
replacing APPLICATIONNAME with the application or command you want to execute.
You can also add XDG_RUNTIME_DIR=/… if you want to tell the app where to store temporary files.
sudo /bin/env WAYLAND_DISPLAY="$XDG_RUNTIME_DIR/$WAYLAND_DISPLAY" XDG_RUNTIME_DIR=/user/run/0 APPLICATIONNAME
So, for completeness, to run the howdy test command
sudo /bin/env WAYLAND_DISPLAY="$XDG_RUNTIME_DIR/$WAYLAND_DISPLAY" XDG_RUNTIME_DIR=/user/run/0 howdy test