Aylur / ags

A customizable and extensible shell
GNU General Public License v3.0
1.75k stars 94 forks source link

hoverLost event callback is never invoked #351

Closed coolstrong closed 3 months ago

coolstrong commented 3 months ago

I would like to implement closing popups on losing hover with some debounce, as I am aware there is no non-hacky way to implement click-away (and I don't like it anyway). But it seems that hoverLost event is broken - no matter whether it is EventBox or Button, the event is never fired. Simplest example print nothing when cursor leaves button:

Widget.Button({
  label: "123",
  onHoverLost: () => print("hover lost"),
})

Tried either with stable and git version hosted on aur.

Are there any pitfalls when working with that event?

Aylur commented 3 months ago

onHoverLost needs the window to still have focus, you can workaround it by connecting to leave-notify-event

Widget.Button({
    setup: self => self.on("leave-notify-event", () => {
        // instead of on_hover_lost
    })
})