Commit Graph
223 Commits
Author SHA1 Message Date
Guillaume Maudoux a3dc55f9ee feat(format): expand pow_format modifiers
Extend the pow_format spec parser beyond alignment so configs can shape the
rendered number, not just pad it. A forced scale (#, k, M, G, T, P) pins the SI
prefix instead of auto-selecting it and, since the author then knows both scale
and unit, hides the prefix and unit by default; U brings the unit back, u hides
it in auto mode, and i forces integer display. b and B override the decimal or
binary base independently of the call site, and a trailing width now fixes the
coefficient field when a scale is forced, overflowing to '#' when it does not
fit.

The old '>' and '<' branches rendered via fmt::format("{}", s), which discarded
every new field on the recursive call; they now build from a single render path
that reads the current formatter, so modifiers survive alignment. The auto path
is byte-identical to before, verified against the previous implementation.

Adds a Catch2 suite covering each modifier alone and combined, plus the
backward-compatible alignment cases, and documents the modifiers in the network
and disk man pages.
2026-07-04 23:08:42 +02:00
Austin Horstman 2355486cb3 feat(util): add GLib command stream for nonblocking line reads
Add a small GLib-backed helper for command stdout that integrates with the main loop instead of blocking on getline() in a worker thread.

The helper keeps the existing child setup semantics used by Waybar commands, including process groups, parent-death signaling, and WAYBAR_OUTPUT_NAME propagation.

This is the foundation for moving long-running custom commands away from manual poll/read logic in the module itself.

Signed-off-by: Austin Horstman <khaneliman12@gmail.com>
2026-07-04 08:40:31 -05:00
Alex 8ff8ceeca2 fix(backlight): also match the leds subsystem for keyboard backlights
The backlight module only enumerated and monitored the udev "backlight"
subsystem, so keyboard-backlight LEDs in the "leds" class (e.g.
white:kbd_backlight, platform::kbd_backlight) were never discovered and
the module fell back to the default when pointed at one.

Enumerate and monitor the "leds" subsystem in addition to "backlight".
Those LEDs expose the same brightness/max_brightness attributes, so the
read path is unchanged. Each device now records its subsystem so the
login1 SetBrightness call targets the correct one. Automatic device
selection still prefers a "backlight" device and only falls back to a
"leds" device when named explicitly or when no screen backlight exists.

Fixes #2848.
2026-07-04 13:43:01 +02:00
Alex 3831524ba8 fix(audio_backend): never throw across the PulseAudio callback boundary
connectContext() throws std::runtime_error when pa_context_connect() fails.
It was called directly from contextStateCb (the libpulse mainloop thread,
running pure-C callback frames) on the PA_CONTEXT_FAILED reconnect path, so on
a pipewire/pulse restart the exception unwound across the C callback boundary
and triggered std::terminate/SIGABRT.

Add reconnectContext() noexcept which wraps connectContext() and logs failures
instead of throwing, and use it from the callback. Guard against the
FAILED -> connect -> FAILED recursion/busy loop with a reentrancy flag. The
constructor-time connectContext() still throws as before.

Fixes #5141.
2026-07-04 03:14:13 +02:00
Piotr Wegrzyn 810a8c0f94 feat(net): add {linkSpeed} format replacement
Adds an ethernet link speed ({linkSpeed}) read from
/sys/class/net/<iface>/speed, plus a skip-decimal option on pow_format
to drop a trailing .0. Rebased onto master's store-based network
formatting; existing compact bandwidth args updated for the new
pow_format signature.
2026-07-04 01:54:30 +02:00
Erik Reider eeb7bc702e Added GeoClue2 privacy item
Rebased onto current master and fixed the privacy module build:
- privacy_item.hpp no longer includes privacy.hpp (it does not use the
  Privacy class); this broke the circular include that left PrivacyItem
  undeclared when privacy.hpp was reached first from privacy_item.cpp.
- privacy_item.cpp now includes gtkmm/label.h explicitly, since Gtk::Label
  was previously only pulled in transitively via privacy.hpp.
2026-07-04 01:42:35 +02:00
Alex 5ad0eb3163 Merge remote-tracking branch 'origin/master' into pr-3421
# Conflicts:
#	src/modules/pulseaudio.cpp
2026-07-03 23:51:13 +02:00
Alexis Rouillard 87230211e0 Merge pull request #4907 from jaypikay/master
hostname dependend module
2026-07-03 23:12:46 +02:00
Alexis Rouillard d2a082933a Merge pull request #4908 from 7FM/master
pulseaudio: add target option to control source (microphone) volume
2026-07-03 23:12:36 +02:00
Alex 51a6ac0497 Merge remote-tracking branch 'origin/master' into pr/pulseaudio_mapping
# Conflicts:
#	src/util/audio_backend.cpp
2026-07-03 22:41:19 +02:00
Alex 21d222e8f7 Merge remote-tracking branch 'origin/master' into 7FM/master
# Conflicts:
#	include/modules/pulseaudio_slider.hpp
#	include/util/audio_backend.hpp
#	man/waybar-pulseaudio-slider.5.scd
#	src/modules/pulseaudio_slider.cpp
#	src/util/audio_backend.cpp
2026-07-03 22:29:33 +02:00
Alexis Rouillard 7c085c89a9 Merge branch 'master' into master 2026-07-03 22:22:43 +02:00
Alexis Rouillard fe653fef9d Merge branch 'master' into compact-bandwidth 2026-07-03 22:10:59 +02:00
Alex 504ebfba62 Merge remote-tracking branch 'origin/master' into finitemonkey/master 2026-07-03 21:49:16 +02:00
Alexis Rouillard e1efa7473d Merge pull request #4992 from VlkrS/openbsd
fix: USR1/USR2 handling on OpenBSD
2026-07-03 21:41:12 +02:00
Alexis Rouillard a02f943d8d Merge branch 'master' into fix-appearance-change-css-watching 2026-07-03 21:30:52 +02:00
Alexis Rouillard 2f3cae621f Merge branch 'master' into openbsd 2026-07-03 21:30:44 +02:00
Alexis Rouillard 2e0c34af5e Merge branch 'master' into fix/mpd-markup-truncation 2026-07-03 20:45:15 +02:00
Alexis Rouillard 3d64071bab Merge pull request #5108 from SaveTheRbtz/codex-json-parser-buffer
perf(json): parse directly from string buffers
2026-07-03 19:56:40 +02:00
Ibrahim Issa 4d1a561cdc feat(modules): pause background threads when display is asleep
Currently, modules polling hardware nodes continuously wake up kernel drivers even when the monitor is asleep (e.g., DPMS off), flooding dmesg.

- Adds 'disable-on-sleep' config flag
- Hooks GTK window map/unmap signals to track DPMS state
- Propagates suspend/resume calls to AModule worker threads
2026-07-03 18:44:03 +02:00
Alexey Ivanov 5cce616d3d perf(json): parse directly from string buffers 2026-06-04 15:03:40 -07:00
Siriusuna f8cc7173ca refactor: extract utf8 truncation logic to utility
Move the UTF-8 visual-width measurement and truncation helper functions
from the mpris module to a common utility
(include/util/utf8_string.hpp and src/util/utf8_string.cpp).

This decouples string truncation and width measurement
from the mpris module, allowing other modules (like mpd) to reuse.
The helper function `utf8_truncate` (formerly `truncate` in mpris)
and `utf8_width` is exported under the `waybar::util` namespace,
while the low-level `measure_and_truncate` (formerly `utf8_truncate`)
is encapsulated in an anonymous namespace in src/util/utf8_string.cpp
to avoid unnecessary API exposure.

No functional changes were made to the mpris module's behavior.
2026-05-22 02:52:40 +08:00
finitemonkey 0351ac8fb2 Additional options when muted for the PulseAudio-Slider module:
- Add "muted" class for styling the muted state.
- Add "zero-on-mute" boolean option to control slider position
  when muted.
- Add "unmute-on-volume-change" boolean option to control whether
  to automatically unmute when the volume changes.
2026-05-17 08:22:17 +01:00
Yui c81a039a55 feat: add compact versions of bandwidthBytes to network module
Adds the following:
- bandwidthDownByesCompact
- bandwidthUpByesCompact

Differences from normal version:
- drop the "/s" suffix
- drop the deciaml part if less than 1MB/s
2026-05-01 22:31:03 +03:00
Volker Schlecht 0241d0eac6 Remove redefinition or SIGRTMIN/SIGRTMAX for OpenBSD 2026-04-17 19:27:39 +02:00
Keepo a9aab4e356 fix: type consistency 2026-03-28 23:44:41 -04:00
Keepo 72d6a51fb7 fix: fix compile/run bugs from trying to be safer. rip 2026-03-28 23:26:34 -04:00
Keepo 3533265675 fix: removed unnecessary function, update header file for signature change. 2026-03-28 23:02:16 -04:00
Keepo 3b512d1a2c feat(client): add support for 8-bit hex color codes in CSS
This allows users to use #RRGGBBAA format in their style.css.
The client now detects 8-bit hex codes, transforms them into
GTK-compatible rgba() syntax, and loads the modified data
into the CSS provider.

- Added utility to detect 8-bit hex patterns.
- Added transformation logic to convert hex alpha to decimal.
- Intercepted CSS loading in Client::setupCss to handle the conversion.
2026-03-28 21:11:15 -04:00
7FM ab5b1a6cd4 pulseaudio: add target option to control source (microphone) volume
The pulseaudio/slider module had partial support for a "target" config
option but changeVolume() in the audio backend was hardcoded to only
modify sink volume. This adds full source volume control:

- Add AudioTarget enum (Sink/Source) to audio_backend
- Extend changeVolume() overloads with AudioTarget parameter
- Store and use pa_cvolume for source (with mono channel default)
- Add sourceVolumeModifyCb for source volume change confirmation
- Add "target" config option to the pulseaudio module for scroll control
- Document "target" in both pulseaudio and pulseaudio-slider man pages

Usage:
  "pulseaudio/slider#in": { "target": "source" }
  "pulseaudio#in": { "target": "source" }
2026-03-06 00:41:42 +01:00
jpk 88e1f85341 Simplified logic 2026-03-05 13:29:14 +01:00
jpk 5de21f4a07 Added support for hostname based module addition 2026-03-05 09:04:21 +01:00
Alexis Rouillard 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
Alexis Rouillard 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
Austin Horstman 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
Austin Horstman 5e7dbf1715 fix(command): return non-zero when child exec fails
Child exec failure paths were returning success, which masked command launch
errors from callers.

I switched the child-side failure exits to _exit(127) and added errno-specific
logging so failures propagate with actionable diagnostics.

Signed-off-by: Austin Horstman <khaneliman12@gmail.com>
2026-03-02 08:41:43 -06:00
Austin Horstman 6dfe1c3111 feat(util): add ScopedFd RAII utility for file descriptors
Signed-off-by: Austin Horstman <khaneliman12@gmail.com>
2026-03-02 08:21:12 -06:00
Alexis Rouillard 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
Austin Horstman 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
Austin Horstman 44eed7afea fix(sleeper-thread): synchronize control flags with atomics
SleeperThread control flags were shared across threads without consistent
synchronization.

I converted the run/signal flags to atomics and updated wait predicates and
lifecycle transitions to use explicit atomic loads/stores.

Signed-off-by: Austin Horstman <khaneliman12@gmail.com>
2026-02-28 22:47:52 -06:00
Austin Horstman dbbad059f7 fix(sleeper-thread): stop and join before worker reassignment
Reassigning SleeperThread could replace a joinable std::thread and trigger
std::terminate.

I now stop and join any existing worker before reassignment, then reset control
state before starting the replacement worker.

Signed-off-by: Austin Horstman <khaneliman12@gmail.com>
2026-02-28 22:28:22 -06:00
Alex ef3d55980e fix: some crashes 2026-02-24 00:49:08 +01:00
BBaoVanC 55fa8cf185 Make CssReloadHelper watch CSS new style on appearance change
If you have reload_style_on_change enabled, and use dynamic appearance
styling (style-dark.css and style-light.css), then changing the
appearance doesn't update the files that are being watched for reload.

Add a method to CssReloadHelper to change the CSS file being watched,
and also provide the CSS file as a parameter to the callback so setupCss
can be called on the right file when the file watcher triggers.
2026-02-21 21:42:34 -06:00
Austin Horstman 3b478ee6a5 chore: format
Some unrelated files failed formatting.

Signed-off-by: Austin Horstman <khaneliman12@gmail.com>
2026-02-09 15:53:44 -06:00
copilot-swe-agent[bot]andAlexays 65e708779b Fix function overload order to resolve compilation error
Co-authored-by: Alexays <13947260+Alexays@users.noreply.github.com>
2026-02-04 09:26:20 +00:00
copilot-swe-agent[bot]andAlexays 04766452b4 Use idiomatic empty() check for strings
Co-authored-by: Alexays <13947260+Alexays@users.noreply.github.com>
2026-02-04 09:15:25 +00:00
copilot-swe-agent[bot]andAlexays c4982efa95 Add output_name parameter to forkExec for WAYBAR_OUTPUT_NAME env var
Co-authored-by: Alexays <13947260+Alexays@users.noreply.github.com>
2026-02-04 09:14:45 +00:00
Alex 47fb21a2c1 chore: upgrade to clang-format@21 2026-02-04 09:24:14 +01:00
xander1421 1639dec7d8 fix(json): use local CharReaderBuilder for thread safety 2026-01-24 23:40:07 +02:00
schmop 4e25871655 Reapply "Make battery module update on plugging/unplugging again (refs #2519)"
This reverts commit bb2c67ebad.
2025-10-31 13:43:36 +01:00