From 097daa7d44bc6eb758c45653b1c24413c4c11fdb Mon Sep 17 00:00:00 2001 From: Pavel Makhov Date: Mon, 30 Sep 2019 14:51:31 -0400 Subject: add left/right button click support --- gerrit-widget/gerrit.lua | 17 +++++++++++++---- secrets.lua | 5 +---- translate-widget/translate.lua | 2 +- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/gerrit-widget/gerrit.lua b/gerrit-widget/gerrit.lua index e2d0e02..5cf5b75 100644 --- a/gerrit-widget/gerrit.lua +++ b/gerrit-widget/gerrit.lua @@ -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) ) ) diff --git a/secrets.lua b/secrets.lua index 05ca2bf..d3250fd 100644 --- a/secrets.lua +++ b/secrets.lua @@ -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 '', - - -- OpenWeatherMap API key - https://openweathermap.org/appid - weather_widget_api_key = os.getenv('AWW_WEATHER_API_KEY') or '', + translate_widget_api_key = os.getenv('AWW_TRANSLATE_API_KEY') or 'trnsl.1.1.20170708T010252Z.8b3fcacab3396ad1.88df3f48339672bce016a0e85a4db3aeb34dc7ae', } return secrets diff --git a/translate-widget/translate.lua b/translate-widget/translate.lua index 2b64bf8..27f65c7 100644 --- a/translate-widget/translate.lua +++ b/translate-widget/translate.lua @@ -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 -- cgit v1.2.3