Version: (using KDE KDE 3.3.1) Installed from: Gentoo Packages Hello. I think the --workdir konsole option does not work as it should. Yes, it opens the first tab in the right folder, but any newly opened one starts in the directory konsole was run from. The proposed patch (against kdebase-3.3.1) makes these changes: * when --workdir DIR is specified * the first tab is opened at DIR * any subsequent tab is opened in DIR, but only if the session has empty Directory setting * it is saved/restored by session management (* bookmarks work without change) Any comments are welcome. Please consider applying. It should be binary compatible with previous versions. Have a pleasant day.
Created attachment 8612 [details] This patch solved the problem described. Still applies to 3.3.2.
Created attachment 8632 [details] Revised version of the patch. The previous version always set workdir when restoring session. The revised one (against 3.3.2) solves this issue. It is not binary compatible, however. This makes it a candidate for inclusion in KDE-3.4...?
I'm aware of your patch. I'm busy with another konsole patch for the moment. When I get some free time I'll test it. It is possible it will make it in for 3.4
Created attachment 8816 [details] More recent patch With all the changes recently, the old patch didn't apply cleanly. Here is a new version for CVS. I don't use --workdir and I'm not sure if it 'expected' that all newly created sessions should start up at --workdir.
Hmmm. How would you describe the expected effect of the workdir option then? I think setting the directory for the first session *only* does not make much sense. Happy new year :-) Rudo.
CVS commit by hindenburg: Allow --workdir to set the directory in new sessions. Thanks to Rudo Thomas for the patch, which had to be altered slightly. FEATURE: 94864 M +10 -1 konsole.cpp 1.495 M +3 -1 konsole.h 1.193 M +3 -2 main.cpp 1.276 --- kdebase/konsole/konsole/konsole.cpp #1.494:1.495 @@ -188,5 +188,5 @@ static const char * const fonts[] = { Konsole::Konsole(const char* name, int histon, bool menubaron, bool tabbaron, bool frameon, bool scrollbaron, - QCString type, bool b_inRestore, const int wanted_tabbar ) + QCString type, bool b_inRestore, const int wanted_tabbar, const QString &workdir ) :DCOPObject( "konsole" ) ,KMainWindow(0, name) @@ -265,4 +265,5 @@ Konsole::Konsole(const char* name, int h ,sessionNumberMapper(0) ,sl_sessionShortCuts(0) +,s_workDir(workdir) { isRestored = b_inRestore; @@ -1433,4 +1434,7 @@ void Konsole::saveProperties(KConfig* co saveMainWindowSettings(config); } + + if (!s_workDir.isEmpty()) + config->writePathEntry("workdir", s_workDir); } @@ -2672,4 +2676,9 @@ QString Konsole::newSession(KSimpleConfi txt = _title; + // apply workdir only when the session config does not have a directory + if (cwd.isEmpty()) + cwd = s_workDir; + // bookmarks take precedence over workdir + // however, --workdir option has precedence in the very first session if (!_cwd.isEmpty()) cwd = _cwd; --- kdebase/konsole/konsole/konsole.h #1.192:1.193 @@ -69,5 +69,6 @@ public: Konsole(const char * name, int histon, bool menubaron, bool tabbaron, bool frameon, bool scrollbaron, - QCString type = 0, bool b_inRestore = false, const int wanted_tabbar = 0); + QCString type = 0, bool b_inRestore = false, const int wanted_tabbar = 0, + const QString &workdir=QString::null); ~Konsole(); @@ -415,4 +416,5 @@ private: QSignalMapper* sessionNumberMapper; QStringList sl_sessionShortCuts; + QString s_workDir; }; --- kdebase/konsole/konsole/main.cpp #1.275:1.276 @@ -473,6 +473,7 @@ extern "C" int KDE_EXPORT kdemain(int ar sIcon = sessionconfig->readEntry("Icon0","openterm"); sCwd = sessionconfig->readPathEntry("Cwd0"); + workDir = sessionconfig->readPathEntry("workdir"); n_tabbar = QMIN(sessionconfig->readUnsignedNumEntry("tabbar",Konsole::TabBottom),2); - Konsole *m = new Konsole(wname,histon,menubaron,tabbaron,frameon,scrollbaron,0/*type*/,true,n_tabbar); + Konsole *m = new Konsole(wname,histon,menubaron,tabbaron,frameon,scrollbaron,0/*type*/,true,n_tabbar, workDir); m->newSession(sPgm, eargs, sTerm, sIcon, sTitle, sCwd); @@ -542,5 +543,5 @@ extern "C" int KDE_EXPORT kdemain(int ar else { - Konsole* m = new Konsole(wname,histon,menubaron,tabbaron,frameon,scrollbaron,type, false, 0); + Konsole* m = new Konsole(wname,histon,menubaron,tabbaron,frameon,scrollbaron,type, false, 0, workDir); m->newSession((shell ? QFile::decodeName(shell) : QString::null), eargs, term, QString::null, title, workDir); m->enableFullScripting(full_script);