diff --git a/CHANGELOG.md b/CHANGELOG.md index 4664eb3e..959ba70f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -81,6 +81,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - `DEBUG_SHADED` cmake variable and its associated functionality. ### Added +- `custom/script`: Add formatting for script failure (`format-fail`, `label-fail`) ([`#2588`](https://github.com/polybar/polybar/issues/2588)) - Support `px` and `pt` units everyhwere where before only a number of spaces or pixels could be specified. ([`#2578`](https://github.com/polybar/polybar/pull/2578)) diff --git a/include/adapters/script_runner.hpp b/include/adapters/script_runner.hpp index 9ecec1c1..a2322e50 100644 --- a/include/adapters/script_runner.hpp +++ b/include/adapters/script_runner.hpp @@ -24,13 +24,14 @@ class script_runner { int get_pid() const; int get_counter() const; + int get_exit_status() const; string get_output(); bool is_stopping() const; protected: - bool set_output(const string&&); + bool set_output(string&&); interval run_tail(); interval run(); @@ -52,6 +53,7 @@ class script_runner { std::atomic_int m_counter{0}; std::atomic_bool m_stopping{false}; std::atomic_int m_pid{-1}; + std::atomic_int m_exit_status{0}; }; POLYBAR_NS_END diff --git a/include/modules/script.hpp b/include/modules/script.hpp index c00dcdbf..94308249 100644 --- a/include/modules/script.hpp +++ b/include/modules/script.hpp @@ -16,6 +16,8 @@ namespace modules { void stop() override; string get_output(); + string get_format() const; + bool build(builder* builder, const string& tag) const; static constexpr auto TYPE = "custom/script"; @@ -24,7 +26,9 @@ namespace modules { bool check_condition(); private: - static constexpr const char* TAG_LABEL{"