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

50 lines
1,006 B
C++
Raw Normal View History

#pragma once
2016-05-19 10:41:06 -04:00
#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);
~script_module() {}
void start();
void stop();
2016-06-14 23:32:35 -04:00
2016-11-02 15:22:45 -04:00
string get_output();
2016-11-25 07:55:15 -05:00
bool build(builder* builder, const string& tag) const;
2016-06-14 23:32:35 -04:00
protected:
chrono::duration<double> process(const mutex_wrapper<function<chrono::duration<double>()>>& handler) const;
bool check_condition();
private:
static constexpr const char* TAG_LABEL{"<label>"};
2016-06-14 23:32:35 -04:00
mutex_wrapper<function<chrono::duration<double>()>> m_handler;
unique_ptr<command> m_command;
2016-06-14 23:32:35 -04:00
bool m_tail;
2016-06-14 23:32:35 -04:00
string m_exec;
string m_exec_if;
2016-11-20 17:04:31 -05:00
chrono::duration<double> m_interval{0};
map<mousebtn, string> m_actions;
label_t m_label;
string m_output;
string m_prev;
int m_counter{0};
bool m_stopping{false};
2016-05-19 10:41:06 -04:00
};
}
2016-06-14 23:32:35 -04:00
2016-11-19 00:22:44 -05:00
POLYBAR_NS_END