[Konsole-devel] Review Request: Upgrade TerminalInterface to V2 and add two more functions that needed by dolphin. 1. Apps can query if a sub process is running in terminal. 2. Apps can query if there is any input text on command prompt that waits for a RETURN key.

Robert Knight robertknight at gmail.com
Sun Mar 29 13:24:02 UTC 2009



> On 2009-03-29 04:38:13, David Nolden wrote:
> > Would it be technically possible to add a signal "foregroundProcessStarted(pid, name, cmdline)", and adding a function QString foregroundProcessCmdLine()?
> > 
> > cmdline = command line = command used for starting the process, for example "ls *.h" = cmdline, "ls" = name
> > 
> > Another very  useful feature would be something like "processWaitsForUserInput()", together with a signal. The use-case would be that a command could be launched with the konsole window hidden, and it would only  be shown when some user-input is needed. Is this implementable?
> 
> Rahman Duran wrote:
>     Nope, dude :) I digged it too much. It's simply impossible to implement such features, not even hard. It can be implemented only in the underlying shell program like bash, sh etc. They don't tell us whats going in them.

> The use-case would be that a command could be launched with the konsole window hidden, and it would only  be shown when some user-input is needed

The Ubuntu installer will do this if a package tries to ask a question during installation - which is against the rules but some bad packages still do.  I have a feeling that this is based on a timeout though.  Check with jriddell

> Would it be technically possible to add a signal "foregroundProcessStarted(pid, name, cmdline)"

Not one that is guaranteed to work reliably as far as I know.  In Konsole a crude heuristic is used that when the user types into a shell we check which process is controlling the terminal a couple of seconds later and update the tab titles accordingly.  We could emit a signal at that point which would probably be okay if you just wanted to update the UI when a program was started in the terminal but not good enough for all use cases.

> cmdline = command line = command used for starting the process, for example "ls *.h" = cmdline, "ls" = name

We can give you the command-line for foreground process, that's just a matter of reading the /proc/PID/cmdline file and there is code to do that in Konsole.  However, the functionality of extracting information from a process really shouldn't go in TerminalInterface.  Once you have got the PID of the process it would be better if you could pass this to some kdelibs library class which provides information about a process with a given ID.  In Konsole there is a ProcessInfo class which has implementations for Linux and Solaris.


- Robert


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://reviewboard.kde.org/r/444/#review680
-----------------------------------------------------------


On 2009-03-28 15:58:08, Rahman Duran wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://reviewboard.kde.org/r/444/
> -----------------------------------------------------------
> 
> (Updated 2009-03-28 15:58:08)
> 
> 
> Review request for kdelibs and Konsole.
> 
> 
> Summary
> -------
> 
> This is a new interface that extends the old ones functionality. 
> 
> 
> Diffs
> -----
> 
>   trunk/KDE/kdelibs/interfaces/terminal/CMakeLists.txt 945618 
>   trunk/KDE/kdelibs/interfaces/terminal/kde_terminal_interface_v2.h PRE-CREATION 
> 
> Diff: http://reviewboard.kde.org/r/444/diff
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Rahman
> 
>




More information about the konsole-devel mailing list