Converts Hyprlang .conf files to the Hyprland .lua config format (v0.55+).
cargo install hypr2luahypr2lua <input.conf> [output.lua]If no output path is given, the input file's extension is replaced with .lua.
| Hyprlang (.conf) | Lua (.lua) |
|---|---|
# comment |
-- comment |
$mod = SUPER |
local mod = "SUPER" |
$mod references |
resolved inline |
section { key = val } |
hl.set { section = { key = val } } |
dotted.key = val |
nested tables |
bind = MOD, K, exec, cmd |
hl.bind("MOD", "K", "exec", "cmd") |
bindl/bindm/bindr/bindle/bindlr |
hl.bindl/bindm/bindr/bindle/bindlr(...) |
bindd/bindeld/bindld/binddr/bindmd |
hl.bindd/bindeld/bindld/binddr/bindmd(...) |
exec-once = cmd |
hl.exec_once("cmd") |
exec = cmd |
hl.exec("cmd") |
windowrule = rule, match |
hl.windowrule("rule", "match") |
windowrulev2 = rule, match |
hl.windowrulev2("rule", "match") |
windowrule { ... } block |
hl.windowrule { ... } with nested match table |
monitor = ... |
hl.monitor(...) |
bezier = ... |
hl.bezier(...) |
animation = ... |
hl.animation(...) |
workspace = ... |
hl.workspace(...) |
layerrule = ... |
hl.layerrule(...) |
env = KEY,VALUE |
hl.env("KEY", "VALUE") |
unbind = ... |
hl.unbind(...) |
source = path/to/file.conf |
require("path/to/file") |
autogenerated = 1 |
stripped |
cargo build --releaseThe binary is at target/release/hypr2lua.
Input (hyprland.conf):
$mod = SUPER
$terminal = kitty
general {
gaps_in = 5
gaps_out = 20
border_size = 2
}
bind = $mod, Q, exec, $terminal
exec-once = waybar
source = ~/.config/hypr/colors.conf
Output (hyprland.lua):
-- Generated by hypr2lua from hyprlang .conf
-- Hyprland Lua config (v0.55+)
local mod = "SUPER"
local terminal = "kitty"
hl.set {
general = {
gaps_in = 5,
gaps_out = 20,
border_size = 2,
},
}
hl.bind("SUPER", "Q", "exec", "kitty")
hl.exec_once("waybar")
require("~/.config/hypr/colors")Add to your Cargo.toml:
[dependencies]
hypr2lua = "0.1"use hypr2lua::{parse, generate};
let conf = r#"
$mod = SUPER
general {
gaps_in = 5
}
bind = $mod, Q, exec, foot
"#;
let nodes = parse(conf);
let lua = generate(&nodes);
println!("{}", lua);MIT