awesome-wm-widgets/translate-widget
streetturtle 4068d4edf3 update readme 2017-12-27 14:05:50 -05:00
..
README.MD update readme 2017-12-27 14:05:50 -05:00
translate.lua basic error handling 2017-12-27 13:30:56 -05:00

README.MD

in progress...

Translate Widget

This widget is based on the Yandex.Translate API.

Installation

  1. Get an [https://translate.yandex.com/developers/keys](API key)

Create a translate prompt:

s.translateprompt = awful.widget.prompt()

Add it to the left widgets of the wibox, just after mypromptbox:

-- Add widgets to the wibox
s.mywibox:setup {
    layout = wibox.layout.align.horizontal,
    { -- Left widgets
        layout = wibox.layout.fixed.horizontal,
        mylauncher,
        s.mytaglist,
        s.mypromptbox,
        s.translateprompt,
    },

Add a shortcut to run this prompt:

awful.key({ modkey }, "c", function()
        awful.prompt.run {
            prompt = "trnslt: ",
            textbox = awful.screen.focused().translateprompt.widget,
            exe_callback = function(text)
                translate.translate(text)
            end
        }

Controls

  • Mod4 + c - opens a translate prompt;
  • left click on the popup widget - copies the translation to the clipboard and closes widget;
  • right click on the popup widget - copies text to translate to the clipboard and closes widget.