garberw
Posts: 21
Joined: Wed Jun 08, 2022 2:08 pm

login to raspi with ssh -X; bookworm runs Xwayland; see xeyes on raspi display not desktop

Tue Feb 20, 2024 9:30 am

Here is my setup; I have a desktop running fedora wayland and gnome; I want to log in from the desktop to the raspi using

Code: Select all

ssh -X
or

Code: Select all

waypipe ssh username@raspi
; I want to then run a tkinter program on the raspi and see the output on
(a) the screen of the raspi
(b) the screen of the desktop
(c) either (not at same time !!!!)
the raspi is running bookworm and Xwayland;
If this is something to do with the DISPLAY variable I am confused.
I can do (b) by setting

Code: Select all

DISPLAY=localhost:10.0
(NOTE 10.0 not 0.0)
stumped on how to do (a) but I can run the app using kiosk mode. Trying to debug it over the ssh connection and see it on the raspi display;

by the way the raspi display is a tiny monitor hooked up to the raspi hdmi plug;

I understand that wayland is not capable of running windows remotely like "ssh -X" but what is waypipe ????;
I can log in to the raspi with waypipe and run geany (a gui app) on the raspi and see the window on my desktop.

garberw
Posts: 21
Joined: Wed Jun 08, 2022 2:08 pm

Re: login to raspi with ssh -X; bookworm runs Xwayland; see xeyes on raspi display not desktop

Tue Feb 20, 2024 10:38 am

figured it out.

Sorry I should clarify the main problem.
The context is that I develop gui code from a terminal on the desktop. The terminal is logged on by "ssh -X" to the raspi where the gui code is stored. The gui code runs on the raspi. I have to see if the gui code creates a window that fits on the tiny raspi monitor. When the gui code is stable it will run in kiosk mode on the raspi. An example of gui code is xclock.

Suppose user1 executes on the desktop

Code: Select all

$ ssh -X user2@raspi
$ export DISPLAY=:0
$ xclock &
This only works if user2 is running the xserver on the raspi of course. Then the xclock appears on the monitor directly connected to the raspi as desired. That was what was confusing me. Silly but browsing other blogs perhaps lots of other people were confused by that.

It has nothing to do with "xhost +".

garberw
Posts: 21
Joined: Wed Jun 08, 2022 2:08 pm

Re: login to raspi with ssh -X; bookworm runs Xwayland; see xeyes on raspi display not desktop

Fri Mar 01, 2024 6:10 am

all-inclusive solution:

Code: Select all

$ waypipe ssh -X username@remotehost

# to display on remotehost
$ export DISPLAY=":0"
$ export WAYLAND_DISPLAY="wayland-1"

# or to display on local desktop
# in bashrc before setting display include line
# WAYLAND_DISPLAY_ORIG=$WAYLAND_DISPLAY
# then later you can do this to return display to desktop

$ export DISPLAY="localhost:10.0"
$ export WAYLAND_DISPLAY=$WAYLAND_DISPLAY_ORIG

User avatar
thagrol
Posts: 11319
Joined: Fri Jan 13, 2012 4:41 pm
Location: Darkest Somerset, UK

Re: login to raspi with ssh -X; bookworm runs Xwayland; see xeyes on raspi display not desktop

Fri Mar 01, 2024 2:00 pm

Some feedback/comments.
  • While I don't use it, (because doing so is more hassle than it's worth for me see viewtopic.php?t=358853&start=25#p2196529) the way I understand waypipe is used is this:

    Code: Select all

    waypipe ssh user@host xeyes
    not

    Code: Select all

    waypipe ssh -X user@host
  • You can set display on a per command basis:

    Code: Select all

    DISPLAY=:0 xeyes
    This does not change the value set by export and shown by env
  • If you're only going to run GUI apps on the PI's desktop you can leave out the -X argument to ssh.
  • It's not always and not guaranteed to be localhost:10.0. The first concurrent ssh -X connection gets that. Each subsequent concurrent connection gets the display number incremented by 1 (localhost:11.0, localhost:12.0, etc). They stay at those values even if a connection with a lower display number is closed. It also doesn't matter if all the ssh -X connections logged in as the same or different users.
  • xhoat + may still be relevant but only if you want to login to your Pi as a different user to the one currently logged in to its desktop and want to run a GUI application on that desktop. In which case you'd need to run it from within the logged in desktop. Even then xhost +username is a more secure option.
    [/list

    Now, that said, you have a solution that works for you. The above is intended to make things easier still and to help you and others avoid some potential pitfalls.
Knowledge, skills, & experience have value. If you expect to profit from someone's you should expect to pay for them.

All advice given is based on my experience. it worked for me, it may not work for you.
Need help? https://github.com/thagrol/Guides


Return to “Networking and servers”