Running "Notes" Section
The two sets of notes at the bottom of xinitrc#Configuration should be condensed in some way. The first five bullet points all concern which tty X is running on. I could create this as its own subsection, and contain the information there, though I am not entirely convinced that this is necessary/appropriate/needed on this page at all. Would it be more appropriate to merge the relevant sections into the Xorg article, perhaps? Pid1 (talk) 00:30, 26 July 2015 (UTC)
- First of all, the first 4 points are inaccurate. Back in 2013, this was indeed handled by the default
/etc/X11/xinit/xserverrc, which contained
#!/bin/sh if [ -z "$XDG_VTNR" ]; then exec /usr/bin/X -nolisten tcp "$@" else exec /usr/bin/X -nolisten tcp "$@" vt$XDG_VTNR fi
- Now it contains only
#!/bin/sh exec /usr/bin/X -nolisten tcp "$@"
- This will be more work than it seemed, we should investigate... Nevertheless, startx handles the
vtparameter, but plain xinit doesn't, so I'd say the note is perfectly suitable for this page.
- -- Lahwaacz (talk) 08:17, 26 July 2015 (UTC)
- Thanks for the insights. I will cross-reference the documentation with what is provided here, and update accordingly. Pid1 (talk) 13:01, 26 July 2015 (UTC)
propose to add to automatic startx
When combine automatic startx + automatic login to console, it may come to infinite loop/crash if (a) ~/.xinitrc goes wrong somewhere, after editing; or (b) after pacman -Syyu and Xorg crash. I propose to check if the last GUI session (startx session) really last long before start a new one.
if [[ -z $DISPLAY && $XDG_VTNR -eq 1 ]]; then if [[ -f /tmp/login-check-startx.flag ]]; then rm /tmp/login-check-startx.flag echo -e "\nFile '/tmp/login-check-startx.flag' found, maybe the last GUI session did not last long!\n" ## do nothing, start automatic console login else touch /tmp/login-check-startx.flag ( sleep 120; rm /tmp/login-check-startx.flag ) & exec startx fi fi ## Change '/tmp/login-check-startx.flag' to '$HOME/login-check-startx.flag' if you want that check also valid after reboot.
- You might do that without the temporary file by simply looking at the age of the log file:
if [[ -z $DISPLAY && $XDG_VTNR -eq 1 ]]; then if [[ ! -e ~/.local/share/xorg/Xorg.0.log || $(find ~/.local/share/xorg/Xorg.0.log -mmin +2) != "" ]]; then exec startx fi fi
- Or even more simply, don't
exec startx, check its return code and drop to interactive shell on errors:
if [[ -z $DISPLAY && $XDG_VTNR -eq 1 ]]; then startx && exit fi-- Lahwaacz (talk) 21:10, 20 April 2016 (UTC)
- Thanks Lahwaacz. But (a) so the age of a file is based on it's creation time, not update time. OK, i did not know that. (b) about the startx exit code, i am not sure that it will correctly set if i edit something wrong in ~/.xinitrc which make GUI session crash
there are 2 xinit examples which by themselves do not work as laid out, imo they should be removed and instead an optional note could be put (somewhere) that says something like:
- xinit can be executed instead of startx if you know what options to use
- xinit would not obviously fail if you specified the options in xserverrc. If you already have an X server started, you should also pass the
:display_numberoption mentioned in the note after the first example. -- Lahwaacz (talk) 07:35, 12 November 2018 (UTC)
$1 session ?
i tried and the startx deliverd with arch seems to put xterm as $1, $2 contains the session:
$ startx openbox xinit xterm openbox -- /etc/X11/xinit/xserverrc :1 -auth /tmp/serverauth.wh2MYgjhmj $ startx xinit /home/st/.xinitrc -- /etc/X11/xinit/xserverrc :1 -auth /tmp/serverauth.8s9paxN6G8