hyprconf2lua - Knowledge Base
Project: hyprconf2lua
Version: 1.7.0
Description: Convert Hyprland hyprlang .conf files to Lua .lua config format (v0.55+)
Maintainer: Prateek-squadron
License: MIT
Project Overview
hyprconf2lua is a converter that transforms Hyprland configuration files (.conf using hyprlang syntax) into Lua configuration files (.lua) compatible with Hyprland v0.55+.
The converter uses a pipeline architecture:
Input (.conf source)
├── lexer.py → tokenize source into tokens
├── parser.py → parse tokens into AST
├── codegen.py → generate Lua code from AST
└── Output (.lua)
Project Structure
hyprconf2lua/
├── README.md ← This knowledge base
├── pyproject.toml ← Package metadata, version 1.7.0
├── src/
│ ├── hyprconf2lua/
│ │ ├── __init__.py ← __version__ = "1.7.0"
│ │ ├── __main__.py ← Entry point: cli.main()
│ │ ├── cli.py ← CLI: argparse, file I/O, --check, --version
│ │ ├── converter.py ← Pipeline orchestrator: tokenize → parse → codegen
│ │ ├── codegen.py ← Code generator: AST → Lua string output
│ │ ├── lexer.py ← Regex-based tokenizer: 17 token types
│ │ ├── parser.py ← Recursive descent parser: 20+ parse methods
│ │ ├── ast.py ← 21 AST node dataclasses
│ │ ├── mappings.py ← Dispatcher maps, rule maps, flag mappings
│ │ └── mappings.py ← 5 mapping dicts (DISPATCHER_MAP, etc.)
│ └── tests/
│ ├── __init__.py
│ └── test_converter.py ← 106 tests passing
├── dist/ ← Built wheels and sdist
├── example/ ← Example hyprland.conf
├── hyprconf2lua.sh ← Shell wrapper to run without pip install
├── install.sh ← Symlinks hyprconf2lua.sh into PATH
├── LICENSE
├── README.md ← This knowledge base
└── README_kb.md ← (this file)
v1.7.0 Fixes (Released)
All issues from the open PRs have been resolved in release 1.7.0. Here's what was fixed:
#35 - 7 Bug Fixes
- Window rules: match/swap - match criteria and properties were swapped; now correctly separates
match:-prefixed criteria from property rules - Layer rules:
blur=on = trueinvalid Lua fixed; now emitsblur = true - Gestures: nested inside
hl.config()instead ofhl.gesture()→ now emitted as dedicatedhl.gesture({...})calls - Window move binds: emitted raw tables instead of
hl.dsp.window.move(); direction shorthand (l/r/u/d) expanded toleft/right/up/down - resizeactive binds: now maps to
hl.dsp.window.resize({ x, y, relative = true }) - Workspace-restore
+0:+0mapped toworkspace = "+0"instead ofdirection = "+0" - layoutmsg with trailing comment:
layoutmsg, # dwindleno longer parses argument asnil; flagged for manual review instead of crashing
#38 - Windowrule/Layerrule Multi-word Values
workspace = "3 silent"stays as string (not split into array)size = 700 600,move 100%-433 53,opacity 0.9 0.8→ arrays{700, 600},{100%-433, 53},{0.9, 0.8}
#39 - Animations Inside Sections
animation =,bezier =directives insideanimations {}now translate tohl.animation()/hl.curve()statements- on/off flag →
enabled = true/false - styles like
popin 87%preserved asstyle = "popin 87%" - Statements emitted outside the
hl.config({})table (valid Lua)
#40 - Stdin Hyphen Whitespace
grim -c -g "$(slurp)" - | satty --filename -preserves spaces around-and|- Before:
grim -c -g \"$(slurp)\"-| satty --filename-(spaces stripped)
#33 - Comma in Variable Values
$kbNextWs = Ctrl+Super, rightparses correctly →local kbNextWs = "Ctrl+Super, right"- Before:
kbNextWs = { }(empty table)
#32 - rgba() Color Parsing
shadow:color = rgba(0,0,0,0.85)parses correctly- Colon-paths expand to nested tables:
shadow = { color = "rgba(0,0,0,0.85)" }
#42 - movecurrentworkspacetomonitor Dispatcher
- New dispatcher:
hl.dsp.workspace.move({ monitor = "l" })
Test Results
- 106 tests passing (only pre-existing
test_cli_helpfails due to module not being installed in /usr/bin/python path) - All fixes verified against real-world hyprland configs
- Regressions: 0 (all existing tests continue to pass)
How to Build & Test
# From project root
python -m build # Build sdist + wheel
python -m pytest tests/ # Run all 106 tests
python -m hyprconf2lua # CLI help
# Example conversions
hyprconf2lua example/hyprland.conf
Guidelines for AI Agents Working on This Project
Code Style
- Follow existing patterns in
src/hyprconf2lua/ - Use
no_space_before/no_space_aftersets in_join_tokensfor consistent spacing - Keep
MULTI_VALUE_EFFECT_KEYS = {"move", "size", "opacity", "alpha"}for multi-word effect values - Dispatcher maps in
mappings.py- add new dispatchers there
Adding New Dispatchers
- Add to
DISPATCHER_MAPinmappings.pywith(func_string, needs_args) - Handle in
build_dispatcher()andbuild_dispatcher_args()incodegen.py - Add special cases for known patterns (e.g.,
+0→ workspace,l/r/u/d→ directions)
Adding New Rule Types
- Add to
WINDOW_RULE_MAPorLAYER_RULE_MAPinmappings.py - Handle in
visit_windowrule()/visit_layerrule()incodegen.py - Support both old-style (
rule, match:X) and new-style (match:key X) syntax
Adding New Animations/Beziers
- Add
enabledfield toAnimationDirectiveinast.py - Update
parse_animation()inparser.pyto extractenabled,stylefrom comma values - Update
visit_animation()incodegen.pyto usestmt.enabledandstmt.style - Ensure statements are emitted outside
hl.config({})table (seeemit_section_config)
Testing
- Run
python -m pytest tests/to verify all 106 tests pass - Add regression tests in
tests/test_converter.pyfor new fixes - Test with real hyprland configs via
hyprctl configerrors
Recent Changes History
| Version | Date | Key Fixes |
|---|---|---|
| 1.7.0 | 2026-08-24 | All 7 bugs from #35, #38, #39, #40, #33, #32 fixed |
| 1.6.0 | 2026-08-20 | #26-#29 (source path, hyphens, ${} syntax, multiline exec) |
| 1.5.0 | 2026-08-28 | #24/#25 (hyphen→underscore, $HOME→os.getenv) |
Contact & Support
- GitHub: https://github.com/Prateek-squadron/hyprconf2lua
- PyPI: https://pypi.org/project/hyprconf2lua/
- Issues: Use GitHub Issues for bug reports and feature requests
- IRC/Slack: #hyprland on Libera.Chat (project maintainer)
This knowledge base was created for the v1.7.0 release cycle. For the latest updates, check the GitHub repository.
Metadata
Release files for hyprconf2lua 1.8.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| hyprconf2lua-1.8.1.tar.gz | 32.1 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| hyprconf2lua-1.8.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 57.0 kB
Release files / hyprconf2lua-1.8.1.tar.gz
| Download URL | hyprconf2lua-1.8.1.tar.gz |
|---|---|
| Size | 32.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
304e465129759c7b39264e6dc2d436ac112ef32b7174abb76a59fae83b7b51f9
|
|
BLAKE2b-256 checksum How to use checksums |
04c64ef818d0918e3ba4965e29ed0c67d1874992d8f1547cd71494eb70b4f97a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.7
|
Release files / hyprconf2lua-1.8.1-py3-none-any.whl
| Download URL | hyprconf2lua-1.8.1-py3-none-any.whl |
|---|---|
| Size | 25.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a617b111f917e81f0b535b8c655f1e829aad290f9736c2b4850357b64bbbe49e
|
|
BLAKE2b-256 checksum How to use checksums |
ae12f640d62e7bfaeb586206fa960cd9845b4ac8cc2bfac2b5d0420ebda7a56e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.7
|
Security for hyprconf2lua 1.8.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.