-
Notifications
You must be signed in to change notification settings - Fork 0
/
display.hpp
47 lines (32 loc) · 1.06 KB
/
display.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#ifndef DWMSTATUS_DISPLAY_HPP
#define DWMSTATUS_DISPLAY_HPP
#include "decl.hpp"
namespace dwmstatus {
struct abstract_display {
virtual ~abstract_display() = default;
virtual void set_status(string_view str) = 0;
};
using display_ptr = unique_ptr<abstract_display>;
//----------------------------------------------------------------------------
// stdout prints status string to standard output, for spectrwm and
// other WMs reading bar's output.
struct stdout : abstract_display {
virtual void set_status(string_view str) override;
};
} // namespace dwmstatus
#ifdef DWMSTATUS_WITH_X11
#include <xcb/xcb.h>
#include <xcb/xproto.h>
namespace dwmstatus {
// window_property writes status string to WM_NAME property of X root
// window, for DWM.
struct window_property : abstract_display {
window_property();
virtual void set_status(string_view str) override;
private:
unique_ptr<xcb_connection_t, decltype(&xcb_disconnect)> conn_;
xcb_window_t root_;
};
} // namespace dwmstatus
#endif // DWMSTATUS_WITH_X11
#endif // DWMSTATUS_DISPLAY_HPP