Commit graph

29 commits

Author SHA1 Message Date
John Mylchreest
0567ba7607
core/parser: correctly match keyed special categories by value being set (#89)
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).
2026-01-04 13:38:00 +01:00
EvilLary
eb5be96aa0
core: fix crash with same name special category and keyword (#87)
---------

Co-authored-by: Vaxry <vaxry@vaxry.net>
2025-11-28 16:52:41 +00:00
a318deec0c
core: fix dynamic env changes 2025-11-22 13:54:21 +00:00
b0d7b375a9
parser: fix lingering currentSpecialCat after dynamic calls 2025-11-13 17:42:52 +00:00
995db114b8
config: try variables before handlers if possible 2025-11-11 21:36:52 +00:00
Maximilian Seidler
4dafa28d4f
core: support nesting with special categories and fix explicit key + nested (#82) 2025-09-27 01:05:02 +02:00
Jonathan Steininger
163c83b3db
parser: Add ability to escape {{EXPRESSION}} syntax from #75 (#76) 2025-05-17 14:29:35 +02:00
a59e86a3da
parser: change expression syntax to avoid bash clashes
changes from $() to {{}} to avoid clashing with bash syntax
2025-05-07 23:03:03 +01:00
6726cfd54b
parser: add support for basic arithmetic
Adds support for  expressions that take left and right hand side and an operation (+-*/) -> e.g.

fixes #67
2025-05-07 17:50:22 +01:00
Honkazel
7a59f2de3f
core: clang-tidy and comp fixes (#63) 2025-02-08 01:44:54 +01:00
Joshua Baker
55608efdaa
core: add multiline support (#58)
Adds support for multi-line commands with a backslash
2024-12-28 13:36:59 +00:00
058fcf84c9 API: add a templated config value wrapper
This is basically a copy of the Hyprland config wrapper. It's much more straightforward to use, and much harder to fuck up.
2024-12-13 20:48:06 +00:00
Eduard Tykhoniuk
5b175c9704
config: Return an error on invalid hex values. (#54)
* config.cpp: fix parsing invalid hex
Instead of crashing on an invalid hex, return an error.

* config: return an error on an invalid hex value

* cleanup

* style: add references for catching exceptions

* style: ignore `std::out_of_range`
2024-09-02 00:45:17 +02:00
Eduard Tykhoniuk
c12ab785ce
config: fix parsing invalid hex (#53)
Instead of crashing on an invalid hex, return an error.
2024-09-01 12:57:32 +02:00
5df0174fd0 core: properly handle unscoped keywords
for users: prefix your keyword with : to make it only global scope
2024-07-07 21:42:53 +02:00
Aurélien Brabant
095f54b910
core: handle scoped keywords if flags are not allowed (#49)
* core: handle scoped keywords if flags are not allowed

* chore: formatting

* test: add test cases for unintended categoryKeyword config options

* fix: use at() instead of []
2024-07-07 18:05:23 +02:00
969cb076e5 dynamic: fix dynamic variables being blocked by flag keywords
fixes #45
2024-05-15 17:45:27 +01:00
95471ec86f core: allow specifying special keys with []
fixes #35
2024-03-28 16:44:44 +00:00
a2f3942114 core: fix recursive variables in RHS of variable assignment
fixes #33
2024-03-20 18:48:46 +00:00
221714841a core: fix value name in configSetValueSafe
fixes #29
2024-03-05 14:16:22 +00:00
bf5c561905 core: fix dynamic variable updates with special categories 2024-02-19 14:19:01 +00:00
378c3e273b API: add anonymous special categories 2024-02-17 22:38:10 +00:00
7b7e7cdd07 api: add listKeysForSpecialCategory 2024-02-17 19:01:35 +00:00
61507d1b87 tests: add dynamic special test 2024-02-15 02:44:25 +00:00
Zach DeCook
573cf83c51
core: Fix compilation and tests on 32bit architectures (#20)
* Fix compilation on 32-bit architectures

The 1234L suffix creates a 'long', which is not 64-bit on 32-bit architectures.

* Use stoll instead of stol to fix colors on 32-bit systems

on 32 bit systems, 'long' is 32 bits and 'long long' is 64 bits,
so the 'long long' functions need to be used.

* Fix rgba and rgb values on 32-bit

* Use a cast to Hyprlang::INT
2024-02-12 18:03:04 +00:00
7c5f672b2f internal: various stability improvements 2024-02-11 15:38:51 +00:00
c1f5b0ab48 internal: fix handling of escaped # 2024-02-10 01:50:22 +00:00
380453d389 Tests: fix for API change 2024-02-09 03:29:38 +00:00
Vaxry
1db2a12767
CI: add fuzzing and sanitizing (#5) 2023-12-31 16:51:50 +01:00