diff options
| author | Felix Ernst <[email protected]> | 2026-06-16 22:08:24 +0200 |
|---|---|---|
| committer | Felix Ernst <[email protected]> | 2026-06-16 22:08:24 +0200 |
| commit | 12b4a8a91e0b9b8dd00816b5fb84e8e09000afcd (patch) | |
| tree | ce2d2a94849f33dacbbb0fe484387b107aab59b0 /src/settings | |
| parent | 64d3f0756f096bb3632248b1535cb58767b2d1b0 (diff) | |
Add "Focus Other View" action
Replace the setting "Switch between views with Tab key" with a
dedicated "Focus Other View" action (which can be bound to the Tab key
if the user wants to).
The "Focus Other View" action moves the keyboard focus to the inactive
split view. When there is no other view, split view is triggered
instead. The action is located in `Menubar>View`.
### Motivation
The Tab key is essential for keyboard navigation within an application.
The old "Switch between views with Tab key" setting forces users to
give up on the intended purpose of the Tab key, which means many
keyboard-bound users currently do not have a way to switch between
views when using the "Split" feature. The dedicated "Focus Other View"
action gives users more control, and they can change the keyboard
shortcut as they are used to.
Diffstat (limited to 'src/settings')
5 files changed, 35 insertions, 16 deletions
diff --git a/src/settings/dolphin_generalsettings.kcfg b/src/settings/dolphin_generalsettings.kcfg index 48fecb2d0..b29526d64 100644 --- a/src/settings/dolphin_generalsettings.kcfg +++ b/src/settings/dolphin_generalsettings.kcfg @@ -115,10 +115,6 @@ <label>Show a bar for easy pasting after a cut or copy was done using the selection mode bottom bar.</label> <default>true</default> </entry> - <entry name="UseTabForSwitchingSplitView" type="Bool"> - <label>Use tab for switching between right and left view</label> - <default>false</default> - </entry> <entry name="CloseSplitViewChoice" type="Enum"> <choices> <choice name="ActiveView" /> diff --git a/src/settings/dolphin_tab_key_shortcut_for_focus_other_view.py b/src/settings/dolphin_tab_key_shortcut_for_focus_other_view.py new file mode 100644 index 000000000..4a18ad094 --- /dev/null +++ b/src/settings/dolphin_tab_key_shortcut_for_focus_other_view.py @@ -0,0 +1,27 @@ +#SPDX-FileCopyrightText: 2026 Felix Ernst <[email protected]> +#SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL + +import os +import sys +from pathlib import Path +import xml.etree.ElementTree as ET + +use_tab_setting_detected = False + +XDG_CONFIG_HOME = Path(os.getenv("XDG_CONFIG_HOME") or (Path.home() / ".config")) +custom_settings_file = XDG_CONFIG_HOME / "dolphinrc" +print(custom_settings_file) +if custom_settings_file.exists(): + with open(custom_settings_file, "r+") as f: + lines = [line for line in f if line.find("UseTabForSwitchingSplitView=true") >= 0] + if len(lines) > 0: + use_tab_setting_detected = True + +XDG_DATA_HOME = Path(os.getenv("XDG_DATA_HOME") or (Path.home() / ".local/share")) +custom_ui_file = XDG_DATA_HOME / "kxmlgui5/dolphin/dolphinui.rc" +if use_tab_setting_detected and custom_ui_file.exists(): + tree = ET.parse(custom_ui_file) + root = tree.getroot() + for actionProperties in root.iter("ActionProperties"): + ET.SubElement(actionProperties, "Action", {"name":"focus_inactive_split_view", "shortcut":"Ctrl+F3; Tab"}) + tree.write(custom_ui_file, encoding="utf-8") diff --git a/src/settings/dolphin_tab_key_shortcut_for_focus_other_view.upd b/src/settings/dolphin_tab_key_shortcut_for_focus_other_view.upd new file mode 100644 index 000000000..579eb233a --- /dev/null +++ b/src/settings/dolphin_tab_key_shortcut_for_focus_other_view.upd @@ -0,0 +1,8 @@ +#SPDX-FileCopyrightText: 2026 Felix Ernst <[email protected]> +#SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL + +#Configuration update for Dolphin +Version=6 + +Id=tab_key_shortcut_for_focus_other_view +Script=dolphin_tab_key_shortcut_for_focus_other_view.py,python3 diff --git a/src/settings/interface/folderstabssettingspage.cpp b/src/settings/interface/folderstabssettingspage.cpp index 10303258c..fa1b1b80f 100644 --- a/src/settings/interface/folderstabssettingspage.cpp +++ b/src/settings/interface/folderstabssettingspage.cpp @@ -44,7 +44,6 @@ FoldersTabsSettingsPage::FoldersTabsSettingsPage(QWidget *parent) , m_filterBar(nullptr) , m_showFullPathInTitlebar(nullptr) , m_openExternallyCalledFolderInNewTab(nullptr) - , m_useTabForSplitViewSwitch(nullptr) , m_closeSplitComboBox(nullptr) { QFormLayout *topLayout = new QFormLayout(this); @@ -160,10 +159,6 @@ FoldersTabsSettingsPage::FoldersTabsSettingsPage(QWidget *parent) closeSplitViewHLayout->addWidget(m_closeSplitComboBox); topLayout->addRow(i18nc("@title:group", "Split view: "), closeSplitViewWidget); - // 'Switch between panes of split views with tab key' - m_useTabForSplitViewSwitch = new QCheckBox(i18nc("option:check split view panes", "Switch between views with Tab key")); - topLayout->addRow(QString(), m_useTabForSplitViewSwitch); - // 'Begin in split view mode' m_splitView = new QCheckBox(i18nc("@option:check Startup Settings", "Open new windows in split view mode")); topLayout->addRow(QString(), m_splitView); @@ -182,8 +177,6 @@ FoldersTabsSettingsPage::FoldersTabsSettingsPage(QWidget *parent) connect(m_openExternallyCalledFolderInNewTab, &QCheckBox::toggled, this, &FoldersTabsSettingsPage::slotSettingsChanged); connect(m_showFullPathInTitlebar, &QCheckBox::toggled, this, &FoldersTabsSettingsPage::slotSettingsChanged); - connect(m_useTabForSplitViewSwitch, &QCheckBox::toggled, this, &FoldersTabsSettingsPage::changed); - connect(m_closeSplitComboBox, qOverload<int>(&QComboBox::currentIndexChanged), this, &FoldersTabsSettingsPage::changed); connect(m_alwaysShowTabBar, &QCheckBox::toggled, this, &FoldersTabsSettingsPage::changed); @@ -203,8 +196,6 @@ void FoldersTabsSettingsPage::applySettings() { GeneralSettings *settings = GeneralSettings::self(); - settings->setUseTabForSwitchingSplitView(m_useTabForSplitViewSwitch->isChecked()); - settings->setCloseSplitViewChoice(m_closeSplitComboBox->currentIndex()); const QUrl url(QUrl::fromUserInput(m_homeUrl->text(), QString(), QUrl::AssumeLocalFile)); @@ -322,8 +313,6 @@ void FoldersTabsSettingsPage::loadSettings() m_showFullPathInTitlebar->setChecked(GeneralSettings::showFullPathInTitlebar()); m_openExternallyCalledFolderInNewTab->setChecked(GeneralSettings::openExternallyCalledFolderInNewTab()); - m_useTabForSplitViewSwitch->setChecked(GeneralSettings::useTabForSwitchingSplitView()); - m_closeSplitComboBox->setCurrentIndex(GeneralSettings::closeSplitViewChoice()); m_alwaysShowTabBar->setChecked(GeneralSettings::alwaysShowTabBar()); diff --git a/src/settings/interface/folderstabssettingspage.h b/src/settings/interface/folderstabssettingspage.h index 690407b39..cf926e557 100644 --- a/src/settings/interface/folderstabssettingspage.h +++ b/src/settings/interface/folderstabssettingspage.h @@ -70,7 +70,6 @@ private: QCheckBox *m_filterBar; QCheckBox *m_showFullPathInTitlebar; QCheckBox *m_openExternallyCalledFolderInNewTab; - QCheckBox *m_useTabForSplitViewSwitch; QComboBox *m_closeSplitComboBox; }; |
