LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 12-03-2013, 01:06 PM   #1
nitin_kumgoyal
LQ Newbie
 
Registered: Nov 2013
Posts: 4

Rep: Reputation: Disabled
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?
 
Old 12-05-2013, 08:17 AM   #2
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,883
Blog Entries: 13

Rep: Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930
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.
 
Old 12-07-2013, 03:42 PM   #3
chemfire
Member
 
Registered: Sep 2012
Posts: 422

Rep: Reputation: Disabled
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?
 
  


Reply

Tags
startx, xlib, xserver



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
question about calling an array inside of a user defined function? lleb Programming 7 07-26-2013 05:59 AM
calling curl inside .sh file fachhoch@gmail.com Linux - Newbie 2 06-09-2012 02:02 AM
not calling function inside switch case??? sarathius Programming 2 01-29-2008 10:38 AM
calling startx from cron, no go Plastech Linux - General 2 05-23-2007 08:13 PM
calling a c++ binary inside a perl script Blue_muppet Programming 3 08-28-2004 11:31 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 09:07 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration