2016-12-05 19:41:00 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "common.hpp"
|
|
|
|
#include "components/ipc.hpp"
|
|
|
|
#include "components/types.hpp"
|
2020-12-17 19:37:28 +00:00
|
|
|
#include "tags/dispatch.hpp"
|
|
|
|
#include "tags/types.hpp"
|
2016-12-05 19:41:00 +00:00
|
|
|
#include "utils/functional.hpp"
|
|
|
|
|
|
|
|
POLYBAR_NS
|
|
|
|
|
|
|
|
namespace signals {
|
|
|
|
namespace detail {
|
|
|
|
class signal {
|
|
|
|
public:
|
|
|
|
explicit signal() = default;
|
|
|
|
virtual ~signal() {}
|
|
|
|
virtual size_t size() const = 0;
|
|
|
|
};
|
|
|
|
|
2017-01-01 19:29:38 +00:00
|
|
|
template <typename Derived>
|
2016-12-05 19:41:00 +00:00
|
|
|
class base_signal : public signal {
|
|
|
|
public:
|
2017-01-01 19:29:38 +00:00
|
|
|
using base_type = base_signal<Derived>;
|
2016-12-05 19:41:00 +00:00
|
|
|
|
|
|
|
explicit base_signal() = default;
|
|
|
|
virtual ~base_signal() {}
|
|
|
|
|
|
|
|
virtual size_t size() const override {
|
|
|
|
return sizeof(Derived);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2017-01-01 19:29:38 +00:00
|
|
|
template <typename Derived, typename ValueType>
|
|
|
|
class value_signal : public base_signal<Derived> {
|
2016-12-05 19:41:00 +00:00
|
|
|
public:
|
2017-01-01 19:29:38 +00:00
|
|
|
using base_type = value_signal<Derived, ValueType>;
|
2016-12-05 19:41:00 +00:00
|
|
|
|
2017-01-09 17:49:22 +00:00
|
|
|
explicit value_signal(void* data) : m_ptr(data) {}
|
|
|
|
explicit value_signal(ValueType&& data) : m_ptr(&data) {}
|
2020-12-17 19:37:28 +00:00
|
|
|
explicit value_signal(ValueType& data) : m_ptr(&data) {}
|
2017-01-01 19:29:38 +00:00
|
|
|
|
2017-01-09 17:49:22 +00:00
|
|
|
virtual ~value_signal() {}
|
2016-12-05 19:41:00 +00:00
|
|
|
|
2017-01-01 19:29:38 +00:00
|
|
|
inline ValueType cast() const {
|
2017-01-09 17:49:22 +00:00
|
|
|
return *static_cast<ValueType*>(m_ptr);
|
2016-12-16 06:10:45 +00:00
|
|
|
}
|
2016-12-05 19:41:00 +00:00
|
|
|
|
|
|
|
private:
|
2017-01-09 17:49:22 +00:00
|
|
|
void* m_ptr;
|
2016-12-05 19:41:00 +00:00
|
|
|
};
|
2019-08-06 17:35:07 +00:00
|
|
|
} // namespace detail
|
2016-12-05 19:41:00 +00:00
|
|
|
|
2016-12-20 04:05:43 +00:00
|
|
|
namespace eventqueue {
|
2017-01-12 15:12:54 +00:00
|
|
|
struct start : public detail::base_signal<start> {
|
|
|
|
using base_type::base_type;
|
|
|
|
};
|
2017-01-01 19:29:38 +00:00
|
|
|
struct exit_terminate : public detail::base_signal<exit_terminate> {
|
|
|
|
using base_type::base_type;
|
|
|
|
};
|
|
|
|
struct exit_reload : public detail::base_signal<exit_reload> {
|
|
|
|
using base_type::base_type;
|
|
|
|
};
|
|
|
|
struct notify_change : public detail::base_signal<notify_change> {
|
|
|
|
using base_type::base_type;
|
|
|
|
};
|
2017-01-09 13:27:55 +00:00
|
|
|
struct notify_forcechange : public detail::base_signal<notify_forcechange> {
|
2017-01-01 19:29:38 +00:00
|
|
|
using base_type::base_type;
|
|
|
|
};
|
2017-01-09 13:27:55 +00:00
|
|
|
struct check_state : public detail::base_signal<check_state> {
|
2017-01-01 19:29:38 +00:00
|
|
|
using base_type::base_type;
|
|
|
|
};
|
2019-08-06 17:35:07 +00:00
|
|
|
} // namespace eventqueue
|
2016-12-05 19:41:00 +00:00
|
|
|
|
|
|
|
namespace ipc {
|
2017-01-01 19:29:38 +00:00
|
|
|
struct command : public detail::value_signal<command, string> {
|
|
|
|
using base_type::base_type;
|
|
|
|
};
|
|
|
|
struct hook : public detail::value_signal<hook, string> {
|
|
|
|
using base_type::base_type;
|
|
|
|
};
|
|
|
|
struct action : public detail::value_signal<action, string> {
|
|
|
|
using base_type::base_type;
|
|
|
|
};
|
2019-08-06 17:35:07 +00:00
|
|
|
} // namespace ipc
|
2016-12-05 19:41:00 +00:00
|
|
|
|
|
|
|
namespace ui {
|
2017-01-19 04:38:42 +00:00
|
|
|
struct ready : public detail::base_signal<ready> {
|
|
|
|
using base_type::base_type;
|
|
|
|
};
|
2017-01-25 22:36:34 +00:00
|
|
|
struct changed : public detail::base_signal<changed> {
|
|
|
|
using base_type::base_type;
|
|
|
|
};
|
2017-01-01 19:29:38 +00:00
|
|
|
struct tick : public detail::base_signal<tick> {
|
|
|
|
using base_type::base_type;
|
|
|
|
};
|
|
|
|
struct button_press : public detail::value_signal<button_press, string> {
|
|
|
|
using base_type::base_type;
|
|
|
|
};
|
2017-09-03 04:45:45 +00:00
|
|
|
struct cursor_change : public detail::value_signal<cursor_change, string> {
|
|
|
|
using base_type::base_type;
|
|
|
|
};
|
2017-01-01 19:29:38 +00:00
|
|
|
struct visibility_change : public detail::value_signal<visibility_change, bool> {
|
|
|
|
using base_type::base_type;
|
|
|
|
};
|
|
|
|
struct dim_window : public detail::value_signal<dim_window, double> {
|
|
|
|
using base_type::base_type;
|
|
|
|
};
|
|
|
|
struct shade_window : public detail::base_signal<shade_window> {
|
|
|
|
using base_type::base_type;
|
|
|
|
};
|
|
|
|
struct unshade_window : public detail::base_signal<unshade_window> {
|
|
|
|
using base_type::base_type;
|
|
|
|
};
|
2017-01-24 05:59:58 +00:00
|
|
|
struct request_snapshot : public detail::value_signal<request_snapshot, string> {
|
|
|
|
using base_type::base_type;
|
|
|
|
};
|
2018-08-13 16:42:43 +00:00
|
|
|
/// emitted whenever the desktop background slice changes
|
2017-05-23 19:32:34 +00:00
|
|
|
struct update_background : public detail::base_signal<update_background> {
|
|
|
|
using base_type::base_type;
|
|
|
|
};
|
2018-08-13 16:42:43 +00:00
|
|
|
/// emitted when the bar geometry changes (such as position of the bar on the screen)
|
2017-08-31 16:26:38 +00:00
|
|
|
struct update_geometry : public detail::base_signal<update_geometry> {
|
|
|
|
using base_type::base_type;
|
|
|
|
};
|
2019-08-06 17:35:07 +00:00
|
|
|
} // namespace ui
|
2017-01-01 19:29:38 +00:00
|
|
|
|
|
|
|
namespace ui_tray {
|
2017-01-25 22:36:34 +00:00
|
|
|
struct mapped_clients : public detail::value_signal<mapped_clients, unsigned int> {
|
2017-01-01 19:29:38 +00:00
|
|
|
using base_type::base_type;
|
|
|
|
};
|
2019-08-06 17:35:07 +00:00
|
|
|
} // namespace ui_tray
|
2016-12-05 19:41:00 +00:00
|
|
|
|
|
|
|
namespace parser {
|
2019-10-27 21:27:58 +00:00
|
|
|
struct change_background : public detail::value_signal<change_background, rgba> {
|
2017-01-01 19:29:38 +00:00
|
|
|
using base_type::base_type;
|
|
|
|
};
|
2019-10-27 21:27:58 +00:00
|
|
|
struct change_foreground : public detail::value_signal<change_foreground, rgba> {
|
2017-01-01 19:29:38 +00:00
|
|
|
using base_type::base_type;
|
|
|
|
};
|
2019-10-27 21:27:58 +00:00
|
|
|
struct change_underline : public detail::value_signal<change_underline, rgba> {
|
2017-01-01 19:29:38 +00:00
|
|
|
using base_type::base_type;
|
|
|
|
};
|
2019-10-27 21:27:58 +00:00
|
|
|
struct change_overline : public detail::value_signal<change_overline, rgba> {
|
2017-01-01 19:29:38 +00:00
|
|
|
using base_type::base_type;
|
|
|
|
};
|
2017-01-19 10:11:28 +00:00
|
|
|
struct change_font : public detail::value_signal<change_font, int> {
|
2017-01-01 19:29:38 +00:00
|
|
|
using base_type::base_type;
|
|
|
|
};
|
|
|
|
struct change_alignment : public detail::value_signal<change_alignment, alignment> {
|
|
|
|
using base_type::base_type;
|
|
|
|
};
|
2017-05-17 21:11:06 +00:00
|
|
|
struct reverse_colors : public detail::base_signal<reverse_colors> {
|
|
|
|
using base_type::base_type;
|
|
|
|
};
|
2017-01-19 10:11:28 +00:00
|
|
|
struct offset_pixel : public detail::value_signal<offset_pixel, int> {
|
2017-01-01 19:29:38 +00:00
|
|
|
using base_type::base_type;
|
|
|
|
};
|
2020-12-17 19:37:28 +00:00
|
|
|
struct attribute_set : public detail::value_signal<attribute_set, tags::attribute> {
|
2017-01-01 19:29:38 +00:00
|
|
|
using base_type::base_type;
|
|
|
|
};
|
2020-12-17 19:37:28 +00:00
|
|
|
struct attribute_unset : public detail::value_signal<attribute_unset, tags::attribute> {
|
2017-01-01 19:29:38 +00:00
|
|
|
using base_type::base_type;
|
|
|
|
};
|
2020-12-17 19:37:28 +00:00
|
|
|
struct attribute_toggle : public detail::value_signal<attribute_toggle, tags::attribute> {
|
2017-01-01 19:29:38 +00:00
|
|
|
using base_type::base_type;
|
|
|
|
};
|
|
|
|
struct action_begin : public detail::value_signal<action_begin, action> {
|
|
|
|
using base_type::base_type;
|
|
|
|
};
|
|
|
|
struct action_end : public detail::value_signal<action_end, mousebtn> {
|
|
|
|
using base_type::base_type;
|
|
|
|
};
|
2017-01-19 04:38:42 +00:00
|
|
|
struct text : public detail::value_signal<text, string> {
|
2017-01-01 19:29:38 +00:00
|
|
|
using base_type::base_type;
|
|
|
|
};
|
2020-12-17 19:37:28 +00:00
|
|
|
struct control : public detail::value_signal<control, tags::controltag> {
|
2019-01-12 13:51:54 +00:00
|
|
|
using base_type::base_type;
|
|
|
|
};
|
2019-08-06 17:35:07 +00:00
|
|
|
} // namespace parser
|
|
|
|
} // namespace signals
|
2016-12-05 19:41:00 +00:00
|
|
|
|
|
|
|
POLYBAR_NS_END
|