0

To give a little background to this question. I am running this on a Raspberry Pi the base OS is Debian Raspbian GNU/Linux 10 (buster), Kernel: Linux 4.19.97-v7l+.

Currently the system boots up and runs my custom .exe file with mono on TTY 2. Everything works there but the user interface is very simple and limited (this is done on purpose so people don't mess with things). I would like to have a desktop environment to be running in the background on another tty for easability of working on the executable and tools other then just the terminal.

Currently I am able to go to another tty (I am using 4) and run the command startx /usr/bin/startlxde --:8 and it will boot up LXDE. What I would like it to do is to run this command in the background on tty4 and automatically start LXDE on tty4 so all I would have to do is hit Ctrl+Alt+F4 and there would be LXDE running.

Here is my .xinitrc file as well:

feh /home/pi/program/loading.jpg &
setterm -blank 0
xset s off
xset -dpms
xinput set-prop 6 'Coordinate Transformation Matrix' -1 0 1 0 1 0 0 0 1
mono /home/pi/program/test-11-20.exe**
startx /usr/bin/startlxde --:8** # this part is not doing what I was hoping it would do.
thanasisp
  • 8,122
  • "this part is not doing what I was hoping it would do". What were you hoping for? What did it do? – waltinator Nov 18 '20 at 21:13
  • also: I think you shouldn't run startx as youre already running x when .xinitrc is evaluated. And :8 would start it on TTY8 – rudib Nov 18 '20 at 21:22

1 Answers1

0

.xinitrc should be evaluated when X is started. You could just differentiate by TTY numbers in your script. If I'm right, something like this should work:

case $XDG_VTNR in
   2) exec mono /home/pi/program/test-11-20.exe ;; # or gnome-session, or whatever the command would actually be
   4) exec /usr/bin/startlxde ;;
   *) echo "You've not told me what to do on this tty!" ;;
esac

Snippet found here.

But you might have to start the XOrg on TTY4 with some mechanism. Changing to the TTY and typing startx would be the simplest way to do it (but it can be automated).

Launching X automatically

To launch X, you could just put startx in .bashrc which is run when logging in. However, you should put a condition again or it will happen on any login shell:

# start x if we are on tty2 or 4
[[ -z $DISPLAY && $XDG_VTNR -eq 2 ]] && exec startx
[[ -z $DISPLAY && $XDG_VTNR -eq 4 ]] && exec startx

Additionally, you could also enable autologin, but that can be a security issue. This answer should work for Debain Buster (leave the NAutoVTs and edit for tty2 and 4 if you want autologin on both).

rudib
  • 1,602
  • i am able to get it started by manually typing in startx /usr/bin/startlxde --:4but what i am looking for is getting it automated so i dont have too – mikolp123 Nov 18 '20 at 22:15