awesome-wm-widgets/_prompts/translate-shell.md

42 lines
1.5 KiB
Markdown
Raw Normal View History

2018-09-19 15:33:35 +02:00
---
layout: page
---
2018-10-22 04:00:14 +02:00
# Translate Shell
2018-09-19 15:22:37 +02:00
This widget allows quickly translate words or phrases without opening a browser - just using Awesome. To provide direction of the translation add the 2 letters code of the source and target languages at the end of the phrase, for example _hello enfr_ will translate _hello_ from English to French. This widget is based on [Yandex.Translate API](https://tech.yandex.com/translate/).
2019-12-25 03:36:33 +01:00
![demo]({{'/assets/img/prompts/translate-shell.gif' | relative_url }}){:.center-image}
2018-09-19 15:22:37 +02:00
## Controls
- <kbd>Mod4</kbd> + <kbd>c</kbd> - 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.
## Installation
1. Clone repo under **~/.config/awesome/**
2018-09-25 01:18:45 +02:00
```bash
git clone https://github.com/streetturtle/awesome-wm-widgets.git ~/.config/awesome/
```
2018-09-19 15:22:37 +02:00
1. Get an [API key](https://translate.yandex.com/developers/keys) and paste it in **translate.lua** as value of the `API_KEY` variable
1. Require widget in **rc.lua**:
```lua
local translate = require("awesome-wm-widgets.translate-widget.translate")
```
1. Add a shortcut to run translate prompt:
```lua
2018-10-22 04:31:15 +02:00
awful.key({ modkey }, "c",
function()
translate.show_translate_prompt()
end,
{ description = "run translate prompt", group = "launcher" }
),
2018-09-19 15:22:37 +02:00
```