add left/right button click support

This commit is contained in:
Pavel Makhov 2019-09-30 14:51:31 -04:00
parent ddc36b526d
commit 097daa7d44
3 changed files with 15 additions and 9 deletions

View file

@ -129,6 +129,19 @@ local function worker(args)
c:set_bg(beautiful.bg_normal)
end)
row:buttons(
awful.util.table.join(
awful.button({}, 1, function()
spawn.with_shell("google-chrome https://" .. host .. '/' .. review._number)
popup.visible = false
end),
awful.button({}, 3, function()
spawn.with_shell("echo 'git-review -d " .. review._number .."' | xclip -selection clipboard")
popup.visible = false
end)
)
)
table.insert(rows, row)
end
@ -138,12 +151,8 @@ local function worker(args)
gerrit_widget:buttons(
awful.util.table.join(
awful.button({}, 1, function()
--awful.placement.top_right(w, { margins = {top = 25, right = 10}, parent = awful.screen.focused() })
--w.visible = not w.visible
awful.placement.top_right(popup, { margins = { top = 25, right = 10}, parent = awful.screen.focused() })
popup.visible = not popup.visible
--ww:move_next_to(gerrit_widget)
--awful.placement.next_to(ww, gerrit_widget)
end)
)
)

View file

@ -8,10 +8,7 @@
local secrets = {
-- Yandex.Translate API key - https://tech.yandex.com/translate/
translate_widget_api_key = os.getenv('AWW_TRANSLATE_API_KEY') or '<your_key>',
-- OpenWeatherMap API key - https://openweathermap.org/appid
weather_widget_api_key = os.getenv('AWW_WEATHER_API_KEY') or '<your_key>',
translate_widget_api_key = os.getenv('AWW_TRANSLATE_API_KEY') or 'trnsl.1.1.20170708T010252Z.8b3fcacab3396ad1.88df3f48339672bce016a0e85a4db3aeb34dc7ae',
}
return secrets

View file

@ -106,7 +106,7 @@ local function translate(to_translate, lang)
-- calculate height of the widget
w.height = h1 + h2 + h3 + 20
-- try to vetrtically align the icon
-- try to vertically align the icon
w.left.img:set_top((h1 + h2 + h3 + 20 - 48)/2)
w.visible = true