Linux · X11 · Wayland · ConsolaLinux · X11 · Wayland · Console

Uma tecla, o que tu quiseres.One key, whatever you want.

O KB Macro troca uma tecla física por outra, por várias ao mesmo tempo ou por uma macro com o tempo de espera que escolheres. Funciona em qualquer programa ou jogo.KB Macro turns a physical key into another key, several keys at once or a macro with the waits you choose. It works in any program or game.

R→81,5 sE3 s1macro
T→1500 ms22 s3macro
F→CTRL+Cao mesmo tempoat the same time
CAPS→ESCtroca simplessimple swap

FuncionalidadesFeatures

Leve, sem configurações escondidas e sem depender do ambiente gráfico.Lightweight, no hidden settings and no dependence on the desktop environment.

⌨

Funciona em todo o ladoWorks everywhere

Trabalha ao nível do kernel, por isso funciona em X11, Wayland, na consola e dentro de jogos.It works at kernel level, so it runs on X11, Wayland, the console and inside games.

⏱

Macros com esperasMacros with waits

Quantos passos quiseres, cada um com a sua espera antes. 1000 ms = 1 segundo.As many steps as you want, each with its own wait before it. 1000 ms = 1 second.

+

CombinaçõesCombos

Carrega várias teclas juntas e mantém-nas premidas enquanto seguras a tua tecla.Presses several keys together and holds them while you hold your key.

◉

Capturar teclasCapture keys

Carregas em Capturar e depois na tecla. Ou escolhes da lista com todas as teclas do Linux, incluindo multimédia e botões de comando.Click Capturar and then press the key. Or pick from the list with every Linux key, including media keys and controller buttons.

↻

Segundo planoBackground

Com --run remapeia sem janela e recarrega sozinho quando mudas os atalhos.With --run it remaps without a window and reloads by itself when you change the shortcuts.

{ }

Config em JSONJSON config

Os atalhos ficam num ficheiro simples que podes editar à mão ou copiar para outro PC.Shortcuts live in a simple file you can edit by hand or copy to another PC.

Dois modosTwo modes

Cada atalho escolhe o que a tecla passa a fazer.Each shortcut chooses what the key does.

Teclas ao mesmo tempoKeys at the same time

As teclas ficam premidas enquanto seguras a tua. Bom para atalhos ou para andar num jogo.The keys stay pressed while you hold yours. Good for shortcuts or for moving in a game.

F→CTRL+C
R→W

Macro

Passos um a seguir ao outro, com o tempo de espera que quiseres antes de cada um.Steps one after another, with the wait you want before each one.

R→81,5 sE3 s1
G→E50 msE

CapturasScreenshots

Uma janela para ver os atalhos e outra para os criar. Clica numa imagem para a ampliar.One window to see your shortcuts and another to create them. Click an image to enlarge it.

Janela principal do KB Macro com a lista de atalhos
Lista de atalhos, botão Iniciar e “Ligar ao abrir”Shortcut list, Start button and “Turn on at launch”
Janela para editar um atalho do KB Macro
Editar um atalho: tecla, modo e passos da macroEditing a shortcut: key, mode and macro steps

InstalarInstall

Funciona em Arch, Debian/Ubuntu, Fedora e openSUSE. O script instala o python-evdev e o tk e dá ao teu utilizador acesso ao teclado.Works on Arch, Debian/Ubuntu, Fedora and openSUSE. The script installs python-evdev and tk and gives your user access to the keyboard.

Descarrega o projetoDownload the project

git clone https://github.com/Ribeiro-MD/KB-Macro.git
cd KB-Macro

Corre o instaladorRun the installer

./install.sh               # ou: ./install.sh --autostart

Com --autostart o remapeamento liga sozinho quando entras na sessão.With --autostart remapping turns on by itself when you log in.

Termina a sessão e volta a entrarLog out and back in

É preciso para o grupo input contar. Depois abre o KeyBinds no menu ou corre ./keybinds.py.This is needed for the input group to take effect. Then open KeyBinds from the menu or run ./keybinds.py.

Como usarHow to use

Criar um atalho demora uns segundos.Creating a shortcut takes a few seconds.

  • Carrega em + Novo atalho.Click + Novo atalho (new shortcut).
  • Em Tecla que carregas, carrega em Capturar e depois na tecla.In Tecla que carregas (the key you press), click Capturar and then press the key.
  • Escolhe o modo: ao mesmo tempoat the same time ou macro.Choose the mode: ao mesmo tempoat the same time (at the same time) or macro.
  • Adiciona teclas com + Capturar ou escolhe na caixa e carrega em + Adicionar.Add keys with + Capturar, or pick one in the box and click + Adicionar.
  • Na macro, mete a espera em Esperar antes do passo (ms). Para mudar um passo, seleciona-o e carrega em Aplicar ao selecionado.In a macro, set the wait in Esperar antes do passo (ms). To change a step, select it and click Aplicar ao selecionado.
  • ↑ ↓ mudam a ordem, Remover tira o passo.↑ ↓ change the order, Remover deletes the step.
  • Guardar. Se estiver ativo, aplica-se logo.Guardar (save). If it is running, it applies right away.

ConfiguraçãoConfiguration

Fica em ~/.config/keybinds/config.json. Em waits vai a espera em ms antes de cada tecla.It lives in ~/.config/keybinds/config.json. waits holds the wait in ms before each key.

{
  "autostart": true,
  "mappings": [
    {"from": "R", "to": ["LEFTCTRL", "C"], "mode": "combo"},
    {"from": "T", "to": ["8", "E", "1"],
     "mode": "sequence", "waits": [0, 1500, 3000]}
  ]
}

Sem janela, a recarregar sozinho quando o ficheiro muda:No window, reloading by itself when the file changes:

./keybinds.py --run

DúvidasFAQ

O que costuma aparecer.What usually comes up.

Como funciona por dentro?How does it work inside?

Lê os teclados em /dev/input com evdev, agarra-os e reenvia tudo por um teclado virtual em /dev/uinput, trocando só as teclas que configuraste.It reads the keyboards in /dev/input with evdev, grabs them and resends everything through a virtual keyboard in /dev/uinput, swapping only the keys you configured.

Porque é que tenho de estar no grupo input?Why do I have to be in the input group?

Para o programa poder ler o teclado sem correr como root. É o mesmo que pedem outros remapeadores como o keyd ou o input-remapper.So the program can read the keyboard without running as root. Other remappers like keyd or input-remapper ask for the same.

E se algo correr mal?What if something goes wrong?

Fecha o KB Macro (ou Ctrl+C no modo --run) e o teclado volta ao normal.Close KB Macro (or Ctrl+C in --run mode) and the keyboard goes back to normal.

Diz que não tenho permissãoIt says I don't have permission

Confirma que correste o install.sh e que terminaste a sessão depois. Podes ver com groups se o input aparece.Check that you ran install.sh and logged out afterwards. Run groups to see if input shows up.

Funciona no Windows?Does it work on Windows?

Não, é só para Linux.No, it is Linux only.