2016-11-18 22:03:18 -05:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <bitset>
|
|
|
|
|
|
|
|
#include "components/config.hpp"
|
2016-11-20 17:04:31 -05:00
|
|
|
#include "modules/meta/static_module.hpp"
|
|
|
|
#include "x11/events.hpp"
|
2016-11-18 22:03:18 -05:00
|
|
|
#include "x11/ewmh.hpp"
|
|
|
|
#include "x11/icccm.hpp"
|
|
|
|
#include "x11/window.hpp"
|
|
|
|
|
2016-11-19 00:22:44 -05:00
|
|
|
POLYBAR_NS
|
2016-11-18 22:03:18 -05:00
|
|
|
|
2016-11-20 17:04:31 -05:00
|
|
|
class connection;
|
|
|
|
|
2016-11-18 22:03:18 -05:00
|
|
|
namespace modules {
|
|
|
|
class active_window {
|
|
|
|
public:
|
2016-12-01 02:35:59 -05:00
|
|
|
explicit active_window(xcb_window_t win);
|
|
|
|
~active_window();
|
|
|
|
bool match(const xcb_window_t win) const;
|
|
|
|
string title(xcb_ewmh_connection_t* ewmh) const;
|
2016-11-18 22:03:18 -05:00
|
|
|
|
|
|
|
private:
|
|
|
|
connection& m_connection;
|
|
|
|
window m_window{m_connection};
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Module used to display information about the
|
|
|
|
* currently active X window.
|
|
|
|
*/
|
|
|
|
class xwindow_module : public static_module<xwindow_module>, public xpp::event::sink<evt::property_notify> {
|
|
|
|
public:
|
2016-12-01 02:35:59 -05:00
|
|
|
xwindow_module(const bar_settings&, const logger&, const config&, string);
|
2016-11-18 22:03:18 -05:00
|
|
|
|
|
|
|
void setup();
|
|
|
|
void teardown();
|
|
|
|
void handle(const evt::property_notify& evt);
|
|
|
|
void update();
|
2016-11-25 07:55:15 -05:00
|
|
|
bool build(builder* builder, const string& tag) const;
|
2016-11-18 22:03:18 -05:00
|
|
|
|
|
|
|
private:
|
2016-11-26 00:13:20 -05:00
|
|
|
static constexpr const char* TAG_LABEL{"<label>"};
|
2016-11-18 22:03:18 -05:00
|
|
|
|
2016-12-01 02:35:59 -05:00
|
|
|
connection& m_connection;
|
2016-11-26 00:13:20 -05:00
|
|
|
ewmh_connection_t m_ewmh;
|
2016-11-18 22:03:18 -05:00
|
|
|
unique_ptr<active_window> m_active;
|
|
|
|
label_t m_label;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2016-11-19 00:22:44 -05:00
|
|
|
POLYBAR_NS_END
|