Skip to content

Commit 2bd0c2c

Browse files
fuddlesworthruvnet
andcommitted
fix(kcm): stop layout card button flicker on hover (#235)
The flicker had two cooperating causes: 1. The ToolButtons toggled `visible:` inside a right-anchored Row, causing leftward geometry reflow that shifted button positions — creating an unstable hover boundary (worse on left-side cards). 2. `ToolTip.visible: hovered` with no delay opened a tooltip popup instantly. On some compositors the popup window momentarily steals pointer focus, flipping `hovered` false for one frame → tooltip hides → `hovered` true → loop. Fix both layers: - Wrap each ToolButton in a fixed-size Item so the Row's width never changes when buttons show/hide (eliminates geometry reflow) - Add ToolTip.delay (standard KDE delay) to break the tooltip feedback loop on affected compositors - Guard ToolTip.visible with && visible for safety Co-Authored-By: claude-flow <ruv@ruv.net>
1 parent c44efb7 commit 2bd0c2c

1 file changed

Lines changed: 33 additions & 20 deletions

File tree

kcm/ui/tabs/LayoutGridDelegate.qml

Lines changed: 33 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -188,33 +188,46 @@ Item {
188188
spacing: 0
189189

190190
// Auto-assign toggle (hidden for autotile — the tiling engine manages those)
191-
ToolButton {
191+
// Wrapped in fixed-size Item so the Row's width never changes when
192+
// the button shows/hides — prevents leftward geometry reflow that
193+
// destabilizes hover on some compositors.
194+
Item {
192195
width: Kirigami.Units.iconSizes.small + Kirigami.Units.smallSpacing
193196
height: width
194-
padding: 0
195-
visible: root.modelData.isAutotile !== true && (root.isHovered || root.modelData.autoAssign === true)
196-
icon.name: root.modelData.autoAssign === true ? "window-duplicate" : "window-new"
197-
icon.width: Kirigami.Units.iconSizes.small
198-
icon.height: Kirigami.Units.iconSizes.small
199-
icon.color: root.modelData.autoAssign === true ? Kirigami.Theme.textColor : Kirigami.Theme.disabledTextColor
200-
onClicked: root.kcm.setLayoutAutoAssign(root.modelData.id, !(root.modelData.autoAssign === true))
201-
ToolTip.visible: hovered
202-
ToolTip.text: root.modelData.autoAssign === true ? i18n("Auto-assign enabled: new windows fill empty zones. Click to disable.") : i18n("Click to auto-assign new windows to empty zones")
197+
198+
ToolButton {
199+
anchors.fill: parent
200+
padding: 0
201+
visible: root.modelData.isAutotile !== true && (root.isHovered || root.modelData.autoAssign === true)
202+
icon.name: root.modelData.autoAssign === true ? "window-duplicate" : "window-new"
203+
icon.width: Kirigami.Units.iconSizes.small
204+
icon.height: Kirigami.Units.iconSizes.small
205+
icon.color: root.modelData.autoAssign === true ? Kirigami.Theme.textColor : Kirigami.Theme.disabledTextColor
206+
onClicked: root.kcm.setLayoutAutoAssign(root.modelData.id, !(root.modelData.autoAssign === true))
207+
ToolTip.text: root.modelData.autoAssign === true ? i18n("Auto-assign enabled: new windows fill empty zones. Click to disable.") : i18n("Click to auto-assign new windows to empty zones")
208+
ToolTip.delay: Kirigami.Units.toolTipDelay
209+
ToolTip.visible: hovered && visible
210+
}
203211
}
204212

205213
// Visibility toggle
206-
ToolButton {
214+
Item {
207215
width: Kirigami.Units.iconSizes.small + Kirigami.Units.smallSpacing
208216
height: width
209-
padding: 0
210-
visible: root.isHovered || root.modelData.hiddenFromSelector === true
211-
icon.name: root.modelData.hiddenFromSelector ? "view-hidden" : "view-visible"
212-
icon.width: Kirigami.Units.iconSizes.small
213-
icon.height: Kirigami.Units.iconSizes.small
214-
icon.color: root.modelData.hiddenFromSelector ? Kirigami.Theme.disabledTextColor : Kirigami.Theme.textColor
215-
onClicked: root.kcm.setLayoutHidden(root.modelData.id, !root.modelData.hiddenFromSelector)
216-
ToolTip.visible: hovered
217-
ToolTip.text: root.modelData.hiddenFromSelector ? i18n("Hidden from zone selector. Click to show.") : i18n("Visible in zone selector. Click to hide.")
217+
218+
ToolButton {
219+
anchors.fill: parent
220+
padding: 0
221+
visible: root.isHovered || root.modelData.hiddenFromSelector === true
222+
icon.name: root.modelData.hiddenFromSelector ? "view-hidden" : "view-visible"
223+
icon.width: Kirigami.Units.iconSizes.small
224+
icon.height: Kirigami.Units.iconSizes.small
225+
icon.color: root.modelData.hiddenFromSelector ? Kirigami.Theme.disabledTextColor : Kirigami.Theme.textColor
226+
onClicked: root.kcm.setLayoutHidden(root.modelData.id, !root.modelData.hiddenFromSelector)
227+
ToolTip.text: root.modelData.hiddenFromSelector ? i18n("Hidden from zone selector. Click to show.") : i18n("Visible in zone selector. Click to hide.")
228+
ToolTip.delay: Kirigami.Units.toolTipDelay
229+
ToolTip.visible: hovered && visible
230+
}
218231
}
219232

220233
}

0 commit comments

Comments
 (0)