[utilities/konsole] src: Add "Force New Tabs" option

Kurt Hindenburg null at kde.org
Fri Jan 2 15:06:30 GMT 2026


Git commit 2eed4987d9a4b391763a5802008372534477bf49 by Kurt Hindenburg, on behalf of Leonardo Malaman.
Committed on 02/01/2026 at 15:06.
Pushed by hindenburg into branch 'master'.

Add "Force New Tabs" option

Adds a new "Force New Tabs" option in Konsole, which essentially is
like if you passed `--new-tab` for each `konsole` invocation.

This is useful when you don't want to implement workarounds to make
Konsole open in new tabs on every application that you use. To me, this
is useful to override Dolphin's default "Open Terminal Here" behavior.


Here's a thread on KDE Discuss of users trying to make Konsole always
open in a new tab, which essentially boils down to "override the
.desktop file but even then not every app may respect this decision": 
https://discuss.kde.org/t/how-could-i-reroute-every-konsole-opening-intent-to-open-a-tab-instead/7008

There are two caveats with this change however:

* When opening a new tab, the Konsole window is not automatically put
in focus. However I don't know  if this in the scope of this PR because
this is the current Konsole behavior if you use `--new-tab`.
* The new option does require Konsole's "Use the same process for every
window" because, if it is not enabled, it won't work, just like how 
`--new-tab` works. In future, the option should be disabled/grayed out
if the option is not enabled.

GUI:

M  +1    -1    src/Application.cpp
M  +1    -1    src/main.cpp
M  +88   -81   src/settings/GeneralSettings.ui
M  +5    -0    src/settings/konsole.kcfg

https://invent.kde.org/utilities/konsole/-/commit/2eed4987d9a4b391763a5802008372534477bf49

diff --git a/src/Application.cpp b/src/Application.cpp
index 4b0bece664..5697a1ada0 100644
--- a/src/Application.cpp
+++ b/src/Application.cpp
@@ -378,7 +378,7 @@ MainWindow *Application::processWindowArgs(bool &createdNewMainWindow)
 {
     MainWindow *window = nullptr;
 
-    if (m_parser->isSet(QStringLiteral("new-tab"))) {
+    if (Konsole::KonsoleSettings::forceNewTabs() || m_parser->isSet(QStringLiteral("new-tab"))) {
         const QList<QWidget *> list = QApplication::topLevelWidgets();
         for (auto it = list.crbegin(), endIt = list.crend(); it != endIt; ++it) {
             window = qobject_cast<MainWindow *>(*it);
diff --git a/src/main.cpp b/src/main.cpp
index 3832fb9fe9..8727109ee9 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -344,7 +344,7 @@ bool shouldUseNewProcess(int argc, char *argv[])
     }
 
     // the only way to create new tab is to reuse existing Konsole process.
-    if (arguments.contains(QStringLiteral("--new-tab"))) {
+    if (Konsole::KonsoleSettings::forceNewTabs() || arguments.contains(QStringLiteral("--new-tab"))) {
         return false;
     }
 
diff --git a/src/settings/GeneralSettings.ui b/src/settings/GeneralSettings.ui
index 0a6002c92b..15bddf6346 100644
--- a/src/settings/GeneralSettings.ui
+++ b/src/settings/GeneralSettings.ui
@@ -37,23 +37,27 @@
      <property name="spacing">
       <number>6</number>
      </property>
+     <item row="6" column="1">
+      <widget class="QCheckBox" name="kcfg_EnableSecuritySensitiveDBusAPI">
+       <property name="text">
+        <string>Enable the security sensitive parts of the DBus API</string>
+       </property>
+      </widget>
+     </item>
      <item row="12" column="1">
-      <widget class="QCheckBox" name="kcfg_SearchReverseSearch">
+      <widget class="QCheckBox" name="kcfg_SearchHighlightMatches">
        <property name="sizePolicy">
         <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
          <horstretch>0</horstretch>
          <verstretch>0</verstretch>
         </sizepolicy>
        </property>
-       <property name="toolTip">
-        <string>Sets whether search should start from the bottom</string>
-       </property>
        <property name="text">
-        <string>Search backwards</string>
+        <string>Highlight all matches</string>
        </property>
       </widget>
      </item>
-     <item row="15" column="0" alignment="Qt::AlignmentFlag::AlignRight">
+     <item row="16" column="0" alignment="Qt::AlignmentFlag::AlignRight">
       <widget class="QLabel" name="label_3">
        <property name="text">
         <string>Notifications:</string>
@@ -67,34 +71,56 @@
        </property>
       </widget>
      </item>
-     <item row="2" column="1">
-      <widget class="QCheckBox" name="kcfg_AllowMenuAccelerators">
+     <item row="4" column="1">
+      <widget class="QCheckBox" name="kcfg_RemoveWindowTitleBarAndFrame">
+       <property name="text">
+        <string>Remove window titlebar and frame</string>
+       </property>
+      </widget>
+     </item>
+     <item row="0" column="1">
+      <widget class="QCheckBox" name="kcfg_RememberWindowSize">
        <property name="sizePolicy">
         <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
          <horstretch>0</horstretch>
          <verstretch>0</verstretch>
         </sizepolicy>
        </property>
+       <property name="toolTip">
+        <string>If enabled, profile settings will be ignored</string>
+       </property>
        <property name="text">
-        <string>Enable menu accelerators</string>
+        <string>Remember window size</string>
        </property>
       </widget>
      </item>
-     <item row="9" column="0" alignment="Qt::AlignmentFlag::AlignRight">
-      <widget class="QLabel" name="label_2">
+     <item row="14" column="1">
+      <widget class="QCheckBox" name="kcfg_SearchNoWrap">
+       <property name="sizePolicy">
+        <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+         <horstretch>0</horstretch>
+         <verstretch>0</verstretch>
+        </sizepolicy>
+       </property>
+       <property name="toolTip">
+        <string>Sets whether search should stop instead of wrapping</string>
+       </property>
        <property name="text">
-        <string comment="@item:intext Search options">Search:</string>
+        <string>No wrap</string>
        </property>
       </widget>
      </item>
-     <item row="4" column="1">
-      <widget class="QCheckBox" name="kcfg_RemoveWindowTitleBarAndFrame">
+     <item row="0" column="0">
+      <widget class="QLabel" name="label">
        <property name="text">
-        <string>Remove window titlebar and frame</string>
+        <string>Process and window:</string>
+       </property>
+       <property name="alignment">
+        <set>Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter</set>
        </property>
       </widget>
      </item>
-     <item row="15" column="1">
+     <item row="16" column="1">
       <layout class="QHBoxLayout" stretch="0,1">
        <property name="spacing">
         <number>0</number>
@@ -130,34 +156,38 @@
        </item>
       </layout>
      </item>
-     <item row="11" column="1">
-      <widget class="QCheckBox" name="kcfg_SearchHighlightMatches">
-       <property name="sizePolicy">
-        <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
-         <horstretch>0</horstretch>
-         <verstretch>0</verstretch>
-        </sizepolicy>
+     <item row="9" column="1">
+      <spacer>
+       <property name="orientation">
+        <enum>Qt::Orientation::Vertical</enum>
+       </property>
+       <property name="sizeType">
+        <enum>QSizePolicy::Policy::Fixed</enum>
+       </property>
+       <property name="sizeHint" stdset="0">
+        <size>
+         <width>20</width>
+         <height>16</height>
+        </size>
        </property>
+      </spacer>
+     </item>
+     <item row="8" column="1">
+      <widget class="QCheckBox" name="kcfg_ForceNewTabs">
        <property name="text">
-        <string>Highlight all matches</string>
+        <string>Force new tabs</string>
        </property>
       </widget>
      </item>
-     <item row="3" column="1">
-      <widget class="QCheckBox" name="kcfg_ShowWindowTitleOnTitleBar">
-       <property name="sizePolicy">
-        <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
-         <horstretch>0</horstretch>
-         <verstretch>0</verstretch>
-        </sizepolicy>
-       </property>
+     <item row="10" column="0" alignment="Qt::AlignmentFlag::AlignRight">
+      <widget class="QLabel" name="label_2">
        <property name="text">
-        <string>Show window title on the titlebar</string>
+        <string comment="@item:intext Search options">Search:</string>
        </property>
       </widget>
      </item>
      <item row="13" column="1">
-      <widget class="QCheckBox" name="kcfg_SearchNoWrap">
+      <widget class="QCheckBox" name="kcfg_SearchReverseSearch">
        <property name="sizePolicy">
         <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
          <horstretch>0</horstretch>
@@ -165,36 +195,10 @@
         </sizepolicy>
        </property>
        <property name="toolTip">
-        <string>Sets whether search should stop instead of wrapping</string>
-       </property>
-       <property name="text">
-        <string>No wrap</string>
-       </property>
-      </widget>
-     </item>
-     <item row="14" column="1">
-      <spacer>
-       <property name="orientation">
-        <enum>Qt::Orientation::Vertical</enum>
-       </property>
-       <property name="sizeType">
-        <enum>QSizePolicy::Policy::Fixed</enum>
-       </property>
-       <property name="sizeHint" stdset="0">
-        <size>
-         <width>20</width>
-         <height>16</height>
-        </size>
+        <string>Sets whether search should start from the bottom</string>
        </property>
-      </spacer>
-     </item>
-     <item row="0" column="0">
-      <widget class="QLabel" name="label">
        <property name="text">
-        <string>Process and window:</string>
-       </property>
-       <property name="alignment">
-        <set>Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter</set>
+        <string>Search backwards</string>
        </property>
       </widget>
      </item>
@@ -214,8 +218,8 @@
        </property>
       </widget>
      </item>
-     <item row="0" column="1">
-      <widget class="QCheckBox" name="kcfg_RememberWindowSize">
+     <item row="10" column="1">
+      <widget class="QCheckBox" name="kcfg_SearchCaseSensitive">
        <property name="sizePolicy">
         <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
          <horstretch>0</horstretch>
@@ -223,21 +227,14 @@
         </sizepolicy>
        </property>
        <property name="toolTip">
-        <string>If enabled, profile settings will be ignored</string>
-       </property>
-       <property name="text">
-        <string>Remember window size</string>
+        <string>Sets whether the search is case sensitive</string>
        </property>
-      </widget>
-     </item>
-     <item row="6" column="1">
-      <widget class="QCheckBox" name="kcfg_EnableSecuritySensitiveDBusAPI">
        <property name="text">
-        <string>Enable the security sensitive parts of the DBus API</string>
+        <string>Case sensitive</string>
        </property>
       </widget>
      </item>
-     <item row="8" column="1">
+     <item row="15" column="1">
       <spacer>
        <property name="orientation">
         <enum>Qt::Orientation::Vertical</enum>
@@ -253,23 +250,20 @@
        </property>
       </spacer>
      </item>
-     <item row="9" column="1">
-      <widget class="QCheckBox" name="kcfg_SearchCaseSensitive">
+     <item row="3" column="1">
+      <widget class="QCheckBox" name="kcfg_ShowWindowTitleOnTitleBar">
        <property name="sizePolicy">
         <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
          <horstretch>0</horstretch>
          <verstretch>0</verstretch>
         </sizepolicy>
        </property>
-       <property name="toolTip">
-        <string>Sets whether the search is case sensitive</string>
-       </property>
        <property name="text">
-        <string>Case sensitive</string>
+        <string>Show window title on the titlebar</string>
        </property>
       </widget>
      </item>
-     <item row="10" column="1">
+     <item row="11" column="1">
       <widget class="QCheckBox" name="kcfg_SearchRegExpression">
        <property name="sizePolicy">
         <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
@@ -282,6 +276,19 @@
        </property>
       </widget>
      </item>
+     <item row="2" column="1">
+      <widget class="QCheckBox" name="kcfg_AllowMenuAccelerators">
+       <property name="sizePolicy">
+        <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+         <horstretch>0</horstretch>
+         <verstretch>0</verstretch>
+        </sizepolicy>
+       </property>
+       <property name="text">
+        <string>Enable menu accelerators</string>
+       </property>
+      </widget>
+     </item>
      <item row="7" column="1">
       <widget class="QCheckBox" name="kcfg_ListenForZModemTerminalCodes">
        <property name="text">
diff --git a/src/settings/konsole.kcfg b/src/settings/konsole.kcfg
index 7fdd0bb81f..3ffcd7906b 100644
--- a/src/settings/konsole.kcfg
+++ b/src/settings/konsole.kcfg
@@ -33,6 +33,11 @@
       <tooltip>When launching Konsole re-use existing process if possible</tooltip>
       <default>false</default>
     </entry>
+    <entry name="ForceNewTabs" type="Bool">
+      <label>Force new tabs</label>
+      <tooltip>When launching Konsole create a new tab instead of creating new windows if possible</tooltip>
+      <default>false</default>
+    </entry>
     <entry name="EnableSecuritySensitiveDBusAPI" type="Bool">
       <label>Enable the security sensitive parts of the DBus API</label>
       <tooltip>DBus API like runCommand will be enabled</tooltip>


More information about the kde-doc-english mailing list