From 29ff1e627b0c556bcdd46ef080db31fa08a8c491 Mon Sep 17 00:00:00 2001 From: eeeXun Date: Wed, 21 Jun 2023 13:44:59 +0800 Subject: [PATCH] docs: add keymap.yaml example --- README.md | 12 +++++++++++- example/keymap.yaml | 27 +++++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 example/keymap.yaml diff --git a/README.md b/README.md index 8897a8f..b9c750f 100644 --- a/README.md +++ b/README.md @@ -78,7 +78,7 @@ git clone https://github.com/eeeXun/gtt.git && cd gtt && go build -ldflags="-s - docker run -it eeexun/gtt:latest ``` -## Create a theme +## Customize theme You can create a theme with theme name. And you must provide the color of `bg`, `fg`, `gray`, `red`, `green`, `yellow`, `blue`, `purple`, `cyan`, `orange`. @@ -112,6 +112,8 @@ See available languages on: ## Key Map +### Default key map + `` Exit program. @@ -157,6 +159,14 @@ Cycle through the pop out widget. `<1>`, `<2>`, `<3>` Switch pop out window. +### Customize key map + +See the example in [keymap.yaml](example/keymap.yaml) file. This file should located at `$XDG_CONFIG_HOME/gtt/keymap.yaml` or `$HOME/.config/gtt/keymap.yaml` + +For key to combine with `Ctrl`, value can be `" "` (Space), `"\\"` or `'\'` (backslash), `"]"`, `"^"`, `"_"`, `"a"` to `"z"` (lower case). + +⚠️ Note, don't use `"c"`, `` is for exit program + ## Credit [soimort/translate-shell](https://github.com/soimort/translate-shell), diff --git a/example/keymap.yaml b/example/keymap.yaml new file mode 100644 index 0000000..08b460d --- /dev/null +++ b/example/keymap.yaml @@ -0,0 +1,27 @@ +# This file should located at $XDG_CONFIG_HOME/gtt/keymap.yaml or $HOME/.config/gtt/keymap.yaml +# For key to combine with Ctrl, value can be " " (Space), "\\" or '\' (backslash), "]", "^", "_", "a" to "z" (lower case) +# ⚠️ Note, don't use "c", is for exit program +# Or the function key, value can be "F1" to "F64" + +# Translate, +translate: "j" +# Swap language, +swap_language: "s" +# Clear all text in source of translation window, +clear: "q" +# Copy selected text, +copy_selected: "y" +# Copy all text in source of translation window, +copy_src: "g" +# Copy all text in destination of translation window, +copy_dst: "r" +# Play text to speech on source of translation window, +tts_src: "o" +# Play text to speech on destination of translation window, +tts_dst: "p" +# Stop playing text to speech, +stop_tts: "x" +# Toggle transparent, +toggle_transparent: "t" +# Toggle Definition/Example & Part of speech, +toggle_below: "\\"