From c66ca000629902c37e3fddfd3da73bc5225c0fdb Mon Sep 17 00:00:00 2001 From: bbedward Date: Tue, 22 Sep 2026 22:24:45 -0400 Subject: [PATCH] settings/bar: move name back to its own pill --- quickshell/Common/SettingsTabs.qml | 2 - quickshell/Common/SettingsUiState.qml | 6 --- quickshell/Modules/Settings/BarHubHeader.qml | 42 +++++++++----------- 3 files changed, 19 insertions(+), 31 deletions(-) diff --git a/quickshell/Common/SettingsTabs.qml b/quickshell/Common/SettingsTabs.qml index ccaff7587..a380c5caa 100644 --- a/quickshell/Common/SettingsTabs.qml +++ b/quickshell/Common/SettingsTabs.qml @@ -92,7 +92,6 @@ Singleton { { "id": "dankbar_settings", "hidden": true, - "titleFrom": "selectedBarGeneralTitle", "aliases": ["dank_island", "island"], "text": I18n.tr("General", "adjective, settings page and section title for general options"), "icon": "tune", @@ -102,7 +101,6 @@ Singleton { { "id": "dankbar_appearance", "hidden": true, - "titleFrom": "selectedBarAppearanceTitle", "aliases": ["frame"], "text": I18n.tr("Appearance", "settings page and section title for visual options"), "icon": "palette", diff --git a/quickshell/Common/SettingsUiState.qml b/quickshell/Common/SettingsUiState.qml index 8d328a00a..795243925 100644 --- a/quickshell/Common/SettingsUiState.qml +++ b/quickshell/Common/SettingsUiState.qml @@ -8,12 +8,6 @@ Singleton { id: root property string selectedBarId: "default" - readonly property string selectedBarTitle: { - SettingsData.barConfigs; - return SettingsData.getBarConfig(selectedBarId)?.name || I18n.tr("Bar", "fallback name for an unnamed bar"); - } - readonly property string selectedBarGeneralTitle: selectedBarTitle + " • " + I18n.tr("General", "adjective, settings page and section title for general options") - readonly property string selectedBarAppearanceTitle: selectedBarTitle + " • " + I18n.tr("Appearance", "settings page and section title for visual options") property string selectedWallpaperScreen: "" // Which dock the Dock hub pages are editing. property string dockHubSelection: "" diff --git a/quickshell/Modules/Settings/BarHubHeader.qml b/quickshell/Modules/Settings/BarHubHeader.qml index b04b92588..3ec27c0c2 100644 --- a/quickshell/Modules/Settings/BarHubHeader.qml +++ b/quickshell/Modules/Settings/BarHubHeader.qml @@ -11,7 +11,7 @@ Column { property var parentModal: null property string confirmingRemoveId: "" - property bool renaming: false + property string editingBarId: "" property string renameDraft: "" readonly property bool dotEnabled: SettingsData.dotBarConfig?.enabled ?? false readonly property var barPages: ["dankbar_settings", "dankbar_appearance"].map(id => SettingsTabs.page(id)).filter(page => page) @@ -20,19 +20,14 @@ Column { id: bar onSelectedBarIdChanged: { - root.renaming = false; + root.editingBarId = ""; root.confirmingRemoveId = ""; } } - function startRename() { - renameDraft = bar.selectedBarName; - renaming = true; - } - function finishRename(value) { - renaming = false; - const id = bar.selectedBarId; + const id = editingBarId; + editingBarId = ""; const name = value.trim(); if (!id || !name || SettingsData.barConfigs.some(config => config.id !== id && config.name === name)) return; @@ -149,32 +144,33 @@ Column { settingKey: "barLayout" tags: ["layout", "standard", "frame", "island", "mode", "bar", "name", "rename"] visible: !!bar.selectedBarConfig - headerActions: [ + + SettingsRow { + title: I18n.tr("Name") + subtitle: root.editingBarId ? "" : bar.selectedBarName + DankActionButton { - iconName: root.renaming ? "check" : "edit" - Accessible.name: root.renaming ? I18n.tr("Save") : I18n.tr("Rename") + iconName: root.editingBarId ? "check" : "edit" + Accessible.name: root.editingBarId ? I18n.tr("Save") : I18n.tr("Rename") onClicked: { - if (root.renaming) { + if (root.editingBarId) { root.finishRename(root.renameDraft); return; } - root.startRename(); + root.renameDraft = bar.selectedBarName; + root.editingBarId = bar.selectedBarId; } - }, + } DankActionButton { - visible: root.renaming + visible: root.editingBarId !== "" iconName: "close" Accessible.name: I18n.tr("Cancel") - onClicked: root.renaming = false + onClicked: root.editingBarId = "" } - ] - - SettingsRow { - visible: root.renaming body: Loader { width: parent.width - active: root.renaming + active: root.editingBarId !== "" visible: active sourceComponent: DankTextField { id: renameField @@ -184,7 +180,7 @@ Column { text: root.renameDraft onTextEdited: root.renameDraft = renameField.text onAccepted: root.finishRename(renameField.text) - Keys.onEscapePressed: root.renaming = false + Keys.onEscapePressed: root.editingBarId = "" Component.onCompleted: { renameField.forceActiveFocus(); renameField.selectAll();