lcpz / awesome-freedesktop

Freedesktop.org menu and desktop icons support for Awesome WM
GNU General Public License v2.0
129 stars 25 forks source link

Signals on a awful.menu #13

Closed ducklin5 closed 5 years ago

ducklin5 commented 5 years ago

I've been building on your Powerarrow Dark AwesomeWm config and I wanted to have a more dynamic menu. Its quite annoying having to click outside the menu for it to close. So I tried connecting the mouse leave signal to it. The config loads but the behavior doesn't change. Here is the code:

local builtmenu = freedesktop.menu.build({
    icon_size = beautiful.menu_height or 16,
    before = {
        { "Awesome", myawesomemenu, beautiful.awesome_icon },
        -- other triads can be put here
    },
    after = {
        { "Open terminal", terminal },
        -- other triads can be put here
    }
})

awful.util.mymainmenu = builtmenu
builtmenu:connect_signal("mouse::leave", function() awful.util.mymainmenu:toggle() end)

I'm not sure if this is a bug or if menus just don't support signals. If its just not possible with signals, how else can I go about this?

lcpz commented 5 years ago

Every awful.menu has a wibox. You connect the signal to that.

awful.util.mymainmenu.wibox:connect_signal("mouse::leave", function()
    awful.util.mymainmenu:hide()
end)