summaryrefslogtreecommitdiff
path: root/translate-widget
diff options
context:
space:
mode:
authorstreetturtle <streetturtle@gmail.com>2020-12-02 09:24:05 -0500
committerstreetturtle <streetturtle@gmail.com>2020-12-02 22:04:23 -0500
commitd9eb3885eea90e06b79ff8fc4b2d1c1b8f5e4cfd (patch)
tree573bfe1b0adfc92532cce39a44b8828407e1f79d /translate-widget
parente3d3e07af3a18331711e897d9928701d9ac21839 (diff)
trigger build action on a branch
Diffstat (limited to 'translate-widget')
-rw-r--r--translate-widget/translate.lua13
1 files changed, 8 insertions, 5 deletions
diff --git a/translate-widget/translate.lua b/translate-widget/translate.lua
index 811e136..1499333 100644
--- a/translate-widget/translate.lua
+++ b/translate-widget/translate.lua
@@ -16,7 +16,8 @@ local wibox = require("wibox")
local gears = require("gears")
local gfs = require("gears.filesystem")
-local TRANSLATE_CMD = [[bash -c 'curl -s -u "apikey:%s" -H "Content-Type: application/json" -d '\''{"text": ["%s"], "model_id":"%s"}'\'' "%s/v3/translate?version=2018-05-01"']]
+local TRANSLATE_CMD = [[bash -c 'curl -s -u "apikey:%s" -H "Content-Type: application/json"]]
+ ..[[ -d '\''{"text": ["%s"], "model_id":"%s"}'\'' "%s/v3/translate?version=2018-05-01"']]
local ICON = os.getenv("HOME") .. '/.config/awesome/awesome-wm-widgets/translate-widget/gnome-translate.svg'
--- Returns two values - string to translate and direction:
@@ -82,12 +83,14 @@ local function translate(to_translate, lang, api_key, url)
{
{
id = 'src',
- markup = '<b>' .. lang:sub(1,2) .. '</b>: <span color="#FFFFFF"> ' .. to_translate .. '</span>',
+ markup = '<b>' .. lang:sub(1,2) .. '</b>: <span color="#FFFFFF"> '
+ .. to_translate .. '</span>',
widget = wibox.widget.textbox
},
{
id = 'res',
- markup = '<b>' .. lang:sub(4) .. '</b>: <span color="#FFFFFF"> ' .. resp.translations[1].translation .. '</span>',
+ markup = '<b>' .. lang:sub(4) .. '</b>: <span color="#FFFFFF"> '
+ .. resp.translations[1].translation .. '</span>',
widget = wibox.widget.textbox
},
id = 'text',
@@ -110,11 +113,11 @@ local function translate(to_translate, lang, api_key, url)
w:buttons(
awful.util.table.join(
awful.button({}, 1, function()
- awful.spawn.with_shell("echo '" .. resp.translations[1].translation .. "' | xclip -selection clipboard")
+ spawn.with_shell("echo '" .. resp.translations[1].translation .. "' | xclip -selection clipboard")
w.visible = false
end),
awful.button({}, 3, function()
- awful.spawn.with_shell("echo '" .. to_translate .."' | xclip -selection clipboard")
+ spawn.with_shell("echo '" .. to_translate .."' | xclip -selection clipboard")
w.visible = false
end)
)