From 2eb415547a3baf70e1d57cbea3fa62f7c5d65593 Mon Sep 17 00:00:00 2001 From: callmejoe <37476191+mrsteve0924@users.noreply.github.com> Date: Sat, 13 Jun 2026 22:42:23 -0400 Subject: [PATCH 1/2] refresh icons at the same period interval as command_output Reload icons specified by a filesystem path after command execution completes. This allows dynamic icons such as album art to update on the widget refresh interval while preserving the original behavior for static theme icons. --- src/panel/widgets/command-output.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/panel/widgets/command-output.cpp b/src/panel/widgets/command-output.cpp index 9ca35f21..3904b5cd 100644 --- a/src/panel/widgets/command-output.cpp +++ b/src/panel/widgets/command-output.cpp @@ -14,7 +14,8 @@ #include "command-output.hpp" static sigc::connection label_set_from_command(std::string command_line, - Gtk::Label& label) + Gtk::Label& label, Gtk::Image* icon = nullptr, + const std::string& icon_name = "") { command_line = "/bin/sh -c \"" + command_line + "\""; @@ -23,6 +24,7 @@ static sigc::connection label_set_from_command(std::string command_line, Glib::spawn_async_with_pipes("", Glib::shell_parse_argv(command_line), Glib::SpawnFlags::DO_NOT_REAP_CHILD | Glib::SpawnFlags::SEARCH_PATH_FROM_ENVP, Glib::SlotSpawnChildSetup{}, &pid, nullptr, &output_fd, nullptr); + return Glib::signal_child_watch().connect([=, &label] (Glib::Pid pid, int exit_status) { FILE *file = fdopen(output_fd, "r"); @@ -43,6 +45,14 @@ static sigc::connection label_set_from_command(std::string command_line, } label.set_markup(output); + + if (icon && + !icon_name.empty() && + (icon_name[0] == '/' || + icon_name.rfind("~/", 0) == 0)) + { + IconProvider::image_set_icon(*icon, icon_name); + } }, pid); } @@ -101,7 +111,7 @@ WfCommandOutputButtons::CommandOutput::CommandOutput(const std::string & name, const auto update_output = [=] () { command_sig.disconnect(); - command_sig = label_set_from_command(command, main_label); + command_sig = label_set_from_command(command, main_label, &icon, icon_name); }; signals.push_back(signal_clicked().connect(update_output)); From 113caa5cb7c20a2b61f0a80296667e1dc82b0a55 Mon Sep 17 00:00:00 2001 From: callmejoe Date: Sun, 21 Jun 2026 12:17:48 -0400 Subject: [PATCH 2/2] Apply uncrustify formatting --- src/panel/widgets/command-output.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/panel/widgets/command-output.cpp b/src/panel/widgets/command-output.cpp index 3904b5cd..5e5d4f04 100644 --- a/src/panel/widgets/command-output.cpp +++ b/src/panel/widgets/command-output.cpp @@ -14,7 +14,7 @@ #include "command-output.hpp" static sigc::connection label_set_from_command(std::string command_line, - Gtk::Label& label, Gtk::Image* icon = nullptr, + Gtk::Label& label, Gtk::Image *icon = nullptr, const std::string& icon_name = "") { command_line = "/bin/sh -c \"" + command_line + "\""; @@ -47,12 +47,12 @@ static sigc::connection label_set_from_command(std::string command_line, label.set_markup(output); if (icon && - !icon_name.empty() && - (icon_name[0] == '/' || - icon_name.rfind("~/", 0) == 0)) - { - IconProvider::image_set_icon(*icon, icon_name); - } + !icon_name.empty() && + ((icon_name[0] == '/') || + (icon_name.rfind("~/", 0) == 0))) + { + IconProvider::image_set_icon(*icon, icon_name); + } }, pid); }