polybar-dwm/include/x11/xresources.hpp

35 lines
775 B
C++
Raw Normal View History

2016-11-02 20:22:45 +01:00
#pragma once
2016-12-14 06:52:58 +01:00
#include <X11/X.h>
2016-11-02 20:22:45 +01:00
#include <X11/Xresource.h>
#include "common.hpp"
2016-11-19 06:22:44 +01:00
POLYBAR_NS
2016-11-02 20:22:45 +01:00
class xresource_manager {
public:
2016-12-09 12:43:31 +01:00
using make_type = const xresource_manager&;
static make_type make();
2016-12-09 09:02:47 +01:00
2016-12-21 23:22:02 +01:00
explicit xresource_manager(Display*);
2016-12-09 22:54:30 +01:00
~xresource_manager();
2016-11-02 20:22:45 +01:00
2016-12-15 03:30:41 +01:00
xresource_manager(const xresource_manager& o) = delete;
xresource_manager& operator=(const xresource_manager& o) = delete;
string get_string(string name, string fallback = "") const;
float get_float(string name, float fallback = 0.0f) const;
int get_int(string name, int fallback = 0) const;
2016-11-02 20:22:45 +01:00
protected:
2016-11-25 13:55:15 +01:00
string load_value(const string& key, const string& res_type, size_t n) const;
2016-11-02 20:22:45 +01:00
private:
2016-12-21 23:22:02 +01:00
Display* m_display{nullptr};
2016-11-02 20:22:45 +01:00
XrmDatabase m_db;
2016-12-14 06:52:58 +01:00
char* m_manager{nullptr};
2016-11-02 20:22:45 +01:00
};
2016-11-19 06:22:44 +01:00
POLYBAR_NS_END