Some of them suggest running the apps with xwayland. Others suggest some apps can have problems if they are requring root privileges. There’s this one that also suggests running a specific wayland process, and then running a window compositor like openbox to then launch the app that you want to run: Run buggy X11 apps with Xwayland rootful mode
It may also be worth asking the devs of the UPSmart software how to run their app on wayland, as I expect they’ve encountered it before now most likely.
Thank you very much.
Your Google search results were a gold mine.
Both “unset WAYLAND_DISPLAY” and “GDK_BACKEND=x11 your_gtk_app_command”
get the program running.
The gotcha is that it only works for a normal user; not for root.
Running as a normal user the program looks to be running properly but it
cannot open the USB-connected UPS; presumably because of permissions.
Trying as root, it still fails with the cannot connect to X error.
Another way to get it running as a normal user, would be to connect it via usb, check dmesg, to see what /dev/usb device or whatever it appeared as, and then check the permissions on that /dev/whatever. You can then add the user to the group of that device. I usually do this when I connect my USB serial cable so that I don’t have to run minicom as root.
But your sudo option is fine also as it saves having to do all that. But you could do the above if you didn’t want to use sudo.