Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
adding command line options to X
View unanswered posts
View posts from last 24 hours
View posts from last 7 days

 
Reply to topic    Gentoo Forums Forum Index Desktop Environments
View previous topic :: View next topic  
Author Message
curmudgeon
Veteran
Veteran


Joined: 08 Aug 2003
Posts: 1744

PostPosted: Mon Jun 10, 2024 1:47 pm    Post subject: adding command line options to X Reply with quote

This probably sounds like a dumb question (I just spent the last hour looking for an answer without finding one, though), but where do I configure command line options to X (starting X with lxdm as the display manager)? In particular, I want to add +iglx (disabled by default).
Back to top
View user's profile Send private message
netfab
Veteran
Veteran


Joined: 03 Mar 2005
Posts: 1956
Location: 127.0.0.1

PostPosted: Mon Jun 10, 2024 4:07 pm    Post subject: Reply with quote

Here with Xfce :
- the displaymanager is calling a Xfce initialization script (/usr/bin/startxfce4)
- the Xfce initialization script is calling /etc/X11/xinit/xserverrc

In my case it seems there is no way to configure any variable to add some command line option to X.
But I think that could depend on your desktop initialization script.
Anyway, you can hardcode your desired option to /etc/X11/xinit/xserverrc, I guess your desktop should run it in the middle of the initialization process.

Another way would be to copy /etc/X11/xinit/xserverrc to your ~ to modify it, but again, that depends on your desktop initialization script.
For example in /usr/bin/startxfce4 we can find :
Code:

if [ -f "$HOME/.xserverrc" ]; then                                                                     
  SERVERRC="$HOME/.xserverrc $SERVERRC"                                                               
elif [ -f /etc/X11/xinit/xserverrc ]; then                                                             
  SERVERRC="/etc/X11/xinit/xserverrc $SERVERRC"                                                       
fi   
Back to top
View user's profile Send private message
curmudgeon
Veteran
Veteran


Joined: 08 Aug 2003
Posts: 1744

PostPosted: Mon Jun 10, 2024 7:43 pm    Post subject: Reply with quote

netfab wrote:
Here with Xfce :
- the displaymanager is calling a Xfce initialization script (/usr/bin/startxfce4)
- the Xfce initialization script is calling /etc/X11/xinit/xserverrc

In my case it seems there is no way to configure any variable to add some command line option to X.
But I think that could depend on your desktop initialization script.
Anyway, you can hardcode your desired option to /etc/X11/xinit/xserverrc, I guess your desktop should run it in the middle of the initialization process.


I run lxdm as the display manager, and lumina as the desktop environment. After all of these years, I still feel confused about what gets started when (and how). Do I have this correct? The display manager (in the traditional case with display-manager in /etc/runlevels/default) starts X (even before anyone logs in). When a user logs in, the dsiplay manager calls another script (or in my case, a binary file - /usr/bin/start-lumina-desktop) to start the X session.

In my case, I want the option enabled when X starts (before anyone logs in locally). I intend to log in via ssh and run programs on the remote machine.

netfab wrote:

Another way would be to copy /etc/X11/xinit/xserverrc to your ~ to modify it, but again, that depends on your desktop initialization script.
For example in /usr/bin/startxfce4 we can find :
Code:

if [ -f "$HOME/.xserverrc" ]; then                                                                     
  SERVERRC="$HOME/.xserverrc $SERVERRC"                                                               
elif [ -f /etc/X11/xinit/xserverrc ]; then                                                             
  SERVERRC="/etc/X11/xinit/xserverrc $SERVERRC"                                                       
fi   


How would the X server know which user's home directory to look in for xserverrc before anyone has logged in via the display manager?

One would think that the X server would have a configuration file.

I see a place to run X with options in /etc/X11/xinit/xserverrc:

Code:

#!/bin/sh
if [ -z "$XDG_VTNR" ]; then
  exec /usr/bin/X -nolisten tcp "$@"
else
  exec /usr/bin/X -nolisten tcp -keeptty "$@" "vt$XDG_VTNR"
fi


But I have no idea where "$@" or "vt$XDG_VTNR" get set (or what program uses them).
Back to top
View user's profile Send private message
netfab
Veteran
Veteran


Joined: 03 Mar 2005
Posts: 1956
Location: 127.0.0.1

PostPosted: Mon Jun 10, 2024 8:46 pm    Post subject: Reply with quote

Quote:

After all of these years, I still feel confused about what gets started when (and how).

Yes, you're not alone. Things are complicated.

Quote:

The display manager [...] starts X (even before anyone logs in). When a user logs in, the dsiplay manager calls another script [...] to start the X session.

Yes, you're right, I made a mistake in my previous post : in my case, starxfce4 does not call /etc/X11/xinit/xserverrc.
My display manager is having a configuration file (/etc/slim.conf) where we find theses lines :
Code:

default_xserver     /usr/bin/X                                                                         
#xserver_arguments   -dpi 75                                                                           
xserver_arguments   -nolisten tcp -deferglyphs 16

SLim and X are running as root :
Code:

$ ps aux | grep slim
root      2636  0.0  0.1  25600 16720 ?        Ss   09:09   0:00 /usr/bin/slim
root      2643  8.1  1.0 6974524 165484 tty7   Ssl+ 09:09  64:42 /usr/bin/X -nolisten tcp -deferglyphs 16 -auth /var/run/slim.auth vt07

Maybe lxdm is having similar configuration entries ?

I think that the xserverrc file I talk about is used when running X through startx with your ~user, without any display manager.
Back to top
View user's profile Send private message
curmudgeon
Veteran
Veteran


Joined: 08 Aug 2003
Posts: 1744

PostPosted: Mon Jun 10, 2024 11:50 pm    Post subject: Reply with quote

netfab wrote:

My display manager is having a configuration file (/etc/slim.conf) where we find theses lines :
Code:

default_xserver     /usr/bin/X                                                                         
#xserver_arguments   -dpi 75                                                                           
xserver_arguments   -nolisten tcp -deferglyphs 16

SLim and X are running as root :
Code:

$ ps aux | grep slim
root      2636  0.0  0.1  25600 16720 ?        Ss   09:09   0:00 /usr/bin/slim
root      2643  8.1  1.0 6974524 165484 tty7   Ssl+ 09:09  64:42 /usr/bin/X -nolisten tcp -deferglyphs 16 -auth /var/run/slim.auth vt07

Maybe lxdm is having similar configuration entries ?


I do see something in /etc/lxdm/lxdm.conf that looks of interest, but apparently says "not fully functional."

Code:

[server]
## arg used to start xserver, not fully function
# arg=/usr/bin/X -background vt1
# uncomment this if you really want xserver listen to tcp
# tcp_listen=1
# uncoment this if you want reset the xserver after logou
# reset=1


Code:

$ ps auwx | grep lxdm
root      2444  0.0  0.0   4720  3452 ?        Ss   Jun09   0:00 /usr/sbin/lxdm-binary
root      2501  0.2  0.6 553848 113324 tty7    Ssl+ Jun09   6:22 /usr/bin/X :0 vt07 -nolisten tcp -novtswitch -auth /var/run/lxdm/lxdm-:0.auth


Where does the "-novtswitch" option come from (that location suggests a place to add other options)? A search for vtswitch via grep in all of /etc/ turned up no matches.
Back to top
View user's profile Send private message
netfab
Veteran
Veteran


Joined: 03 Mar 2005
Posts: 1956
Location: 127.0.0.1

PostPosted: Tue Jun 11, 2024 6:48 am    Post subject: Reply with quote

Quote:

Where does the "-novtswitch" option come from (that location suggests a place to add other options)?

No. It comes form lxdm itself :
https://sourceforge.net/p/lxdm/code/ci/master/tree/src/lxdm.c#l503
Code:

   if(!novtswitch)
   {
      arg[arc++] = g_strdup("-novtswitch");
   }


Reading this function I'm afraid that there is no way to add custom options with lxdm without patching it.
Back to top
View user's profile Send private message
Hu
Administrator
Administrator


Joined: 06 Mar 2007
Posts: 22626

PostPosted: Tue Jun 11, 2024 12:02 pm    Post subject: Reply with quote

With the caveat that I only spent a few minutes reading the source that netfab linked, and have no other experience with lxdm, I suspect it may be possible (albeit inconvenient) to add options. On https://sourceforge.net/p/lxdm/code/ci/master/tree/src/lxdm.c#l446 and #l447, the program loads (seemingly from a configuration file) a path to the X server and, if none was found, defaults it to /usr/bin/X. I suggest using that configuration file to set a path to a custom "X server" that is really a shell script such as:
/home/me/bin/wrap-start-X.sh:
#!/bin/sh

exec /usr/bin/X --my-custom-argument1 "$@"
This will allow you to add/remove arguments before the real X starts.
Back to top
View user's profile Send private message
Ralphred
l33t
l33t


Joined: 31 Dec 2013
Posts: 652

PostPosted: Tue Jun 11, 2024 12:28 pm    Post subject: Reply with quote

curmudgeon wrote:
I do see something in /etc/lxdm/lxdm.conf that looks of interest, but apparently says "not fully functional."

Code:

[server]
## arg used to start xserver, not fully function
# arg=/usr/bin/X -background vt1
# uncomment this if you really want xserver listen to tcp
# tcp_listen=1
# uncoment this if you want reset the xserver after logou
# reset=1


It may not be "fully functional", but if you just add/alter the line to read
Code:
arg=/usr/bin/X +iglx
it works.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Desktop Environments All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum