diff options
| author | xi ota <[email protected]> | 2026-01-17 19:23:16 +0000 |
|---|---|---|
| committer | Méven Car <[email protected]> | 2026-01-17 19:23:16 +0000 |
| commit | a31695655194c57c608f938c94684fe8db93696b (patch) | |
| tree | 4246a43e493661bab21e2a176fc36cf5d7c3a8ec /src | |
| parent | 137097be34a041d457624939e4d9eea25ed58f14 (diff) | |
Add options to always show tab bar and hide close buttons
This MR adds options to keep tab bar always visible and to remove the close button from tabs.
MR !269 cannot be reopened because the branch it is based on is no longer accessible. Per @meven direction, I am opening this new MR.
Note: Defaults to current defaults.
{width=734 height=597}
{width=762 height=580}
Criticisms of previous MR:
* Options should take effect immediately when users apply new settings, rather than requiring restart.
* Done.
* Concern about potential maintenance burden.
* I've been maintaining some version of this patch for ~4-5 years, available via [aur/dolphin-tabopts](https://aur.archlinux.org/packages/dolphin-tabopts) and Chaotic AUR. During that time, only two major rebases were needed. First was what appeared to be automated linting and reformatting. Second was when the preferences system was reorganized.
Had the patch been integrated in the code base prior to those refactors, the first would have required zero maintainer intervention (assuming automated reformatting). The second would have required minimal effort beyond what was needed for the refactor itself.
Every defect I've noticed during that time were also present in the unpatched package.
* There is no demand or desire for this feature.
* Equivalent settings are available in various apps across operating systems and desktop environments, including several KDE apps, such as akregator, kate, konsole (confirmed in 25.12.1).
* The first merge request in this repo !1 was to implement always showing the tab bar.
* Some users have found, created an account, and commented at the previous MR to ask that it be reconsidered.
* Arch opt-in pkgstats shows non-zero count for aur/dolphin-tabopts since early 2023. Max 15 in early 2025. Current 5.
* Chaotic AUR download metrics is 41 (rolling 30-day count).
* Unproductive "discussion" not worth further comment.
Diffstat (limited to 'src')
| -rw-r--r-- | src/dolphinmainwindow.cpp | 7 | ||||
| -rw-r--r-- | src/dolphinmainwindow.h | 3 | ||||
| -rw-r--r-- | src/dolphintabwidget.cpp | 3 | ||||
| -rw-r--r-- | src/settings/dolphin_generalsettings.kcfg | 11 | ||||
| -rw-r--r-- | src/settings/interface/folderstabssettingspage.cpp | 16 | ||||
| -rw-r--r-- | src/settings/interface/folderstabssettingspage.h | 3 |
6 files changed, 42 insertions, 1 deletions
diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp index 018a6c95a..4d3fedbce 100644 --- a/src/dolphinmainwindow.cpp +++ b/src/dolphinmainwindow.cpp @@ -263,6 +263,7 @@ DolphinMainWindow::DolphinMainWindow() setupFileItemActions(); }); connect(GeneralSettings::self(), &GeneralSettings::splitViewChanged, this, &DolphinMainWindow::slotSplitViewChanged); + connect(GeneralSettings::self(), &GeneralSettings::tabBarChanged, this, &DolphinMainWindow::slotTabBarChanged); } DolphinMainWindow::~DolphinMainWindow() @@ -528,6 +529,12 @@ void DolphinMainWindow::slotSplitViewChanged() updateSplitActions(); } +void DolphinMainWindow::slotTabBarChanged() +{ + m_tabWidget->setTabBarAutoHide(!GeneralSettings::alwaysShowTabBar()); + m_tabWidget->tabBar()->setTabsClosable(GeneralSettings::showCloseButtonOnTabs()); +} + void DolphinMainWindow::openInNewTab() { const KFileItemList &list = m_activeViewContainer->view()->selectedItems(); diff --git a/src/dolphinmainwindow.h b/src/dolphinmainwindow.h index a05fa1227..9c21e291b 100644 --- a/src/dolphinmainwindow.h +++ b/src/dolphinmainwindow.h @@ -228,6 +228,9 @@ public Q_SLOTS: /** @see GeneralSettings::splitViewChanged() */ void slotSplitViewChanged(); + /** @see GeneralSettings::tabBarChanged() */ + void slotTabBarChanged(); + Q_SIGNALS: /** * Is sent if the selection of the currently active view has diff --git a/src/dolphintabwidget.cpp b/src/dolphintabwidget.cpp index 044586eb9..bbf80e4bf 100644 --- a/src/dolphintabwidget.cpp +++ b/src/dolphintabwidget.cpp @@ -44,7 +44,8 @@ DolphinTabWidget::DolphinTabWidget(DolphinNavigatorsWidgetAction *navigatorsWidg setDocumentMode(true); setElideMode(Qt::ElideRight); setUsesScrollButtons(true); - setTabBarAutoHide(true); + setTabBarAutoHide(!GeneralSettings::alwaysShowTabBar()); + tabBar->setTabsClosable(GeneralSettings::showCloseButtonOnTabs()); auto stackWidget{findChild<QStackedWidget *>()}; // i18n: This accessible name will be announced any time the user moves keyboard focus e.g. from the toolbar or the places panel towards the main working diff --git a/src/settings/dolphin_generalsettings.kcfg b/src/settings/dolphin_generalsettings.kcfg index 01ce316f4..d515a573d 100644 --- a/src/settings/dolphin_generalsettings.kcfg +++ b/src/settings/dolphin_generalsettings.kcfg @@ -8,6 +8,7 @@ <include>QUrl</include> <include>KCompletion</include> <kcfgfile name="dolphinrc"/> + <signal name="tabBarChanged" /> <signal name="sortingChoiceChanged" /> <signal name="splitViewChanged" /> <signal name="showStatusBarChanged"> @@ -41,6 +42,16 @@ <label>Should an externally called folder open in a new tab in an existing Dolphin instance</label> <default>false</default> </entry> + <entry name="AlwaysShowTabBar" type="Bool"> + <label>Should the tab bar always be shown, even when there is only one tab</label> + <default>false</default> + <emit signal="tabBarChanged" /> + </entry> + <entry name="ShowCloseButtonOnTabs" type="Bool"> + <label>Should tabs have close buttons</label> + <default>true</default> + <emit signal="tabBarChanged" /> + </entry> <entry name="Version" type="Int"> <label>Internal config version of Dolphin, mainly Used to determine whether an updated version of Dolphin is running, so as to migrate config entries that were removed/renamed ...etc</label> <default>0</default> diff --git a/src/settings/interface/folderstabssettingspage.cpp b/src/settings/interface/folderstabssettingspage.cpp index 1dbed5a69..7fa34cd6e 100644 --- a/src/settings/interface/folderstabssettingspage.cpp +++ b/src/settings/interface/folderstabssettingspage.cpp @@ -36,6 +36,8 @@ FoldersTabsSettingsPage::FoldersTabsSettingsPage(QWidget *parent) , m_homeUrlRadioButton(nullptr) , m_homeUrl(nullptr) , m_rememberOpenedTabsRadioButton(nullptr) + , m_alwaysShowTabBar(nullptr) + , m_showCloseButtonOnTabs(nullptr) , m_openNewTabAfterLastTab(nullptr) , m_openNewTabAfterCurrentTab(nullptr) , m_splitView(nullptr) @@ -117,6 +119,11 @@ FoldersTabsSettingsPage::FoldersTabsSettingsPage(QWidget *parent) topLayout->addItem(new QSpacerItem(0, Dolphin::VERTICAL_SPACER_HEIGHT, QSizePolicy::Fixed, QSizePolicy::Fixed)); // Tabs properties + m_alwaysShowTabBar = new QCheckBox(i18nc("@option:check", "Always show tab bar")); + topLayout->addRow(i18nc("@label:checkbox", "Tab bar:"), m_alwaysShowTabBar); + m_showCloseButtonOnTabs = new QCheckBox(i18nc("@option:check", "Show close button on tabs")); + topLayout->addRow(QString(), m_showCloseButtonOnTabs); + m_openNewTabAfterCurrentTab = new QRadioButton(i18nc("option:radio", "After current tab")); m_openNewTabAfterLastTab = new QRadioButton(i18nc("option:radio", "At end of tab bar")); QButtonGroup *tabsBehaviorGroup = new QButtonGroup(this); @@ -165,6 +172,9 @@ FoldersTabsSettingsPage::FoldersTabsSettingsPage(QWidget *parent) connect(m_closeSplitComboBox, qOverload<int>(&QComboBox::currentIndexChanged), this, &FoldersTabsSettingsPage::changed); + connect(m_alwaysShowTabBar, &QCheckBox::toggled, this, &FoldersTabsSettingsPage::changed); + connect(m_showCloseButtonOnTabs, &QCheckBox::toggled, this, &FoldersTabsSettingsPage::changed); + connect(m_openNewTabAfterCurrentTab, &QRadioButton::toggled, this, &FoldersTabsSettingsPage::changed); connect(m_openNewTabAfterLastTab, &QRadioButton::toggled, this, &FoldersTabsSettingsPage::changed); } @@ -209,6 +219,9 @@ void FoldersTabsSettingsPage::applySettings() settings->setOpenExternallyCalledFolderInNewTab(m_openExternallyCalledFolderInNewTab->isChecked()); settings->setShowFullPathInTitlebar(m_showFullPathInTitlebar->isChecked()); + settings->setAlwaysShowTabBar(m_alwaysShowTabBar->isChecked()); + settings->setShowCloseButtonOnTabs(m_showCloseButtonOnTabs->isChecked()); + settings->setOpenNewTabAfterLastTab(m_openNewTabAfterLastTab->isChecked()); settings->save(); @@ -289,6 +302,9 @@ void FoldersTabsSettingsPage::loadSettings() m_closeSplitComboBox->setCurrentIndex(GeneralSettings::closeSplitViewChoice()); + m_alwaysShowTabBar->setChecked(GeneralSettings::alwaysShowTabBar()); + m_showCloseButtonOnTabs->setChecked(GeneralSettings::showCloseButtonOnTabs()); + m_openNewTabAfterLastTab->setChecked(GeneralSettings::openNewTabAfterLastTab()); m_openNewTabAfterCurrentTab->setChecked(!m_openNewTabAfterLastTab->isChecked()); } diff --git a/src/settings/interface/folderstabssettingspage.h b/src/settings/interface/folderstabssettingspage.h index ae104cc7e..894d69898 100644 --- a/src/settings/interface/folderstabssettingspage.h +++ b/src/settings/interface/folderstabssettingspage.h @@ -56,6 +56,9 @@ private: QLineEdit *m_homeUrl; QRadioButton *m_rememberOpenedTabsRadioButton; + QCheckBox* m_alwaysShowTabBar; + QCheckBox* m_showCloseButtonOnTabs; + QRadioButton *m_openNewTabAfterLastTab; QRadioButton *m_openNewTabAfterCurrentTab; |
