0

I am currently writing an application with GUI for an Raspberry Pi with touchpad. Currently, whenever I have transferred a new binary from the PC with the development environment to the pi, I have to plug a keyboard into the pi and start the application with startx /path/to/binary. After a while this becomes a bit annoying, so I'd like to be able to start the gui from the developing PC over ssh.

I have already found out how to start it remotely if there is already an X Server running. Unfortunately this hasn't helped me so far, because I can't bring the X Server to stay open, since it immediately terminates once the client program terminates. But I don't want a desktop or window manager to run, since I only need the single application window.

So now to my question. How can I keep the X Server open? Is there an option I have overlooked so far or some other workaround? Or is there maybe a better solution to my problem that's completely unrelated?

2 Answers 2

1

Maybe add an semi-infinite sleep to the end of your .xinitrc, e.g. sleep 5000000? Note there is no & character on the end of this command.

Typically this is where you would put a window manager or session manager command but you say you don't want one of them, so you need another long running program to keep the Xserver alive.

sleep will consume zero resources.

2
  • Thanks, this seems to be the easiest and most straightforward solution!
    – ObiBabobi
    May 10, 2022 at 16:48
  • Not specifically related to the question, but you might like to look into programs like github.com/cortesi/modd which in their daemon mode can monitor the filesystem and kill off and restart your X program whenever the program changes. This way you just need to copy the new program to the Pi, and it will automatically restart.
    – icarus
    May 11, 2022 at 8:48
1

Instead of trying to keep the X server open, you could restart it automatically. On your Pi, run

while :; do startx /path/to/binary; done

That way, whenever you update your binary, you can kill it, and the X server will restart with the new binary.

If you need to be able to stop this, you can add a condition, for example

until [ -f /tmp/stop ]; do startx /path/to/binary; done

Whenever you want to exit the loop,

touch /tmp/stop

and then kill your program — it won’t restart.

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .