2016-11-13 18:05:30 +00:00
|
|
|
#pragma once
|
|
|
|
|
2021-02-20 20:26:45 +00:00
|
|
|
#include <uv.h>
|
|
|
|
|
2016-11-13 18:05:30 +00:00
|
|
|
#include "common.hpp"
|
2017-01-11 02:07:28 +00:00
|
|
|
#include "settings.hpp"
|
2016-11-20 22:04:31 +00:00
|
|
|
#include "utils/concurrency.hpp"
|
2016-11-13 18:05:30 +00:00
|
|
|
|
2016-11-19 05:22:44 +00:00
|
|
|
POLYBAR_NS
|
2016-11-13 18:05:30 +00:00
|
|
|
|
2017-01-11 02:07:28 +00:00
|
|
|
class signal_emitter;
|
2021-09-13 16:16:00 +00:00
|
|
|
class logger;
|
2016-11-14 08:21:18 +00:00
|
|
|
|
2016-11-13 18:05:30 +00:00
|
|
|
/**
|
|
|
|
* Component used for inter-process communication.
|
|
|
|
*
|
|
|
|
* A unique messaging channel will be setup for each
|
|
|
|
* running process which will allow messages and
|
|
|
|
* events to be sent to the process externally.
|
|
|
|
*/
|
|
|
|
class ipc {
|
|
|
|
public:
|
2016-12-09 08:40:46 +00:00
|
|
|
using make_type = unique_ptr<ipc>;
|
|
|
|
static make_type make();
|
2016-12-09 08:02:47 +00:00
|
|
|
|
2016-12-20 04:05:43 +00:00
|
|
|
explicit ipc(signal_emitter& emitter, const logger& logger);
|
2016-11-13 18:05:30 +00:00
|
|
|
~ipc();
|
|
|
|
|
2021-09-13 17:56:24 +00:00
|
|
|
string get_path() const;
|
|
|
|
|
2021-09-12 21:26:24 +00:00
|
|
|
void receive_data(string buf);
|
|
|
|
void receive_eof();
|
2016-11-13 18:05:30 +00:00
|
|
|
|
|
|
|
private:
|
2016-12-05 19:41:00 +00:00
|
|
|
signal_emitter& m_sig;
|
2016-11-13 18:05:30 +00:00
|
|
|
const logger& m_log;
|
2016-12-20 04:05:43 +00:00
|
|
|
|
|
|
|
string m_path{};
|
2021-09-12 21:26:24 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Buffer for the currently received IPC message.
|
|
|
|
*/
|
|
|
|
string m_buffer{};
|
2016-11-13 18:05:30 +00:00
|
|
|
};
|
|
|
|
|
2016-11-19 05:22:44 +00:00
|
|
|
POLYBAR_NS_END
|