Task #1157
openTask #1156: Logging, debug and user messages
Catch X output
0%
Description
Which is kinda hard. startx is a mess
Files
Updated by Stefan Mark almost 5 years ago
Some notes¶
For now, i focus on using startx. This is how you call it:$ startx [ [ client ] clientargs -- [ server ] [ display ] serverargs ]
Whereas server is the X Server you want use (usually Xorg). The client is whatever X Client you want to start first. Except it can be anything, does not have to be an actual X Client. But if it ends, the Server will be terminated. All arguments are optional.
In the end, startx will call xinit like this:
xinit "$client" $clientargs -- "$server" $display $serverargs
Now, a quirky one our startx is, indeed. Noted the brackets within brackets? Well. The double dashes (--) split startx's parameters in two parts, the first client and second server related. So:
- If the first parameter of the client section starts with either "./" or "/" (e.g. is a path), its considered to be the client parameter. Same goes for the first parameter of the server section. Its then considered the server parameter.
- The first parameter in the server section (or the second if server is given) has the form ":[0-9]+" its considered the display parameter
- If no client, but at least one clientargs ist given, $client defaults to xterm. If neither client nor clientargs are given, $client defaults to "~/.xinitrc" or "/etc/X11/xinit/xinitrc". Otherwise, $client is set to client.
- If no server, but at least one serverargs ist given, server defaults to /usr/bin/X. If neither server nor serverargs are given, server defaults to "~/.xserverrc" or "/etc/X11/xinit/serverrc". Otherwise, $server is set to server.
Now lets take a break. You noted how much alike the calls for startx and xinit are? Know what? xinit does the exact same thing startx did so far. Especially the quirky client and server parameter thingy. Except (because why not?) that xinit defaults to xinitrc/xsererverrc, regardless of additional client/server parameters.
Aside from those shenanigans, startx also takes care of X authority credentials and extendes $serverargs accordingly. This part is a bit voodoo and i guess i can spare me some pain by just sticking to start instead of doing those stuff myself. And, for whatever arcane reasons, startx adds a VT# parameter to $serverargs where # is the current VT.
Some troubles¶
Usually, using startx is trivial. It runs ~/.xinitrc and you put there what you want to do. But i have some extra wishes:- I want to be able to have several different X sessions. Like, what i usually use, a failsafe xterm, something easy to use for guests to use, such things.
- I do not want the console cluttered with all kinds of messages. I want my messages neatly sorted by issuer in nice log files.
- I want X to run on VT7. Just because its what i'm used to.
(1.) is easy: wack a parameter PARAM to startx. As explained above, $client will then be xterm and $clientparam will be PARAM. What. What does that help? Quirky, remember? I said xinit does the exact same thing. And it does. See, "xterm" neither starts with "./" not "/", thus its not a client, xinit default to one of the two xinitrc's. Thus, client is your ~/.xinitrc with parameter PA... Well. No. With parameters "xterm PARAMS". Its a mess. Just check in your ~/.xinitrc if the first parameter is "xterm" and shift it then.
(2.) Is also easy. Create an .xserverrc, put in it whats in /etc/X11/xinit/xserverrc (probably something in the line of /usr/bin/X ...) and redirect stdin and stderr to where the logs go.
Where do the logs go when we're logless Tell me where do they go Where do the lost notes fly when will we segfault Say where do we go
(3.) Is a pita. I want to add "VT7" as a server parameter. But startx, as noted, sets VT to be the same as the current terminal. Well ok. Sieve through all server parameters, find VT# and replace it with VT7 as Berkely wanted us!
Updated by Stefan Mark almost 5 years ago
- File .xserverrc .xserverrc added
- File .xinitrc .xinitrc added
As a reference, here are my current xserverrc and xinitrc
Updated by Stefan Mark almost 5 years ago
- Category changed from interface to nxinit
Updated by Stefan Mark almost 5 years ago
Added nxxserverrc to nxinit. I probably should add a simple nxxinitrc too. Or maybe to examples.
Updated by Stefan Mark almost 5 years ago
- Blocked by Task #1191: How to make user settings before the session is started? added