mirror of
https://github.com/polybar/polybar.git
synced 2024-11-11 13:50:56 -05:00
d5be8cad97
* build: Add -Wsuggest-override We should always use the override specifier when overriding virtual functions. This helps prevent errors when a subclass tries to create a function with the same name as a virtual function in a super-class but with a different purpose. * clang-format * Upload logs on failure * Add override to unsupported.hpp * cmake: Make -Wsuggest-override flag conditional
46 lines
1.1 KiB
C++
46 lines
1.1 KiB
C++
#pragma once
|
|
|
|
#include "modules/meta/static_module.hpp"
|
|
#include "utils/command.hpp"
|
|
|
|
POLYBAR_NS
|
|
|
|
namespace modules {
|
|
/**
|
|
* Module that allow users to configure hooks on
|
|
* received ipc messages. The hook will execute the defined
|
|
* shell script and the resulting output will be used
|
|
* as the module content.
|
|
*/
|
|
class ipc_module : public static_module<ipc_module> {
|
|
public:
|
|
/**
|
|
* Hook structure that will be fired
|
|
* when receiving a message with specified id
|
|
*/
|
|
struct hook {
|
|
string payload;
|
|
string command;
|
|
};
|
|
|
|
public:
|
|
explicit ipc_module(const bar_settings&, string);
|
|
|
|
void start() override;
|
|
void update() {}
|
|
string get_output();
|
|
bool build(builder* builder, const string& tag) const;
|
|
void on_message(const string& message);
|
|
|
|
static constexpr auto TYPE = "custom/ipc";
|
|
|
|
private:
|
|
static constexpr const char* TAG_OUTPUT{"<output>"};
|
|
vector<unique_ptr<hook>> m_hooks;
|
|
map<mousebtn, string> m_actions;
|
|
string m_output;
|
|
size_t m_initial;
|
|
};
|
|
} // namespace modules
|
|
|
|
POLYBAR_NS_END
|