abc-mikey / xgamer

Automatically exported from code.google.com/p/xgamer
0 stars 0 forks source link

Displacing user's .xinitrc is dangerous - see safer implementation inside #12

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
It's a little sketchy to displace the user's .xinitrc file.

If xgamer crashes, the user's main xinit config can be broken.

Here is an alternative (tested on my machine):

ADD near other constants:

use constant DISPLAY_ID => 1;

(This addition is just to make it easier to change DISPLAY_ID, for users who 
have :1 already in use. In the future, this could be a command-line option)

CHANGE 
        # Create xgamer startup script for startx
to 
        # Create xgamer startup script for xinit 

CHANGE:

$files{xinitrc} = "$ENV{HOME}/.xinitrc";

to 

$files{xinitrc} = "$ENV{HOME}/.xinitrc";

CHANGE
        &exnowait("startx -- :" . DISPLAY_ID);
to
        &exnowait("XINITRC=$files{xinitrc} xinit -- :" . DISPLAY_ID);

This also replaces startx with xinit -- I'm not exactly sure if there are other 
side-effects of that change, but I'm pretty sure the only difference is that 
startx uses a hardcoded list of xinitrc files, whereas xinit supports the 
$XINITRC environment variable.

Original issue reported on code.google.com by michaelr...@gmail.com on 16 May 2011 at 1:00

GoogleCodeExporter commented 9 years ago
Hi, 

Thanks for the advice this us a much better way of starting a new X11 session. 
I had taken some care to move rather than delete or copy the existing .xinitrc 
file but there was a danger it could end up in its new position and a user 
wouldn't know how to replace it. 

It's been a while but I've recently done a fairly major rewrite of xgamer and 
included your method, I also found a way of supplying openbox configuration 
files without displacing anything. So it's now 100% safe assuming there arnt 
ant issues with permissions.

Thanks for your help.  

Original comment by abc.mi...@gmail.com on 22 Sep 2012 at 8:58