LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 08-02-2005, 04:10 AM   #1
oldh
LQ Newbie
 
Registered: Aug 2005
Distribution: Redhat/Fedora
Posts: 2

Rep: Reputation: 0
How to start my GUI program by a daemon?


Greetings

This is Chunhao, I need your help on my problem below:

I wrote a daemon named "key_captured", which is used to catch
some special key presses of Sony Vaio notebook, for instance, when
I press the "DVD" on the keyboard, the daemon will call the media
player "kaffeine", and if I press "Fn + F7", the daemon will show a
GUI named "display_switch", written with Qt by me.

I made a symbolic link of "key_captured" with the command:
#ln -s /usr/sbin/key_captured /root/.kde/Autostart/
so that this daemon starts automatically each time when X starts
(I'm using KDE). I find that this method can work fairly well,
"key_captured" can catch my key press and call the corresponding
GUI applications.

But now, for some reason, I need to add my "key_captured" into
system services to start the daemon automatically, instead of the
method by symbolic link. I find If the daemon is started by system
services, it can NOT catch my key presses under X-Window. I do not
know the exact reason, maybe there is some bug in my daemon
"key_captured", I'm using:
system("kaffeine &");
system("display_switch &");
to execute the GUI programs.

Would you please give me some suggestion on how to solving this
program? Should I use "fork"-like system calls to produce the GUI
process, and make it the child process of X?

Thanks
Best Regards
Chunhao
 
Old 08-02-2005, 04:23 AM   #2
bigrigdriver
LQ Addict
 
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian stable
Posts: 5,908

Rep: Reputation: 356Reputation: 356Reputation: 356Reputation: 356
Try putting your scripts in /home/<username>/.kde/Autostart. Then see what happens when you reboot.
 
Old 08-02-2005, 04:41 AM   #3
oldh
LQ Newbie
 
Registered: Aug 2005
Distribution: Redhat/Fedora
Posts: 2

Original Poster
Rep: Reputation: 0
I have tried this method, it can work. but this time I want to use another method,
which is start the daemon as system services, It does NOT work.
 
Old 08-05-2005, 02:04 PM   #4
bastl
Member
 
Registered: Sep 2003
Location: Germany/BW
Distribution: My own
Posts: 237

Rep: Reputation: 22
What I find out, is that kde has it's own scheduler, so the linux-system and kde-system are separated.
I'm looking for something similar like you want to do. Kde has mime-types for execution. So make a kde-link to your bin or whatever with the needed kde-rules maybe that works. Oh.. is KDE started before execution? only if you get an error like no connection to x-server you'r out of the KDE-system.
 
  


Reply



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
Start a daemon/program at boot SchwipSchwap Linux - Newbie 15 01-24-2006 01:58 AM
good ftp daemon with gui gejoroni Linux - Software 4 09-27-2005 07:02 AM
start gui based program after user login shahidawan Linux - General 9 07-27-2005 08:46 PM
Start program in daemon mode from cgi-bin Xa! Programming 1 11-30-2004 11:00 PM
is there a irc daemon that has GUI? im using RH8 can someone help? thanks ;) kublador Linux - Software 5 05-29-2003 01:56 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 08:35 AM.

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