Don't attempt to use niri modules when socket connection fails. Prevents
rendering modules when running another compositor. In same concept as
previous Hyprland change
4295faa7c4
Signed-off-by: Austin Horstman <khaneliman12@gmail.com>
The keyboard-state module crashes with SIGSEGV in libinput_device_ref
when a new input device appears in /dev/input/.
Three bugs fixed:
1. Missing NULL check: tryAddDevice() calls libinput_path_add_device()
which returns NULL on failure, then immediately passes the result to
libinput_device_ref() without checking. On laptops, virtual input
devices (power buttons, lid switch, etc.) appear and disappear in
/dev/input/ triggering the hotplug handler; if libinput can't open
one of these, the NULL return causes the segfault.
2. Missing cleanup on device removal: The IN_DELETE handler erased
devices from the map without calling libinput_path_remove_device(),
leaving dangling pointers in the libinput context.
3. Thread safety: libinput_devices_ was accessed from 3 threads
(main/GTK, libinput_thread_, hotplug_thread_) without any mutex.
Fixes#4851
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
PR #4390 enabled millisecond intervals but changed image interval parsing so a missing interval could resolve to 1ms. That creates a hot update loop and can spike CPU and destabilize rendering in drawer/group setups (issue #4835).
Use explicit semantics: missing, null, non-numeric, or <=0 interval is treated as "once" (max sleep), while positive numeric values still support ms precision with a 1ms floor. This keeps the intended feature (sub-second polling when requested) without defaulting to busy looping.
Also align waybar-image(5) docs with runtime behavior.
Signed-off-by: Austin Horstman <khaneliman12@gmail.com>
- Acquire lock once at start of update() and hold for entire function
- Remove redundant lock from queryActiveWorkspace() since it's only called from update()
This addresses code review feedback and makes the locking strategy clearer
Co-authored-by: Alexays <13947260+Alexays@users.noreply.github.com>
Changed approach per maintainer feedback - instead of caching signal values,
just add isInt() check before accessing config_["signal"].asInt() in refresh()
methods. This is simpler and more minimal.
Co-authored-by: Alexays <13947260+Alexays@users.noreply.github.com>
- Move GTK operations from IPC thread to GTK main thread in Window module
- Move GTK operations from IPC thread to GTK main thread in WindowCount module
- Move GTK style class operations from IPC thread to GTK main thread in Submap module
- Language and Workspaces modules already safe (only update internal state)
Co-authored-by: Alexays <13947260+Alexays@users.noreply.github.com>
Cache signal value during module construction to avoid accessing JSON config
in signal handler context. This prevents crashes when signal field is missing
or not an integer type.
- Custom module: Cache signal_ value in constructor
- Image module: Cache signal_ value in constructor
- Both modules: Use cached value in refresh() method
Co-authored-by: Alexays <13947260+Alexays@users.noreply.github.com>