Terminal: use shell name as terminal tab name

This way cmd, bash, powershell are more descriptive than "Terminal"

Change-Id: I19310f423cd4188ecc48580a30ed414833a15aee
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
This commit is contained in:
Cristian Adam
2023-03-02 16:59:03 +01:00
parent 0a0827da41
commit d387802a3e
4 changed files with 40 additions and 3 deletions

View File

@@ -162,6 +162,10 @@ void TerminalWidget::setupPty()
});
connect(m_process.get(), &QtcProcess::started, this, [this] {
m_shellName = m_process->commandLine().executable().fileName();
if (HostOsInfo::isWindowsHost() && m_shellName.endsWith(QTC_WIN_EXE_SUFFIX))
m_shellName.chop(QStringLiteral(QTC_WIN_EXE_SUFFIX).size());
applySizeChange();
emit started(m_process->processId());
});
@@ -463,6 +467,11 @@ void TerminalWidget::setSelection(const std::optional<Selection> &selection)
m_selection = selection;
}
QString TerminalWidget::shellName() const
{
return m_shellName;
}
const VTermScreenCell *TerminalWidget::fetchCell(int x, int y) const
{
QTC_ASSERT(y >= 0, return nullptr);