[PATCH] Set --workdir when executing a service with konsole

David Faure faure at kde.org
Mon Aug 11 15:13:46 BST 2008


On Wednesday 06 August 2008, Alex Merry wrote:
> This stems from bug #162183 (https://bugs.kde.org/show_bug.cgi?id=162183)
> 
> Basically, when a script is executed by KLauncher using a .desktop file that 
> has Terminal=1 set and a working path set, it does a chdir then executes a 
> terminal program.
> 
> This is fine with most terminal programs, but konsole ignores the parent 
> process working directory, and instead goes straight to your home directory.  
> The --workdir option can be used to change this behaviour, as KToolInvocation 
> does.  However, KLauncher uses KRun which has its own logic for constructing a 
> terminal command line.

Right.

> The attached patch fixes this, but I'm not sure whether including another 
> macro (%w for working directory) is kosher.

No, you shouldn't add an undocumented %w option which is not in the desktop
entry standard. Isn't there a way to do this without adding a % option, something like
  terminal += " --workdir " + KShell::escape(service.path());
?

-- 
David Faure, faure at kde.org, sponsored by Trolltech to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).




More information about the kde-core-devel mailing list