polybar-dwm/include/modules/script.hpp

48 lines
948 B
C++
Raw Normal View History

#pragma once
2016-05-19 14:41:06 +00:00
#include "modules/meta/base.hpp"
2016-06-15 03:32:35 +00:00
#include "utils/command.hpp"
#include "utils/io.hpp"
2016-05-19 14:41:06 +00:00
2016-11-19 05:22:44 +00:00
POLYBAR_NS
2016-06-15 03:32:35 +00:00
namespace modules {
class script_module : public module<script_module> {
2016-06-15 03:32:35 +00:00
public:
explicit script_module(const bar_settings&, string);
virtual ~script_module() {}
virtual void start();
virtual void stop();
2016-06-15 03:32:35 +00:00
2016-11-02 19:22:45 +00:00
string get_output();
2016-11-25 12:55:15 +00:00
bool build(builder* builder, const string& tag) const;
2016-06-15 03:32:35 +00:00
protected:
virtual void process() = 0;
static constexpr const char* TAG_OUTPUT{"<output>"};
static constexpr const char* TAG_LABEL{"<label>"};
2016-06-15 03:32:35 +00:00
unique_ptr<command> m_command;
2016-06-15 03:32:35 +00:00
string m_exec;
2016-11-20 22:04:31 +00: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};
// @deprecated
size_t m_maxlen{0};
// @deprecated
bool m_ellipsis{true};
bool m_stopping{false};
2016-05-19 14:41:06 +00:00
};
}
2016-06-15 03:32:35 +00:00
2016-11-19 05:22:44 +00:00
POLYBAR_NS_END