From be9d9c87e6b3ad2a53413e24cd2612de5a7364b2 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 4 Feb 2026 09:06:33 +0000 Subject: [PATCH 1/5] Initial plan From 68d3e13fdd9e2d1109de08ec6cf20d46aaf5d91d Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 4 Feb 2026 09:09:44 +0000 Subject: [PATCH 2/5] Fix menu freezing when launching applications Co-authored-by: Alexays <13947260+Alexays@users.noreply.github.com> --- src/ALabel.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ALabel.cpp b/src/ALabel.cpp index 4e6d3349..598d016f 100644 --- a/src/ALabel.cpp +++ b/src/ALabel.cpp @@ -190,7 +190,7 @@ bool waybar::ALabel::handleToggle(GdkEventButton* const& e) { } void ALabel::handleGtkMenuEvent(GtkMenuItem* /*menuitem*/, gpointer data) { - waybar::util::command::res res = waybar::util::command::exec((char*)data, "GtkMenu"); + waybar::util::command::forkExec((char*)data); } std::string ALabel::getState(uint8_t value, bool lesser) { From c4982efa951d9b0b37232ca28a0fa883cdda31f0 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 4 Feb 2026 09:14:45 +0000 Subject: [PATCH 3/5] Add output_name parameter to forkExec for WAYBAR_OUTPUT_NAME env var Co-authored-by: Alexays <13947260+Alexays@users.noreply.github.com> --- include/util/command.hpp | 7 +++++++ src/ALabel.cpp | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/include/util/command.hpp b/include/util/command.hpp index 4b9decaa..4348845a 100644 --- a/include/util/command.hpp +++ b/include/util/command.hpp @@ -139,6 +139,10 @@ inline struct res execNoRead(const std::string& cmd) { } inline int32_t forkExec(const std::string& cmd) { + return forkExec(cmd, ""); +} + +inline int32_t forkExec(const std::string& cmd, const std::string& output_name) { if (cmd == "") return -1; pid_t pid = fork(); @@ -157,6 +161,9 @@ inline int32_t forkExec(const std::string& cmd) { err = pthread_sigmask(SIG_UNBLOCK, &mask, nullptr); if (err != 0) spdlog::error("pthread_sigmask in forkExec failed: {}", strerror(err)); setpgid(pid, pid); + if (output_name != "") { + setenv("WAYBAR_OUTPUT_NAME", output_name.c_str(), 1); + } execl("/bin/sh", "sh", "-c", cmd.c_str(), (char*)0); exit(0); } else { diff --git a/src/ALabel.cpp b/src/ALabel.cpp index 598d016f..d251d896 100644 --- a/src/ALabel.cpp +++ b/src/ALabel.cpp @@ -190,7 +190,7 @@ bool waybar::ALabel::handleToggle(GdkEventButton* const& e) { } void ALabel::handleGtkMenuEvent(GtkMenuItem* /*menuitem*/, gpointer data) { - waybar::util::command::forkExec((char*)data); + waybar::util::command::forkExec((char*)data, "GtkMenu"); } std::string ALabel::getState(uint8_t value, bool lesser) { From 04766452b4e3b0e0bcfcb073b6d857ffbca41abf Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 4 Feb 2026 09:15:25 +0000 Subject: [PATCH 4/5] Use idiomatic empty() check for strings Co-authored-by: Alexays <13947260+Alexays@users.noreply.github.com> --- include/util/command.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/util/command.hpp b/include/util/command.hpp index 4348845a..0023df83 100644 --- a/include/util/command.hpp +++ b/include/util/command.hpp @@ -109,7 +109,7 @@ inline FILE* open(const std::string& cmd, int& pid, const std::string& output_na ::close(fd[0]); dup2(fd[1], 1); setpgid(child_pid, child_pid); - if (output_name != "") { + if (!output_name.empty()) { setenv("WAYBAR_OUTPUT_NAME", output_name.c_str(), 1); } execlp("/bin/sh", "sh", "-c", cmd.c_str(), (char*)0); @@ -161,7 +161,7 @@ inline int32_t forkExec(const std::string& cmd, const std::string& output_name) err = pthread_sigmask(SIG_UNBLOCK, &mask, nullptr); if (err != 0) spdlog::error("pthread_sigmask in forkExec failed: {}", strerror(err)); setpgid(pid, pid); - if (output_name != "") { + if (!output_name.empty()) { setenv("WAYBAR_OUTPUT_NAME", output_name.c_str(), 1); } execl("/bin/sh", "sh", "-c", cmd.c_str(), (char*)0); From 65e708779b4a08937e7fa219ef466375454b6d89 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 4 Feb 2026 09:26:20 +0000 Subject: [PATCH 5/5] Fix function overload order to resolve compilation error Co-authored-by: Alexays <13947260+Alexays@users.noreply.github.com> --- include/util/command.hpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/include/util/command.hpp b/include/util/command.hpp index 0023df83..58c59a96 100644 --- a/include/util/command.hpp +++ b/include/util/command.hpp @@ -138,10 +138,6 @@ inline struct res execNoRead(const std::string& cmd) { return {WEXITSTATUS(stat), ""}; } -inline int32_t forkExec(const std::string& cmd) { - return forkExec(cmd, ""); -} - inline int32_t forkExec(const std::string& cmd, const std::string& output_name) { if (cmd == "") return -1; @@ -176,4 +172,8 @@ inline int32_t forkExec(const std::string& cmd, const std::string& output_name) return pid; } +inline int32_t forkExec(const std::string& cmd) { + return forkExec(cmd, ""); +} + } // namespace waybar::util::command