quickshell: auto-close dropdowns on mouse inactivity
3s timer starts when dropdown opens or mouse leaves. Hovering the dropdown stops the timer. Leaves instantly on mouse exit. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
98d1e6249c
commit
a8a129a9cd
1 changed files with 20 additions and 0 deletions
|
|
@ -838,6 +838,7 @@ in
|
|||
property real dropdownX: 0
|
||||
property real fullWidth: 200
|
||||
property real fullHeight: 200
|
||||
property int autoCloseMs: 3000
|
||||
default property alias content: dropdownContent.data
|
||||
|
||||
anchor.window: bar
|
||||
|
|
@ -854,11 +855,30 @@ in
|
|||
onVisibleChanged: {
|
||||
if (visible) {
|
||||
open = true;
|
||||
_autoClose.restart();
|
||||
} else {
|
||||
open = false;
|
||||
_autoClose.stop();
|
||||
}
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: _autoClose
|
||||
interval: dropdown.autoCloseMs
|
||||
onTriggered: bar.closeAllDropdowns()
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
propagateComposedEvents: true
|
||||
onEntered: _autoClose.stop()
|
||||
onExited: _autoClose.restart()
|
||||
onClicked: (mouse) => mouse.accepted = false
|
||||
onPressed: (mouse) => mouse.accepted = false
|
||||
onReleased: (mouse) => mouse.accepted = false
|
||||
}
|
||||
|
||||
Item {
|
||||
anchors.right: _dropdownRect.left
|
||||
anchors.top: parent.top
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue