1
0
Fork 0
mirror of https://github.com/polybar/polybar.git synced 2024-11-11 13:50:56 -05:00
polybar/include/modules/script.hpp

54 lines
1.2 KiB
C++
Raw Normal View History

#pragma once
2016-05-19 10:41:06 -04:00
#include "adapters/script_runner.hpp"
#include "modules/meta/base.hpp"
2016-06-14 23:32:35 -04:00
#include "utils/command.hpp"
#include "utils/io.hpp"
2016-05-19 10:41:06 -04:00
2016-11-19 00:22:44 -05:00
POLYBAR_NS
2016-06-14 23:32:35 -04:00
namespace modules {
class script_module : public module<script_module> {
2016-06-14 23:32:35 -04:00
public:
explicit script_module(const bar_settings&, string);
void start() override;
void stop() override;
2016-06-14 23:32:35 -04:00
2016-11-02 15:22:45 -04:00
string get_output();
string get_format() const;
2016-11-25 07:55:15 -05:00
bool build(builder* builder, const string& tag) const;
2016-06-14 23:32:35 -04:00
static constexpr auto TYPE = "custom/script";
2016-06-14 23:32:35 -04:00
protected:
bool check_condition();
private:
void handle_runner_update(const script_runner::data&);
static constexpr auto TAG_LABEL = "<label>";
static constexpr auto TAG_LABEL_FAIL = "<label-fail>";
static constexpr auto FORMAT_FAIL = "format-fail";
2016-06-14 23:32:35 -04:00
const bool m_tail;
const script_runner::interval m_interval_success{0};
const script_runner::interval m_interval_fail{0};
const script_runner::interval m_interval_if{0};
script_runner m_runner;
2016-06-14 23:32:35 -04:00
map<mousebtn, string> m_actions;
label_t m_label;
label_t m_label_fail;
int m_exit_status{0};
script_runner::data m_data;
std::mutex m_data_mutex;
2016-05-19 10:41:06 -04:00
};
} // namespace modules
2016-06-14 23:32:35 -04:00
2016-11-19 00:22:44 -05:00
POLYBAR_NS_END