49 Commits

Author SHA1 Message Date
0a35b86e20 fix(hyprland/ipc): honor the requested instance signature
The Hyprland IPC helper cached the socket folder with the first instance
signature already appended, so later calls ignored their instanceSig argument
and always reused the first path. That made the helper violate its own API even
though most real Waybar sessions only talk to a single Hyprland instance.

Cache only the base socket directory and append the requested signature per
lookup. This fixes correctness for tests, nested or debug multi-instance
setups, and future code that needs to resolve a different signature, without
claiming support for one Waybar process managing multiple Hyprland sessions.

Signed-off-by: Austin Horstman <khaneliman12@gmail.com>
2026-03-07 21:06:30 -06:00
790101f824 chore: format
Signed-off-by: Austin Horstman <khaneliman12@gmail.com>
2026-03-06 18:49:02 -06:00
100d4ec4a4 Merge pull request #4891 from khaneliman/bugfix/stab-003-test-001-hyprland-ipc
fix(hyprland-ipc): harden fd lifecycle and listener loop
2026-03-04 22:41:30 +01:00
b31292dee2 Merge pull request #4898 from khaneliman/memory
perf(memory): optimize string operations; remove deep copies, memdup, and icon theme rescanning
2026-03-04 22:40:55 +01:00
4c71b2bf9f perf(memory): optimize C++ string operations to reduce heap fragmentation
- Replaced pass-by-value std::string parameters with const std::string&
or std::string_view to prevent SSO overallocations.

- Refactored static mapping functions in UPower to return
std::string_view instead of constructing std::string literals, enabling
perfect cache locality.

- Optimized string concatenation in hot loops (network IPs, inhibitor
lists, sway window marks) by using std::string::append() and
pre-reserving capacity instead of overloaded operator+ which produces
temporary heap instances.

These optimizations reduce high-frequency memory churn and overall heap
fragmentation within the main rendering loops.

Signed-off-by: Austin Horstman <khaneliman12@gmail.com>
2026-03-02 22:54:07 -06:00
79fb1d9f58 test(command): cover exec failure paths
Command tests did not assert behavior when exec fails in child processes.

I added deterministic regression coverage that forces execl/execlp failure and
verifies non-zero exit status propagation for both open() and forkExec paths.

Signed-off-by: Austin Horstman <khaneliman12@gmail.com>
2026-03-02 08:44:54 -06:00
04ddc5fd23 chore(test-hyprland): remove unused IPC test fixture
The hyprland IPC fixture was no longer used by the current test setup.

I removed the dead fixture so the test code reflects the actual execution path
and is easier to maintain.

Signed-off-by: Austin Horstman <khaneliman12@gmail.com>
2026-03-02 08:17:29 -06:00
87a5b7ed0f test(hyprland): add failure-path fd-leak coverage
Hyprland tests did not explicitly verify descriptor behavior on key failure
paths.

I added focused tests for missing instance signature and connect-failure paths
that assert file descriptor counts stay stable across repeated attempts.

Signed-off-by: Austin Horstman <khaneliman12@gmail.com>
2026-03-02 08:17:29 -06:00
fd086d0f33 Merge pull request #4890 from khaneliman/bugfix/perf-001-safe-signal-bounded-queue
fix(util): bound SafeSignal queue growth under burst load
2026-03-01 18:19:25 +01:00
e4ff024fa8 fix(util): bound SafeSignal queue growth under burst load
SafeSignal could queue events forever when worker threads emitted faster than
the main loop could consume, which risks memory growth and stale updates.

I added a queue cap with a drop-oldest policy so growth stays bounded under
burst load, plus a regression test that validates bounded delivery.

Signed-off-by: Austin Horstman <khaneliman12@gmail.com>
2026-02-28 22:57:49 -06:00
864523772d test(utils): stress SleeperThread wake and stop control flow
SleeperThread concurrency paths needed stress coverage around wake/stop races.

I added a subprocess stress test that repeatedly interleaves wake_up() and
stop() and verifies the worker exits cleanly.

Signed-off-by: Austin Horstman <khaneliman12@gmail.com>
2026-02-28 22:47:52 -06:00
1c61ecf864 test(utils): add SleeperThread reassignment regression
We needed a regression test for reassignment safety after lifecycle fixes.

I added a subprocess test that reassigns SleeperThread workers and verifies the
process exits normally instead of terminating.

Signed-off-by: Austin Horstman <khaneliman12@gmail.com>
2026-02-28 22:47:52 -06:00
47fb21a2c1 chore: upgrade to clang-format@21 2026-02-04 09:24:14 +01:00
691e66a7fd tests: additional tests for bugfix (#4354) 2025-08-13 10:30:25 +03:00
e4dd2ecc5a refactor: avoid namespace pollution in util/date.hpp 2025-06-22 00:50:25 -04:00
6417782af6 chore: lint 2024-09-13 08:55:14 +02:00
4295faa7c4 hyprland/backend: throw runtime_error instead of log
Allows us to disable modules entirely when socket connection isn't
working. This is similar to how sway handles their socket connections
disabling modules. This supports a single waybar config for multiple
IPCs.
2024-07-16 18:40:47 -05:00
c08660d837 modules/hyprland/backend: handle empty json responses
Fixes https://github.com/Alexays/Waybar/issues/3388
2024-06-28 13:18:44 -05:00
b114b1155c treewide: clang-format 2024-06-15 18:44:46 -05:00
0bc43c1aa7 fix: lint 2024-06-12 23:08:27 +02:00
b365831839 test/hyprland/backend: fix 2024-06-09 13:04:09 -05:00
58e7abba2c tests: split into separate binaries 2024-06-08 22:43:48 -05:00
87eaa75b8a test/hyprland/backend: init 2024-06-08 22:43:48 -05:00
749f46f86f test/fixtures: Add GlibTestsFixture 2024-06-08 22:18:23 -05:00
e1a6d513cc test/config: add hyprland-workspaces config 2024-06-07 13:56:49 -05:00
5d6acfd1d4 test: restore compatibility with older Catch2 releases 2024-02-19 17:00:01 -08:00
c2f37705ad build: address meson deprecation warnings:
- `ExternalProgram.path`
- `dependency.get_pkgconfig_variable`
- `meson.build_root`
- `meson.source_root`
2024-02-17 08:45:16 -08:00
1dce607c42 Merge pull request #2852 from dpayne/add_css_reload
Adding css reloader
2024-01-29 22:44:29 +01:00
10cb4180f6 * Fixing clang tidy comments
* Fixing missing includes
* Fixing formatting
2024-01-28 14:44:25 -08:00
f7eca99496 Using Gio::FileMonitor for watching style changes 2024-01-21 20:49:13 -08:00
d7ed4f1fa8 Adding css reloader 2024-01-21 18:23:46 -08:00
8f5d0098d6 Fixed json parsing with hexadecimal characters
* replace \x with \u00 to follow JSON spec
* fixes #2475 and #2495
* added unit tests for json parsing
2024-01-14 14:06:06 +01:00
86a38980e4 c++20. clock chrono API. STL + format
Signed-off-by: Viktar Lukashonak <myxabeer@gmail.com>
2023-11-10 17:57:26 +03:00
c26849217e test:Add test for output config with multiple exclusion/wildcard 2023-03-13 00:49:18 +00:00
6225db0a48 test: refactor date formatter tests.
- Add tests for global locale.
- Warn about missing locales.
- Downgrade REQUIRE to CHECK.
- Skip tests if localized formatting does not work as expected.
2023-01-21 02:18:43 -08:00
67efe1af89 refactor(clock): remove struct waybar_time
The structure was used to pass the locale instance to the date
formatter. All the supported versions of `fmt` are passing the locale
parameter via `FormatContext.locale()` so we can remove the struct and
simplify the code.

While we at it, drop `date::make_zoned` in favor of CTAD on a
`date::zoned_time` constructor.
2023-01-20 22:50:01 -08:00
43d52c59d9 test: fix build with Catch2 v2.x
Use smaller includes for Catch2 v3.
2023-01-20 22:49:59 -08:00
1db3c55b48 Fix build with catch2>=3.0.0 2022-10-16 19:21:43 +05:30
f2fcadbf62 refactor: lint 2022-04-06 08:37:19 +02:00
766c8a1035 test: add tests for waybar_time formatter 2022-01-07 22:33:50 -08:00
8c41aaae04 refactor(test): use single executable 2022-01-07 19:21:51 -08:00
4b5dc1bb3a test: count copies and moves done by SafeSignal 2021-11-28 09:52:18 -08:00
3e2197a82a test(util): add tests for SafeSignal
Add a fixture for writing tests that require interaction with Glib event
loop and a very basic test for SafeSignal.
2020-12-28 17:28:03 -08:00
f18eb71ad7 Fix spelling errors
Signed-off-by: Elyes HAOUAS <ehaouas@noos.fr>
2021-10-02 18:13:17 +02:00
0c1d3e30b6 fix(config): preserve explicit null when merging objects 2021-09-15 22:20:44 +07:00
ccc60b4245 refactor(config): more sensible multi-bar include behavior 2021-09-15 22:15:27 +07:00
8912bd3ed0 test: multi-bar config with includes 2021-09-15 21:34:56 +07:00
9f3b34e4d9 test: validate configuration load 2021-09-15 21:34:55 +07:00
6eba62f060 test: add build configs for catch2 2021-09-15 21:34:55 +07:00