AI Grammar for Hyprland and Omarchy Quattro
Correct or polish selected text with Gemini without leaving the application you are using. The project works as a standalone Hyprland helper and as an Omarchy Quattro bar plugin.
<p align="center"> <img src="assets/main-panel.png" alt="AI Grammar Main Panel" width="400"/> <img src="assets/settings-panel.png" alt="AI Grammar Settings" width="400"/> </p>The ✦ AI Grammar bar icon opens a small panel with quick text actions, custom prompts, and settings:
- Fix grammar corrects spelling and grammar while retaining the original wording, tone, slang, casing, and emojis.
- Enhance text corrects the text and improves clarity, flow, and vocabulary for its context.
- Quick Actions: Fix, Enhance, Formal, Casual, Summarize, Translate to Target, Translate to English.
- Custom Prompt: Type custom instructions (e.g. "format as bullet points").
Selected text is read from the Wayland primary selection first, then the regular clipboard. The response replaces the selected text by pasting it into the focused application.
Requirements
- A Wayland desktop
- A Gemini API key
wl-clipboard,wtype,jq,curl, andlibnotify
On Arch, CachyOS, or Omarchy:
sudo pacman -S --needed wl-clipboard wtype jq curl libnotify
Omarchy Quattro
Install the plugin directly from this repository:
omarchy plugin add https://github.com/ahasdemir/hypr-ai-grammar.git --enable
The plugin is placed in the right section of the Omarchy bar by default. Click the ✦ icon, select an action, and the selected text is processed in place.
Click the panel's ⚙ button to open settings. The built-in list starts with free-tier Gemini Flash and Flash-Lite models; gemini-3.6-flash is the default. Use Custom model to enter another Gemini model code supported by your account.
Configure the API key
Create a user configuration file. It remains outside the plugin repository and is never committed:
mkdir -p ~/.config/ai-grammar
cp .env.example ~/.config/ai-grammar/.env
Set the key in ~/.config/ai-grammar/.env:
GEMINI_API_KEY="your_gemini_api_key"
The script also accepts a GEMINI_API_KEY environment variable. A .env beside ai-grammar.sh is useful when running the repository checkout directly, but should remain untracked.
Bar placement and removal
# Move the icon anywhere in the bar.
omarchy bar move ahasdemir.ai-grammar --section right
# Remove the plugin and its local checkout.
omarchy plugin remove ahasdemir.ai-grammar
Keyboard shortcuts
The bar widget is optional. Add these bindings to ~/.config/hypr/bindings.lua to keep the original shortcuts under Omarchy Quattro:
o.bind(
"ALT + SPACE",
"AI grammar fixer",
"bash ~/.config/omarchy/plugins/ahasdemir.ai-grammar/ai-grammar.sh fix",
{ non_consuming = true }
)
o.bind(
"ALT + SHIFT + SPACE",
"AI text enhancer",
"bash ~/.config/omarchy/plugins/ahasdemir.ai-grammar/ai-grammar.sh enhance",
{ non_consuming = true }
)
Reload and validate the Hyprland configuration after editing it:
hyprctl reload
hyprctl configerrors
For legacy Hyprland .conf configurations, use the equivalent bindings:
binddn = ALT, SPACE, AI Grammar Fixer, exec, /path/to/ai-grammar.sh fix
binddn = ALT SHIFT, SPACE, AI Text Enhancer, exec, /path/to/ai-grammar.sh enhance
Standalone use
Clone the repository, configure .env, and run either mode manually:
git clone https://github.com/ahasdemir/hypr-ai-grammar.git
cd hypr-ai-grammar
cp .env.example .env
chmod +x ai-grammar.sh
# With text selected in the focused Wayland application:
./ai-grammar.sh fix
./ai-grammar.sh enhance
Privacy
The selected text is sent to the configured Google Gemini API endpoint for processing. Do not run the tool on secrets or other content you do not want to send to that service.