Skip to content

Commit

Permalink
Fixed default terminal of directorymenu plugin (#2122)
Browse files Browse the repository at this point in the history
This patch fixes two issues:

 * The `Open in terminal` menu-item wouldn't work if no default terminal was defined. The patch minimizes the chance by choosing `xterm` in this case.
 * The previous code worked only with QTerminal and Konsole, excluding all terminals that didn't have the `--workdir` option.

Closes #2121
  • Loading branch information
tsujan authored Sep 27, 2024
1 parent 1ba884d commit 1e02acb
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions plugin-directorymenu/directorymenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,8 @@ void DirectoryMenu::openDirectory(const QString& path)

void DirectoryMenu::openInTerminal(const QString& path)
{
// Create list of arguments
QStringList args;
args << QStringLiteral("--workdir") << QDir::toNativeSeparators(path);
// Execute the default terminal program with arguments
QProcess::startDetached(mDefaultTerminal, args);
// Execute the default terminal program in the given working directory
QProcess::startDetached(mDefaultTerminal, QStringList(), QDir::toNativeSeparators(path));
}

void DirectoryMenu::addMenu(QString path)
Expand Down Expand Up @@ -192,5 +189,5 @@ void DirectoryMenu::settingsChanged()
}

// Set default terminal
mDefaultTerminal = settings()->value(QStringLiteral("defaultTerminal"), QString()).toString();
mDefaultTerminal = settings()->value(QStringLiteral("defaultTerminal"), QStringLiteral("xterm")).toString();
}

0 comments on commit 1e02acb

Please sign in to comment.