Dock loses focus randomly
Compositor
- [ ] niri
- [x] Hyprland
- [ ] Other (specify)
Distribution
Arch.
dms version
v0.2.4
Description
This is difficult to reproduce and capture, but with the latest version (updated today) dock loses mouse focus so that when I mouse hover on icons, the pointer and arrow flicker and I cannot click icons. Only dms restart fixes this until it happens again.
Expected Behavior
Icons should keep focus.
Steps to Reproduce
- Install the latest git version in Arch
- Wait for it to happen
- Try to click dock icons, can't do it because they are losing focus
Possible fix 1d211e84741e4deb3b42e9e9b73e7391a71d7c8d
Testing, so far so good. I'll let you know if it appears again.
It happened again. ☹️
The issue could be related to MouseArea state corruption during dock model updates. Here's my theory on what might be happening:
- Every time a window opens/closes/changes focus,
CompositorService.sortedToplevelschanges - This triggers
dockModel.updateModel()inDockApps.qml(line 242) updateModel()callsclear()which destroys all delegates and their MouseAreas, then recreates them- During this destruction/recreation cycle, MouseAreas might enter an invalid state on Wayland/Hyprland
- The MouseArea could become unresponsive until DMS is restarted
This could explain why:
- The issue seems random (depends on window operations)
- Sometimes happens when opening apps
- Restarting DMS fixes it temporarily
- It likely started after recent updates (possibly a regression related to my PR #502's changes to dock sizing)
Not entirely sure this will work, but adding preventStealing: true to the MouseArea in DockAppButton.qml might prevent parent/sibling MouseAreas from interfering during model updates:
--- a/Modules/Dock/DockAppButton.qml
+++ b/Modules/Dock/DockAppButton.qml
@@ -219,6 +219,8 @@ Item {
anchors.fill: parent
+ enabled: true
+ preventStealing: true
hoverEnabled: true
cursorShape: longPressing ? Qt.DragMoveCursor : Qt.PointingHandCursor
acceptedButtons: Qt.LeftButton | Qt.RightButton | Qt.MiddleButton
The preventStealing property should (in theory) ensure that the button MouseAreas retain their event handling even when the dock model is being rebuilt.
Testing this fix now on Hyprland/Wayland, but not 100% confident this is the actual issue. Will report back.
Haven't been able to reproduce this in the later versions (running v0.4.1 now).