mirror of
https://github.com/hyprwm/hyprlang.git
synced 2026-05-05 23:48:00 +02:00
A read-only mirror of https://github.com/hyprwm/hyprlang
When parsing multiple special category blocks with different key values,
the second block would incorrectly overwrite the first instead of creating
a separate category entry.
Root cause:
When parsing a block like:
wallpaper {
monitor =
path = /path/image.png
}
wallpaper {
monitor = DP-1
path = /path/image.png
}
1. After closing the first block, `currentSpecialKey` resets to ""
2. When parsing `monitor = DP-1` in the second block, the code looks
for an existing category where key value == currentSpecialKey ("")
3. The first category's key value IS "", so it matches incorrectly
4. The second block overwrites the first, leaving only one category
The fix:
When looking for an existing category to reuse, check what field we're
parsing:
- If parsing the KEY field itself, match by the VALUE being set
- If parsing other fields, match by currentSpecialKey (existing behavior)
This ensures `monitor = DP-1` looks for a category with `monitor == "DP-1"`,
not `monitor == ""`, allowing empty string keys to work correctly alongside
non-empty keys.
This bug affects any hyprlang consumer using keyed special categories where
empty string is a valid key value (e.g., hyprpaper's wallpaper category
with `monitor =` for default/wildcard).
|
||
|---|---|---|
| .github/workflows | ||
| include | ||
| nix | ||
| src | ||
| tests | ||
| .clang-format | ||
| .clang-tidy | ||
| .gitignore | ||
| CMakeLists.txt | ||
| COPYRIGHT | ||
| flake.lock | ||
| flake.nix | ||
| hyprlang-docs | ||
| hyprlang.pc.in | ||
| LICENSE | ||
| README.md | ||
| VERSION | ||
hyprlang
The hypr configuration language is an extremely efficient, yet easy to work with, configuration language for linux applications.
It's user-friendly, easy to grasp, and easy to implement.
Building and installation
Building is done via CMake:
cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_INSTALL_PREFIX:PATH=/usr -S . -B ./build
cmake --build ./build --config Release --target hyprlang -j`nproc 2>/dev/null || getconf _NPROCESSORS_CONF`
Install with:
sudo cmake --install ./build
Example config
bakery {
counter_color = rgba(ee22eeff) # color by rgba()
door_color = rgba(122, 176, 91, 0.1) # color by rgba()
dimensions = 10 20 # vec2
employees = 3 # int
average_time_spent = 8.13 # float
hackers_password = 0xDEADBEEF # int, as hex
# nested categories
secrets {
password = hyprland # string
}
}
# variable
$NUM_ORDERS = 3
cakes {
number = $NUM_ORDERS # use a variable
colors = red, green, blue # string
}
# keywords, invoke your own handler with the parameters
add_baker = Jeremy, 26, Warsaw
add_baker = Andrew, 21, Berlin
add_baker = Koichi, 18, Morioh
Docs
Visit wiki.hypr.land/Hypr-Ecosystem/hyprlang/ to see the documentation.
Example implementation
For an example implementation, take a look at the tests/ directory.