From f1ea842bca1ff74172fa78200dcaa717f89a1140 Mon Sep 17 00:00:00 2001 From: bbedward Date: Sat, 10 Oct 2026 18:14:12 -0400 Subject: [PATCH] cc: don't shift edit button slot, bump qml-common --- dank-qml-common | 2 +- flake.lock | 6 +++--- .../ControlCenter/Components/CcFooter.qml | 21 ++++++------------- .../ControlCenter/Components/CcTileLoader.qml | 3 ++- .../ControlCenter/Components/CcTileSlot.qml | 6 ++++++ .../ControlCenter/ControlCenterContent.qml | 2 +- .../ControlCenter/Widgets/ActionTile.qml | 4 +++- quickshell/Widgets/DEditableGridSlot.qml | 5 ++++- 8 files changed, 26 insertions(+), 23 deletions(-) diff --git a/dank-qml-common b/dank-qml-common index 9314fc4df..50ca5ccb4 160000 --- a/dank-qml-common +++ b/dank-qml-common @@ -1 +1 @@ -Subproject commit 9314fc4df5a90c95bddcda83d696a1fd8c895aea +Subproject commit 50ca5ccb4913098b0b67807d9ff7f642e79067b0 diff --git a/flake.lock b/flake.lock index b002101fe..e693f44bc 100644 --- a/flake.lock +++ b/flake.lock @@ -3,11 +3,11 @@ "dank-qml-common": { "flake": false, "locked": { - "lastModified": 1791581769, - "narHash": "sha256-Q87fFPp2fysHdMrk2/sQ7+c+Sc2RZAQGKnAZWEEFOHQ=", + "lastModified": 1791670308, + "narHash": "sha256-vcAOSK+6buTddG8sJi8JOnaFfxSztmL8nOzsnUTzGd0=", "owner": "AvengeMedia", "repo": "dank-qml-common", - "rev": "9314fc4df5a90c95bddcda83d696a1fd8c895aea", + "rev": "50ca5ccb4913098b0b67807d9ff7f642e79067b0", "type": "github" }, "original": { diff --git a/quickshell/Modules/ControlCenter/Components/CcFooter.qml b/quickshell/Modules/ControlCenter/Components/CcFooter.qml index 80865401b..5e4e6bdf0 100644 --- a/quickshell/Modules/ControlCenter/Components/CcFooter.qml +++ b/quickshell/Modules/ControlCenter/Components/CcFooter.qml @@ -53,7 +53,9 @@ Item { // Grid columns, so footer widths line up with the tiles above. readonly property real spacing: CcMetrics.gridGap readonly property real pitch: grid.cellWidth - readonly property real editActionsWidth: Theme.iconButtonSize * 3 + spacing * 2 + readonly property real editActionsWidth: Theme.iconButtonSize * 2 + spacing + // The pencil turns into the check, so the row shrinks away from it and the same spot leaves edit mode. + readonly property bool editAtEnd: items.some(item => item.widget.id === WidgetUtils.EDIT_ID && WidgetUtils.footerEnds(item.widget)) // The row owns its full width in both modes, so capacity never changes under the user's feet; edit mode // shows the whole row scaled into the room beside the edit buttons, so every width stays reachable. readonly property real trackWidth: width @@ -233,7 +235,7 @@ Item { transform: Scale { id: trackScale - origin.x: I18n.isRtl ? track.width - track.overhang : track.overhang + origin.x: I18n.isRtl !== root.editAtEnd ? track.width - track.overhang : track.overhang origin.y: track.height / 2 xScale: root.trackScale yScale: root.trackScale @@ -433,7 +435,8 @@ Item { Item { id: editActions - anchors.right: parent.right + anchors.left: root.editAtEnd ? parent.left : undefined + anchors.right: root.editAtEnd ? undefined : parent.right anchors.verticalCenter: parent.verticalCenter width: root.editActionsWidth height: CcMetrics.footerHeight @@ -498,18 +501,6 @@ Item { color: root.overTrash ? Theme.onErrorContainer : CcMetrics.tileInactiveContent } } - - DActionButton { - anchors.right: parent.right - anchors.verticalCenter: parent.verticalCenter - buttonSize: Theme.iconButtonSize - iconName: "check" - iconSize: CcMetrics.iconBoxIconSize - iconColor: Theme.onPrimary - backgroundColor: Theme.primary - tooltipText: I18n.tr("Save") - onClicked: root.finishRequested() - } } CcMenu { diff --git a/quickshell/Modules/ControlCenter/Components/CcTileLoader.qml b/quickshell/Modules/ControlCenter/Components/CcTileLoader.qml index 78bfa2705..b102780da 100644 --- a/quickshell/Modules/ControlCenter/Components/CcTileLoader.qml +++ b/quickshell/Modules/ControlCenter/Components/CcTileLoader.qml @@ -1,4 +1,5 @@ import QtQuick +import "../utils/widgets.js" as WidgetUtils Loader { id: root @@ -46,7 +47,7 @@ Loader { Binding { target: root.item property: "interactive" - value: !root.grid.editMode + value: !root.grid.editMode || root.widgetData.id === WidgetUtils.EDIT_ID when: root.item !== null } diff --git a/quickshell/Modules/ControlCenter/Components/CcTileSlot.qml b/quickshell/Modules/ControlCenter/Components/CcTileSlot.qml index 45f04a2d5..27c562c44 100644 --- a/quickshell/Modules/ControlCenter/Components/CcTileSlot.qml +++ b/quickshell/Modules/ControlCenter/Components/CcTileSlot.qml @@ -20,6 +20,7 @@ DEditableGridSlot { readonly property real smallSpanLimit: (1 + CcMetrics.smallRowFraction) / 2 passthrough: tileItem?.passthrough ?? null + restCursor: widgetData.id === WidgetUtils.EDIT_ID ? Qt.PointingHandCursor : Qt.OpenHandCursor raised: dragging || resizing || (tileItem?.memberDragging ?? false) function reanchor(small) { @@ -31,6 +32,11 @@ DEditableGridSlot { return (requested + bias + CcMetrics.gridGap) / grid.cellWidth; } + onClicked: { + if (widgetData.id === WidgetUtils.EDIT_ID) + root.grid.editRequested(); + } + onPressAndHold: { if (!editChrome.hasOptions) return; diff --git a/quickshell/Modules/ControlCenter/ControlCenterContent.qml b/quickshell/Modules/ControlCenter/ControlCenterContent.qml index 253107231..2ad65cbf0 100644 --- a/quickshell/Modules/ControlCenter/ControlCenterContent.qml +++ b/quickshell/Modules/ControlCenter/ControlCenterContent.qml @@ -464,7 +464,7 @@ FocusScope { onColorPickerRequested: root.host.openColorPicker() onCloseRequested: root.host.close() onSettingsRequested: root.host.openSettings() - onEditRequested: root.host.editMode = true + onEditRequested: root.host.editMode = !root.host.editMode onAccountsRequested: root.host.openAccounts() onLockRequested: { root.host.close(); diff --git a/quickshell/Modules/ControlCenter/Widgets/ActionTile.qml b/quickshell/Modules/ControlCenter/Widgets/ActionTile.qml index c4eca7e3f..777459693 100644 --- a/quickshell/Modules/ControlCenter/Widgets/ActionTile.qml +++ b/quickshell/Modules/ControlCenter/Widgets/ActionTile.qml @@ -6,9 +6,11 @@ CcTile { id: root readonly property string action: widgetData?.id ?? "" + readonly property bool finishing: action === "edit" && (host?.editMode ?? false) toggle: false - iconName: widgetDef?.icon ?? "" + active: finishing + iconName: finishing ? "check" : widgetDef?.icon ?? "" title: widgetDef?.text ?? "" restIconColor: action === "power" ? Theme.error : CcMetrics.tileInactiveIcon diff --git a/quickshell/Widgets/DEditableGridSlot.qml b/quickshell/Widgets/DEditableGridSlot.qml index 57bf22427..d9cd47a94 100644 --- a/quickshell/Widgets/DEditableGridSlot.qml +++ b/quickshell/Widgets/DEditableGridSlot.qml @@ -14,11 +14,13 @@ Item { property var resizeOrigin: null property var dragOrigin: null property Item passthrough: null + property int restCursor: Qt.OpenHandCursor property bool raised: dragging || resizing readonly property bool interactionEnabled: resizeOrigin !== null || dragOrigin !== null || !grid.interacting signal resizeRequested(real requestedWidth, real requestedHeight) signal pressAndHold + signal clicked function moveDrag(scenePosition) { if (!dragOrigin || !dragging) @@ -160,9 +162,10 @@ Item { enabled: visible && (root.dragOrigin !== null || !root.grid.interacting) hoverEnabled: enabled acceptedButtons: Qt.LeftButton - cursorShape: root.dragging ? Qt.ClosedHandCursor : Qt.OpenHandCursor + cursorShape: root.dragging ? Qt.ClosedHandCursor : root.restCursor containmentMask: root.passthrough ? passthroughMask : null onPressAndHold: root.pressAndHold() + onClicked: root.clicked() onWheel: wheel => wheel.accepted = true }