summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorstreetturtle <streetturtle@gmail.com>2018-01-20 21:24:07 -0500
committerstreetturtle <streetturtle@gmail.com>2018-01-20 21:24:07 -0500
commitb9de47d5a3be2e3c59a2e11db238eb740c8b8de8 (patch)
treee2d4f32de2a074aace9cf5d30e25e73eac9d6155
parent4c1623817bf327684c8e4f7558b41a57cc2d602b (diff)
update readme
-rw-r--r--translate-widget/README.MD80
1 files changed, 42 insertions, 38 deletions
diff --git a/translate-widget/README.MD b/translate-widget/README.MD
index 53f4586..6dbb3b1 100644
--- a/translate-widget/README.MD
+++ b/translate-widget/README.MD
@@ -1,5 +1,3 @@
-in progress...
-
# Translate Widget
![demo](./demo.gif)
@@ -8,42 +6,48 @@ This widget is based on the [Yandex.Translate API](https://tech.yandex.com/trans
## Installation
-1. Get an [https://translate.yandex.com/developers/keys](API key)
-1.
-
-Create a translate prompt:
-
-```lua
-s.translateprompt = awful.widget.prompt()
-```
-
-Add it to the left widgets of the wibox, just after `mypromptbox`:
-
-```lua
--- 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:
-
-```lua
-awful.key({ modkey }, "c", function()
- awful.prompt.run {
- prompt = "trnslt: ",
- textbox = awful.screen.focused().translateprompt.widget,
- exe_callback = function(text)
- translate.translate(text)
- end
- }
-```
+1. Get an [API key](https://translate.yandex.com/developers/keys) and paste it **secrets.lua**
+1. Require widget and secrets in **rc.lua**:
+
+ ```lua
+ local secrets = require("awesome-wm-widgets.secrets")
+ local translate = require("awesome-wm-widgets.translate-widget.translate")
+ ```
+
+1. Create a translate prompt (just under `mypromptbox`):
+
+ ```lua
+ s.mypromptbox = awful.widget.prompt()
+ s.translateprompt = awful.widget.prompt()
+ ```
+
+1. Add it to the left widgets of the wibox, just after `mypromptbox`:
+
+ ```lua
+ -- 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,
+ },
+ ```
+
+1. Add a shortcut to run this prompt (note that we pass an API key from secrets.lua in method call):
+
+ ```lua
+ awful.key({ modkey }, "c", function()
+ awful.prompt.run {
+ prompt = "trnslt: ",
+ textbox = awful.screen.focused().translateprompt.widget,
+ exe_callback = function(text)
+ translate.translate(text, secrets.translate_widget_api_key)
+ end
+ }
+ ```
## Controls