refactor(custom): move continuous exec onto GLib command stream

Replace the custom module's continuous getline() worker with the new GLib-backed command stream helper.

This moves line delivery, child exit handling, and restart scheduling onto the main loop so continuous commands no longer depend on a blocking FILE* read inside SleeperThread.

The behavior is kept aligned with the old module semantics: stdout lines still emit updates, non-zero exits still surface as errors, and restart-interval still respawns the command.

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 560f02509b
commit 5f4b96ad1d
2 changed files with 67 additions and 59 deletions
+7 -2
View File
@@ -3,10 +3,12 @@
#include <fmt/format.h>
#include <csignal>
#include <memory>
#include <string>
#include "AIconLabel.hpp"
#include "util/command.hpp"
#include "util/command_line_stream.hpp"
#include "util/json.hpp"
#include "util/sleeper_thread.hpp"
@@ -22,6 +24,9 @@ class Custom : public AIconLabel {
private:
void delayWorker();
void continuousWorker();
void startContinuousProcess(bool throw_on_failure);
void handleContinuousProcessExit(int exit_code);
void scheduleContinuousRestart();
void waitingWorker();
void parseOutputRaw();
void parseOutputJson();
@@ -42,10 +47,10 @@ class Custom : public AIconLabel {
const bool tooltip_format_enabled_;
std::vector<std::string> class_;
int percentage_;
FILE* fp_;
int pid_;
util::command::res output_;
util::JsonParser parser_;
std::unique_ptr<util::command::LineStream> continuous_stream_;
sigc::connection restart_connection_;
util::SleeperThread thread_;
};