diff --git a/translate-widget/translate.lua b/translate-widget/translate.lua
index 98a3e46..bbcaefd 100644
--- a/translate-widget/translate.lua
+++ b/translate-widget/translate.lua
@@ -27,7 +27,17 @@ local function urlencode(str)
return str
end
-local translate_widget = wibox.widget {
+local w = wibox {
+ width = 300,
+ height = 80,
+ ontop = true,
+ screen = mouse.screen,
+ expand = true,
+ bg = '#1e252c',
+ max_widget_size = 500
+}
+
+w:setup {
{
image = '/usr/share/icons/Papirus-Dark/48x48/apps/gnome-translate.svg',
resize = false,
@@ -47,8 +57,9 @@ local translate_widget = wibox.widget {
widget = wibox.widget.textbox
},
id = 'text',
- layout = wibox.layout.flex.vertical
+ layout = wibox.layout.flex.vertical,
},
+ id = 'left',
layout = wibox.layout.fixed.horizontal
}
@@ -60,18 +71,10 @@ local function translate(request_string)
if (code == 200 and resp_json ~= nil) then
local resp = json.decode(resp_json).text[1]
- translate_widget.text.header:set_markup('' .. lang.. '')
- translate_widget.text.src:set_markup(' ' .. to_translate .. '')
- translate_widget.text.res:set_markup(' ' .. resp .. '')
+ w.left.text.header:set_markup('' .. lang .. '')
+ w.left.text.src:set_markup(' ' .. to_translate .. '')
+ w.left.text.res:set_markup(' ' .. resp .. '')
- local w = wibox {
- width = 300,
- height = 80,
- ontop = true,
- screen = mouse.screen,
- expand = true,
- widget = translate_widget
- }
awful.placement.top(w, { margins = {top = 25}})
w.visible = true
w:buttons(