From 4e66c0bf2b5751e113ad3aba79891608f7e883e2 Mon Sep 17 00:00:00 2001 From: Tim Egenton Date: Tue, 7 Dec 2021 09:15:18 -0500 Subject: startx: Source XINITRC and XSERVERRC variables Fix issue #14 Check XINITRC and XSERVERRC, if those files do not exist then just use ~/.xinitrc and ~/.xserverc as normal. Signed-off-by: Tim Egenton --- man/startx.man | 24 ++++++++++++++++++++++-- startx.cpp | 13 ++++++++----- 2 files changed, 30 insertions(+), 7 deletions(-) diff --git a/man/startx.man b/man/startx.man index 2b894f7..2fe952d 100644 --- a/man/startx.man +++ b/man/startx.man @@ -71,7 +71,10 @@ startx \-\^\- \-layout Multihead .PP To determine the client to run, .B startx -first looks for a file called +first checks the environment variable +.I XINITRC +for a filename. If that variable is unset, or does not contain a filename, +it looks for a file called .I .xinitrc in the user's home directory. If that is not found, it uses the file @@ -85,7 +88,10 @@ behavior and revert to the behavior. To determine the server to run, .B startx -first looks for a file called +checks the environment variable +.I XSERVERRC +for a filename. If that variable is unset, or does not contain a filename, +it looks for a file called .I .xserverrc in the user's home directory. If that is not found, it uses the file @@ -161,6 +167,20 @@ for the local host. See the and .IR Xsecurity (__miscmansuffix__) manual pages for more information on X client/server authentication. +.TP 25 +XINITRC +This variable should contain the location of an xinitrc file. If unset, +.I $(HOME)/.xinitrc +or +.I __xinitdir__/xinitrc +will be used. +.TP 25 +XSERVERRC +This variable should contain the location of an xserver file. If unset, +.I $(HOME)/.xinitrc +or +.I __xinitdir__/xserverrc +will be used. .SH FILES .TP 25 .I $(HOME)/.xinitrc diff --git a/startx.cpp b/startx.cpp index 7ed38db..dfbebe1 100644 --- a/startx.cpp +++ b/startx.cpp @@ -2,11 +2,12 @@ XCOMM!SHELL_CMD XCOMM XCOMM This is just a sample implementation of a slightly less primitive -XCOMM interface than xinit. It looks for user .xinitrc and .xserverrc -XCOMM files, then system xinitrc and xserverrc files, else lets xinit choose -XCOMM its default. The system xinitrc should probably do things like check -XCOMM for .Xresources files and merge them in, start up a window manager, -XCOMM and pop a clock and several xterms. +XCOMM interface than xinit. It looks for XINITRC and XSERVERRC environment +XCOMM variables, then user .xinitrc and .xserverrc files, and then system +XCOMM xinitrc and xserverrc files, else lets xinit choose its default. +XCOMM The system xinitrc should probably do things like check for +XCOMM .Xresources files and merge them in, start up a window manager, and +XCOMM pop a clock and several xterms. XCOMM XCOMM Site administrators are STRONGLY urged to write nicer versions. XCOMM @@ -47,9 +48,11 @@ export PATH #endif userclientrc=$HOME/.xinitrc +[ -f "${XINITRC}" ] && userclientrc="${XINITRC}" sysclientrc=XINITDIR/xinitrc userserverrc=$HOME/.xserverrc +[ -f "${XSERVERRC}" ] && userclientrc="${XSERVERRC}" sysserverrc=XINITDIR/xserverrc defaultclient=XTERM defaultserver=XSERVER -- cgit v1.2.1