You are not logged in.

#1 2024-05-18 06:05:54

raphaelabb
Member
From: France
Registered: 2021-02-03
Posts: 35

Auto startx at login

Hello,

As the Wiki says, I have added:

 if [ -z "$DISPLAY" ] && [ "$XDG_VTNR" = 1 ]; then
  exec startx
fi

into ~/.bash_profile.

It works well but can someone explain what is the signification of

 -z "$DISPLAY"

and

 "$XDG_VTNR" = 1

Thanks.

Offline

#2 2024-05-18 08:18:26

Maritim
Member
Registered: 2024-05-17
Posts: 10

Re: Auto startx at login

The -z flag checks whether the $DISPLAY variable has a length of zero and XDG_VTNR contains the number of the virtual terminal in which the GUI session will be run.

Offline

#3 2024-05-18 20:46:07

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 14,854

Re: Auto startx at login

Maritim answer is technically correct, but doesn't explain what the conditions have for effect.

-z "$DISPLAY"
If X has already been started, $DISPLAY will have a length > zero. starting  a second X instance usually fails then.

"$XDG_VTNR" = 1
Only if you are logging in to TTY1 will startx be run .
This allows to use TTY2 and higher for other purposes and allows to run cli commands from tty as user.


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Offline

Board footer

Powered by FluxBB