Search code examples
luasignalsawesome-wm

Is there any way to listen to mouse::enter signal for awful.menu


I've recently started to use and customize awesomewm, and I'm really happy with how all components work together and with the related documentation.

Though I'm sometimes really disturbed when using the menu (awful.menu) and it's nature to block some actions. So I've wanted to add listener to the mouse::enter and mouse::leave signal to allow the widget to hide itself once the mouse leaves the widget area.

Something like:

menu:connect_signal('mouse::enter', function()
    naughty.notify({
        preset = naughty.config.presets.critical,
        title = "Entered",
        text = "Entered"
    })
end)

But those signals don't seem to be emitted by this widget. I've dug through the docs but don't seem to find any documentation about signals emitted by this widget. My question is then: Is there any other signal with same functionality, or is this not possible with awful.menu?


Solution

  • The menu is a complicated object. You can dig in its internal and access menu.wibox:connect_signal("mouse::enter", function() end), but this is only the top-level wibox. Submenus generate their own menu instance and they only create that dynamically.

    Thus, there is no easy way to connect signals like this, sorry.