greenfieldintermediate30 minutes

Hyprland Keybinding Popup with LLM-Generated Documentation

Create an automatically generated, popup-accessible keybinding reference for Hyprland window manager using LLM tools. This workflow extracts keybindings from your Hyprland configuration and presents them in a clean, organized popup window.

Pedram Navid
Pedram Navid
176 views0 saves

Tools & Prerequisites

Required Tools

Hyprland(Window Manager)
llm(AI Assistant)
yad(GUI Dialog Tool)

Optional Tools

Arch Linux(Operating System)
uv(Package Manager)

Step-by-Step Guide

1

Install Prerequisites

Install the required tools: llm from datasette and yad

Code Example

# Install llm tool
uv tool install llm

# Install yad (on Arch Linux)
pacman -S yad

Pro Tip

Visit https://llm.datasette.io/en/stable/ for more information about the llm tool

2

Create the Update Script

Create a file called update-shortcut.sh that will analyze your Hyprland configuration and generate the shortcuts reference

Prompt Template

Analyze this Hyprland configuration and create a well-formatted shortcuts reference.
Focus on window management keybindings only.

Extract and organize these categories:
1. WINDOW ACTIONS (close, float, pseudo, split)
2. FOCUS MOVEMENT 
3. WINDOW MOVEMENT (swapping)
4. WINDOW RESIZING
5. WORKSPACE MANAGEMENT
6. Any other window-related bindings

Format the output as a clean text file with:
- Clear section headers
- Aligned keybinding descriptions
- Use arrow symbols (←→↑↓) for arrow keys
- Note: $mainMod means Super key

Start with 'HYPRLAND WINDOW MANAGEMENT SHORTCUTS' as the title.
Include a separator line of equals signs.
Make it easy to read in a popup dialog.

Code Example

#!/bin/bash
# Script to automatically update window-shortcuts.txt by analyzing hyprland.conf

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
CONFIG_FILE="$SCRIPT_DIR/hyprland.conf"
OUTPUT_FILE="$SCRIPT_DIR/window-shortcuts.txt"

# Check if config file exists
if [ ! -f "$CONFIG_FILE" ]; then
    echo "Error: hyprland.conf not found at $CONFIG_FILE"
    exit 1
fi

# Check if llm command is available
if ! command -v llm &> /dev/null; then
    echo "Error: 'llm' command not found. Please install it first."
    exit 1
fi

echo "Analyzing Hyprland configuration..."

# Extract relevant keybindings and send to Claude
cat "$CONFIG_FILE" | llm "
Analyze this Hyprland configuration and create a well-formatted shortcuts reference.
Focus on window management keybindings only.

Extract and organize these categories:
1. WINDOW ACTIONS (close, float, pseudo, split)
2. FOCUS MOVEMENT 
3. WINDOW MOVEMENT (swapping)
4. WINDOW RESIZING
5. WORKSPACE MANAGEMENT
6. Any other window-related bindings

Format the output as a clean text file with:
- Clear section headers
- Aligned keybinding descriptions
- Use arrow symbols (←→↑↓) for arrow keys
- Note: \$mainMod means Super key

Start with 'HYPRLAND WINDOW MANAGEMENT SHORTCUTS' as the title.
Include a separator line of equals signs.
Make it easy to read in a popup dialog.
" > "$OUTPUT_FILE"

if [ $? -eq 0 ]; then
    echo "Successfully updated $OUTPUT_FILE"
    echo "You can view it with: Super+F1"
else
    echo "Error: Failed to update shortcuts file"
    exit 1
fi
3

Generate the Shortcuts Reference

Run the update script to generate the window-shortcuts.txt file

Code Example

./update-shortcuts.sh

Pro Tip

Make sure the script is executable with: chmod +x update-shortcuts.sh

4

Add Hyprland Keybinding

Add a keybinding to your Hyprland configuration to display the shortcuts popup

Code Example

bind = $mainMod, F1, exec, cat /path/to/window-shortcuts.txt | yad --text-info --title="Hyprland Shortcuts" --width=600 --height=500

Pro Tip

Replace '/path/to/' with the actual path to your window-shortcuts.txt file. The fallback terminal option ensures the shortcuts can be viewed even if yad fails.

This workflow sets up an automated system to extract and display Hyprland window manager keybindings in a popup window, similar to AwesomeWM's hotkeys popup. It uses an LLM tool to analyze your Hyprland configuration file and generate a well-formatted shortcuts reference that can be displayed on-demand.

Overview

The workflow involves:

  1. Installing required tools (llm from datasette and yad)
  2. Creating a bash script that uses LLM to analyze your Hyprland config
  3. Generating a formatted shortcuts reference file
  4. Setting up a keybinding to display the shortcuts in a popup

Benefits

  • Automatically stays in sync with your Hyprland configuration
  • Provides a clean, organized view of all window management shortcuts
  • Accessible via a simple keybinding (Super+F1)
  • Uses AI to intelligently categorize and format the keybindings

Discussion (0)

Comments coming soon!