improvements
This commit is contained in:
parent
806489899e
commit
0b5abd87ea
|
@ -34,7 +34,7 @@ For more examples check out plugins repository: [noobie-plugins](https://github.
|
|||
![menu](./screenshots/screenshot2.png)
|
||||
|
||||
- mouse actions (scroll up/down, right click);
|
||||
- icon could be either a local file, a feathericons icon or an image from URL;
|
||||
- icon could be either a local file, a [feathericons](https://feathericons.com/) icon or an image from URL;
|
||||
- a notification with details in case your script failed:
|
||||
|
||||
![error notification](./screenshots/screenshot-errors.png)
|
||||
|
|
|
@ -21,16 +21,20 @@
|
|||
"title": "Execute some script",
|
||||
"onclick": "/tmp/somescript.sh"
|
||||
},
|
||||
{
|
||||
"type": "header",
|
||||
"title": "Header"
|
||||
},
|
||||
{
|
||||
"icon": "slack",
|
||||
"title": "OpenSlack",
|
||||
"onclick": "xdg-open https://slack.com"
|
||||
},
|
||||
{
|
||||
"title": "-"
|
||||
"type" : "separator"
|
||||
},
|
||||
{
|
||||
"title": "Menu item with no icon",
|
||||
"title": "Menu item with no icon and no action"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
5
init.lua
5
init.lua
|
@ -102,6 +102,11 @@ local function worker(user_args)
|
|||
if new_icon:sub(1, 1) == '/' then
|
||||
self:get_children_by_id('icn')[1]:set_image(new_icon)
|
||||
|
||||
-- new_icon is a relative path to the file
|
||||
elseif new_icon:sub(1, 1) == '~' then
|
||||
self:get_children_by_id('icn')[1]:set_image(HOME_DIR .. '/' .. new_icon:sub(3))
|
||||
|
||||
|
||||
-- new_icon is a url to the icon
|
||||
elseif new_icon:sub(1, 4) == 'http' then
|
||||
local icon_path = CACHE_DIR .. '/' .. new_icon:sub(-16)
|
||||
|
|
|
@ -35,10 +35,15 @@ local function build_icon_and_text_row(item, widget, noobie_popup)
|
|||
widget = wibox.widget.imagebox
|
||||
}
|
||||
|
||||
-- new_icon is a path to a file
|
||||
-- new_icon is an absolute path to a file
|
||||
if item.icon:sub(1, 1) == '/' then
|
||||
item_image:set_image(item.icon)
|
||||
|
||||
-- new_icon is a relative path to the file
|
||||
elseif item.icon:sub(1, 1) == '~' then
|
||||
print(HOME_DIR .. '/' .. item.icon:sub(3))
|
||||
item_image:set_image(HOME_DIR .. '/' .. item.icon:sub(3))
|
||||
|
||||
-- new_icon is a url of the icon
|
||||
elseif item.icon:sub(1, 4) == 'http' then
|
||||
local icon_path = CACHE_DIR .. '/' .. item.icon:sub(-16)
|
||||
|
@ -130,11 +135,11 @@ end
|
|||
|
||||
|
||||
function row_builder:build_row(item, widget, noobie_popup)
|
||||
if item.header == true then
|
||||
if item.type == 'header' then
|
||||
return build_header_row(item)
|
||||
elseif item.title ~= nil and #item.title > 0 and item.icon ~= nil and #item.icon > 0 then
|
||||
return build_icon_and_text_row(item, widget, noobie_popup)
|
||||
elseif item.title ~= nil and item.title == '-' then
|
||||
elseif item.type == 'separator' then
|
||||
return wibox.widget {
|
||||
{
|
||||
orientation = 'horizontal',
|
||||
|
|
Loading…
Reference in New Issue