Skip to content

Commit

Permalink
Prevent ordinary main windows under dropdown process (#1154)
Browse files Browse the repository at this point in the history
When a new main window is opened in the dropdown mode (menubar → File → New Window), it should have a separate process because the dropdown process is supposed to consist of a single dropdown window. Of course, the work directory and profile must be respected too.

Fixes #1153
  • Loading branch information
tsujan authored Jul 21, 2024
1 parent 78755a2 commit f76c133
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
18 changes: 16 additions & 2 deletions src/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -876,8 +876,22 @@ void MainWindow::newTerminalWindow()
if (ch)
cfg.provideCurrentDirectory(ch->currentTerminal()->impl()->workingDirectory());

MainWindow *w = new MainWindow(cfg, false);
w->show();
if (m_dropMode)
{ // the dropdown process has only one (dropdown) main window
QStringList args;
args << QStringLiteral("-w") << cfg.getWorkingDirectory();
QString profile = Properties::Instance()->profile();
if (!profile.isEmpty())
{
args << QStringLiteral("-p") << profile;
}
QProcess::startDetached(QStringLiteral("qterminal"), args);
}
else
{
MainWindow *w = new MainWindow(cfg, false);
w->show();
}
}

void MainWindow::bookmarksWidget_callCommand(const QString& cmd)
Expand Down
5 changes: 5 additions & 0 deletions src/properties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -416,3 +416,8 @@ QString Properties::configDir() const
return QFileInfo(m_settings->fileName()).absoluteDir().canonicalPath();
}

QString Properties::profile() const
{
return filename;
}

1 change: 1 addition & 0 deletions src/properties.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ class Properties
void loadSettings();
void migrate_settings();
QString configDir() const;
QString profile() const;

static void removeAccelerator(QString& str);

Expand Down

0 comments on commit f76c133

Please sign in to comment.