Fix set_menu()
This commit is contained in:
parent
a1144564ab
commit
69d5aac0fa
|
@ -43,7 +43,7 @@ The most simple kind of menus, contexts one, can be created like this:
|
||||||
|
|
||||||
-- To add the menu to a widget:
|
-- To add the menu to a widget:
|
||||||
local mytextbox = wibox.widget.textbox()
|
local mytextbox = wibox.widget.textbox()
|
||||||
mytextbox:set_menu(m,3) -- 3 = right mouse button, 1 = left mouse button
|
mytextbox:set_menu(menu,3) -- 3 = right mouse button, 1 = left mouse button
|
||||||
```
|
```
|
||||||
|
|
||||||
In this example, a simple 3 item menu is created with a dynamically generated
|
In this example, a simple 3 item menu is created with a dynamically generated
|
||||||
|
|
3
init.lua
3
init.lua
|
@ -11,7 +11,8 @@ end
|
||||||
|
|
||||||
local function set_menu(self,menu,button)
|
local function set_menu(self,menu,button)
|
||||||
if not menu then return end
|
if not menu then return end
|
||||||
local b,current,bt = button or 1,self:buttons(),aw_button({},b,function(geo)
|
local b = button or 1
|
||||||
|
local current,bt = self:buttons(),aw_button({},b,function(geo)
|
||||||
local m = menu
|
local m = menu
|
||||||
if type(menu) == "function" then
|
if type(menu) == "function" then
|
||||||
if self._tmp_menu and self._tmp_menu.visible then
|
if self._tmp_menu and self._tmp_menu.visible then
|
||||||
|
|
Loading…
Reference in New Issue