style(custom): apply format and tidy cleanups

Run clang-format on the changed C++ files and fix the clang-tidy findings introduced by the custom command migration.

The only codegen-relevant change here is switching the new res assignments in custom.cpp to designated initializers. The rest is formatting only.

Signed-off-by: Austin Horstman <khaneliman12@gmail.com>
This commit is contained in:
Austin Horstman
2026-07-04 08:41:35 -05:00
committed by Austin Horstman
parent fc01c03a20
commit f987c24144
3 changed files with 8 additions and 9 deletions
+4 -4
View File
@@ -88,7 +88,7 @@ void waybar::modules::Custom::continuousWorker() {
continuous_stream_ = std::make_unique<util::command::LineStream>(
output_name_,
[this](const std::string& output) {
output_ = {0, output};
output_ = {.exit_code = 0, .out = output};
dp.emit();
},
[this](int exit_code) { handleContinuousProcessExit(exit_code); });
@@ -104,7 +104,7 @@ void waybar::modules::Custom::startContinuousProcess(bool throw_on_failure) {
if (throw_on_failure) {
throw std::runtime_error("Unable to open " + cmd + ": " + e.what().raw());
}
output_ = {1, ""};
output_ = {.exit_code = 1, .out = ""};
dp.emit();
spdlog::error("Unable to restart {}: {}", name_, e.what().raw());
scheduleContinuousRestart();
@@ -112,7 +112,7 @@ void waybar::modules::Custom::startContinuousProcess(bool throw_on_failure) {
if (throw_on_failure) {
throw;
}
output_ = {1, ""};
output_ = {.exit_code = 1, .out = ""};
dp.emit();
spdlog::error("Unable to restart {}: {}", name_, e.what());
scheduleContinuousRestart();
@@ -121,7 +121,7 @@ void waybar::modules::Custom::startContinuousProcess(bool throw_on_failure) {
void waybar::modules::Custom::handleContinuousProcessExit(int exit_code) {
if (exit_code != 0) {
output_ = {exit_code, ""};
output_ = {.exit_code = exit_code, .out = ""};
dp.emit();
spdlog::error("{} stopped unexpectedly, is it endless?", name_);
}
+3 -3
View File
@@ -91,9 +91,9 @@ void waybar::util::command::LineStream::start(const std::string& cmd) {
stop();
std::vector<std::string> argv{"/bin/sh", "-c", cmd};
Glib::spawn_async_with_pipes(
"", argv, Glib::SPAWN_DO_NOT_REAP_CHILD | Glib::SPAWN_CLOEXEC_PIPES,
sigc::bind(sigc::ptr_fun(&prepareChild), output_name_), &pid_, nullptr, &stdout_fd_, nullptr);
Glib::spawn_async_with_pipes("", argv, Glib::SPAWN_DO_NOT_REAP_CHILD | Glib::SPAWN_CLOEXEC_PIPES,
sigc::bind(sigc::ptr_fun(&prepareChild), output_name_), &pid_,
nullptr, &stdout_fd_, nullptr);
const auto flags = fcntl(stdout_fd_, F_GETFL, 0);
if (flags == -1 || fcntl(stdout_fd_, F_SETFL, flags | O_NONBLOCK) == -1) {
+1 -2
View File
@@ -33,8 +33,7 @@ auto run_stream_command(const std::string& cmd) -> StreamResult {
3000);
waybar::util::command::LineStream stream(
"",
[&](const std::string& line) { result.lines.push_back(line); },
"", [&](const std::string& line) { result.lines.push_back(line); },
[&](int exit_code) {
result.exit_code = exit_code;
loop->quit();