Registered Member
|
After reading http://www.linuxjournal.com/content/start-and-control-konsole-dbus#comment-352588
I got to the following essence of a script:
The problem is figuring out the correct konsole session. Apparently this does not always work:
often it gives me the current konsole session, the one that invoked the script. So I'd like to rule the current konsole session out, and loop over the grep until I get a session different from the invoking session. What I don't know is how to figure out the current session. ny ideas on figuring out the current session (pid of current konsole instance), or some other way to figure out the konsole session I just open ed? Thanks, Dan |
Registered Member
|
So many replied go me to the following solution. It is far from perfect, but it works some of the time (about 50%)
I open a new konsole window, and take its pid. I noticed the konsole session is usually that pid+2. I now check if qdbus has a konsole session with that pid, and if not, I issue an error and [attempt] to kill the new konsole window [the kill never works, and I don;t know why yet]. |
KDE Developer
|
I guess something like this is better than the hack of guessing pid:
|
Registered Member
|
If you always want to get the latest konsole pid...
pidof konsole -> will return the list of pids of all the konsoles ie. [prompt] pidof konsole 36182 6603 4074 then you can determine the age of the processes with ps ps -o etimes= -p 4074 133 ps -o etimes= -p 6603 2458 ps -o etimes= -p 36182 172 so from this, i know that 6603 is the first konsole i opened, 36182 is the second konsole and 4074 is the third konsole so in the latest konsole you know 4074 is the pid to use... |
Registered users: Bing [Bot], daret, Google [Bot], Sogou [Bot]