Reply to topic

konsole --title and --icon options sometimes don't work

SurlyNerd
Registered Member
Posts
3
Karma
0
Hi folks,

I'm trying to get the konsole to display different --title's and --icon's depending upon user interaction (we set the user's $PATH to something different than the standard so they can try stuff out). I wanted to use the --title to display either the alternative path or a "clear text" name which explains what the path is, if that is available; the --icon is simply a pixmap which shows that something "different" is happening.

My naive first attempt:

Code: Select all
  QString cmd("konsole");

  QStringList args;

  args += "--title";
  args += (name.isEmpty() ? bin : name);
  args += "--icon";
  args += pixfile.fileName();
  args += "-e";
  args += "bash";
  args += "--rcfile";
  args += rcfile.fileName();

//std::cout << __FUNCTION__ << ": launching: " << qPrintable(cmd) << " " << qPrintable(args.join(" ")) << std::endl;

  QProcess::startDetached(cmd, args, "/var/tmp", &m_Pid);


This seemed to work, at first, but then I noticed that subsequently launched konsoles displayed the "default" titles and icons if a konsole was already running. I suspect that this is a dbus issue and that I'm doing this all wrong & would appreciate any help. We are using konsole 2.3.3, KDE 4.3.5 if that makes a difference.

Thanks,

Surly
User avatar bcooksley
Administrator
Posts
18586
Karma
83
OS
Konsole is a single process application - ie. all windows are operated by a single process. In this case, subsequent attempts to start Konsole probably aren't forwarding the --title and --icon arguments to the main Konsole process.

As a workaround to this, try passing the "--nofork" option to Konsole.


System Settings and Device Actions KCM maintainer
Image
SurlyNerd
Registered Member
Posts
3
Karma
0
bcooksley wrote:Konsole is a single process application - ie. all windows are operated by a single process. In this case, subsequent attempts to start Konsole probably aren't forwarding the --title and --icon arguments to the main Konsole process.

As a workaround to this, try passing the "--nofork" option to Konsole.


Thanks for the help, but when I start my program from a konsole session, I get this message:

Code: Select all
<unknown program name>(12635)/: KUniqueApplication: Can't setup D-Bus service. Probably already running.


Is there anyway to defeat the "KUniqueApplication" feature?
User avatar bcooksley
Administrator
Posts
18586
Karma
83
OS
In this case - is your application running already? If it is not, then this indicates a problem.
If it is running, then you need to implement newInstance() in your application to allow for the launching of new windows as needed.
As an interim workaround, launch it with the argument "--nofork" which will bypass unique D-Bus registration.


System Settings and Device Actions KCM maintainer
Image
SurlyNerd
Registered Member
Posts
3
Karma
0
bcooksley wrote:In this case - is your application running already? If it is not, then this indicates a problem.
If it is running, then you need to implement newInstance() in your application to allow for the launching of new windows as needed.
As an interim workaround, launch it with the argument "--nofork" which will bypass unique D-Bus registration.


Many thanks!

 
Reply to topic

Bookmarks



Who is online

Registered users: Alexa [Bot], asevens, Baidu [Spider], Bing [Bot], bjoernbalazs, Exabot [Bot], Google [Bot], GordieGii, Hans, isadora, koriun, lueck, Majestic-12 [Bot], mmistretta, MSNbot Media, nezumi, Yahoo [Bot]