LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   Calling startx from inside the application (https://www.linuxquestions.org/questions/slackware-14/calling-startx-from-inside-the-application-4175486725/)

nitin_kumgoyal 12-03-2013 01:06 PM

Calling startx from inside the application
 
I have made an app with xlib and i call it with startx and path of application as its param


startx /home/app/testapp

now, i want to try out to call startx form insdie the app directly instead of calling explicitly so, it will be like when i will the my application, it will call startx with the rest of my application.

I have tried with calling .xinitrxc from code etc but it doesnot seems working.

Any ideas for that to try out?

rtmistler 12-05-2013 08:17 AM

The reverse of what you're talking about, a thread I posted a few days ago and my trials and tribulations at getting auto-start of X server and my full screen application at system boot: Having Trouble Configuring to Autostart App in Xserver with no Display Manager.

A good reference I ran into for xorg.conf was: http://www.x.org/archive/X11R6.8.0/doc/xorg.conf.5.html, that one helped me a lot.

From what I gathered:

1. startx can be called with some parameters, simple google searches helped me with that, although I did not know you could specify starting an app as an argument to startx, my intentions were to disable the mouse cursor because it is a touch screen application.
2. /usr/lib/X11/xinit/xinitrc - note not a DOT<name> file, just xinitrc, IS run when you load the X server. And it's a shell script, therefore when you put in stuff like:
Code:

#!/bin/sh
exec <path>/your-application

It will run your program, that's exactly what I did.
3. If you wish to disable things like power management, screen saver, and screen blanking, that all falls under the xorg.conf file.

I hope some of this helps. I guess I'm confused as to why you want to load the Xserver as part of your application, unless you want the Xserver to load in a special manner or to do so automatically without user intervention, excepting that they run an application.

chemfire 12-07-2013 03:42 PM

You could certainly setup the environment and then use something from the exec() family of functions or however you start an external process without waiting from the language you are using; before doing any xlib stuff.

I don't recommend this though. I think a far better solution would be a wrapper script. The script can start X, ideally conditionally even based on if its already running and the current user has permission to connect to the X server, and then start your process. There is no law you can't put a shell script in /bin after all.

What specific problem are you trying to solve by having your process parent the X server directly?


All times are GMT -5. The time now is 02:51 AM.