diff options
| author | Pavel Makhov <pmakhov@theoctavegroup.com> | 2019-11-25 10:21:05 -0500 | 
|---|---|---|
| committer | Pavel Makhov <pmakhov@theoctavegroup.com> | 2019-11-25 10:21:05 -0500 | 
| commit | 44e9b4e14eebeb9a7a0f9cbc0d7b5adcfc62d80b (patch) | |
| tree | a1b41982038de455db1d2d58a96560a60fb91f80 /translate-widget/translate.lua | |
| parent | 2e67a1f37e34bb9efdcc809279591bb52d70185d (diff) | |
Delete secrets.lua as translate widget will receive it as a parameter
Diffstat (limited to 'translate-widget/translate.lua')
| -rw-r--r-- | translate-widget/translate.lua | 9 | 
1 files changed, 4 insertions, 5 deletions
diff --git a/translate-widget/translate.lua b/translate-widget/translate.lua index 27f65c7..ae538c8 100644 --- a/translate-widget/translate.lua +++ b/translate-widget/translate.lua @@ -14,7 +14,6 @@ local naughty = require("naughty")  local wibox = require("wibox")  local gears = require("gears")  local gfs = require("gears.filesystem") -local secrets = require("awesome-wm-widgets.secrets")  local BASE_URL = 'https://translate.yandex.net/api/v1.5/tr.json/translate'  local ICON = '/usr/share/icons/Papirus-Dark/48x48/apps/gnome-translate.svg' @@ -87,8 +86,8 @@ w:setup {  --- Main function - takes the user input and shows the widget with translation  -- @param request_string - user input (dog enfr) -local function translate(to_translate, lang) -    local urll = BASE_URL .. '?lang=' .. lang .. '&text=' .. urlencode(to_translate) .. '&key=' .. secrets.translate_widget_api_key +local function translate(to_translate, lang, api_key) +    local urll = BASE_URL .. '?lang=' .. lang .. '&text=' .. urlencode(to_translate) .. '&key=' .. api_key      local resp_json, code = https.request(urll)      if (code == 200 and resp_json ~= nil) then @@ -162,7 +161,7 @@ input_widget:setup {      left = 10  } -local function show_translate_prompt() +local function show_translate_prompt(api_key)      awful.placement.top(input_widget, { margins = {top = 40}, parent = awful.screen.focused()})      input_widget.height = 40      input_widget.visible = true @@ -183,7 +182,7 @@ local function show_translate_prompt()                  })                  return              end -            translate(to_translate, lang) +            translate(to_translate, lang, api_key)          end,          done_callback = function()              input_widget.visible = false  | 
