How does ksmserver start applications?

Roland Seuhs roland at
Mon Aug 26 23:23:16 BST 2002


This has been previously posted here:

I need the information for this program:

ksmserver starts applications to restore a session. Unlike kstart, which 
starts apps on the current desktop and later moves them to another desktop, 
ksmserver starts those apps seamlessly and without flicker and without 
stealing focus.

ksmserver does the following:

void KSMServer::startApplication( const QStringList& command )
    if ( command.isEmpty() )
    int n = command.count();
    QCString app = command[0].latin1();
    QValueList<QCString> argList;
    for ( int i=1; i < n; i++)
       argList.append( QCString(command[i].latin1()));

      QByteArray params;
      QDataStream stream(params, IO_WriteOnly);
      stream << app << argList;
      kapp->dcopClient()->send(launcher, launcher, 
"exec_blind(QCString,QValueList<QCString>)", params);

However the complete code is quite complicated and I was unable to figure the 
mechanism out, especially on which desktop the app ist started. It looks like 
there is a dcop-object which gets an stream(string) of commands and 
parameters - which format does this string have?

It would help me a lot if somebody could post a small code snipplet that uses 
ksmserver's mechanism to start an app on a specific desktop into the 
background (= without stealing focus). 

Thanks very much,


"Internet will never be popular." -- Bill Gates

More information about the kde-core-devel mailing list