A Python application that provides customizable keyboard shortcuts for AI-powered text processing using local language models through Ollama.
The application allows you to enhance your writing workflow by processing selected text through language models with simple keyboard shortcuts. Whether you want to fix errors, translate, or transform text in other ways, you can do it quickly without leaving your current application.
- Python 3.x
- Ollama installed and running locally
- Clone this repository
- Create a virtual environment (this isolates the project's dependencies from your system Python installation and will be used by the startup script):
python -m venv .venv
- Activate the virtual environment:
- Linux (and also macOS, but untested):
source .venv/bin/activate
- Windows:
.venv\Scripts\activate
- Install required packages:
pip install -r requirements.txt
- Configure your hotkeys and actions in
config.yml
- Start Ollama on your system
- Activate the virtual environment (see Installation section above)
- Run the script:
python aidful-writing-keys.py
- Select text in any application
- Press your configured hotkey to process the text
- The processed text will automatically replace your selection
- Linux: adapt and add
run-aidful-writing-key.sh
to your autostart applications. This will activate the .venv and run the application.
Edit config.yml
to customize your hotkeys and actions. Example configuration:
actions:
- def: fix text
key: <ctrl>+<alt>+q
llm: gemma2:2b
ask: "Reply only with exactly the same text as entered below, but correct the spelling and grammar. Do not add any explanation of what you correct:"
- def: rewrite formal
key: <ctrl>+<alt>+w
llm: gemma2:2b
ask: "Rewrite the following very formal and polite. No explanations or note:"
- def: translate to German
key: <ctrl>+<alt>+e
llm: gemma2:2b
ask: "Translate the following text to German. Only provide the translation, no explanations or note:"
- Global hotkeys that work in any application
- Customizable language model selection
- Configurable text processing instructions
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.
- Built with Ollama