I write a program.I want the program have only a instance.If the
instance exist then take the window top.
How to do it?
–
weiwufeng [email protected]
I write a program.I want the program have only a instance.If the
instance exist then take the window top.
How to do it?
–
weiwufeng [email protected]
On 24 November 2010 13:13, blackspace [email protected] wrote:
I write a program.I want the program have only a instance.If the instance exist
then take the window top.How to do it?
I have seen it done this way:
Write a small file containing the PID of the application. You usually
write the file in /var/run
Check to see if the file exists when the application starts. If
it doesn’t write the file and continue. If it exists read the file.
Then send a signal to the PID using kill.
The application should catch the signal. If it gets the signal
it should raise the window to the top.
Unfortunately I don’t have rdoc installed on this machine to find
the correct calls to make in ruby. Hopefully you can use this
information
to find the answers.
You need:
- the call to get the PID of the application
- the way to send a signal to another application (the unix
command is kill)
- the way to catch the signal
- the way to raise the window to the top (it should be in the
Ruby-Gnome
documentation on the window object)
Hope that helps!
MikeC
see GtkUnique
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs