2016-11-02 19:22:45 +00:00
|
|
|
#pragma once
|
|
|
|
|
2016-12-14 05:52:58 +00:00
|
|
|
#include <X11/X.h>
|
2016-11-02 19:22:45 +00:00
|
|
|
#include <X11/Xresource.h>
|
|
|
|
|
|
|
|
#include "common.hpp"
|
|
|
|
|
2016-11-19 05:22:44 +00:00
|
|
|
POLYBAR_NS
|
2016-11-02 19:22:45 +00:00
|
|
|
|
|
|
|
class xresource_manager {
|
|
|
|
public:
|
2017-01-19 20:27:00 +00:00
|
|
|
using make_type = const xresource_manager&;
|
2016-12-09 11:43:31 +00:00
|
|
|
static make_type make();
|
2016-12-09 08:02:47 +00:00
|
|
|
|
2016-12-21 22:22:02 +00:00
|
|
|
explicit xresource_manager(Display*);
|
2016-12-09 21:54:30 +00:00
|
|
|
~xresource_manager();
|
2016-11-02 19:22:45 +00:00
|
|
|
|
2016-12-15 02:30:41 +00:00
|
|
|
xresource_manager(const xresource_manager& o) = delete;
|
|
|
|
xresource_manager& operator=(const xresource_manager& o) = delete;
|
|
|
|
|
2016-11-18 16:40:16 +00:00
|
|
|
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 19:22:45 +00:00
|
|
|
|
|
|
|
protected:
|
2016-11-25 12:55:15 +00:00
|
|
|
string load_value(const string& key, const string& res_type, size_t n) const;
|
2016-11-02 19:22:45 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
XrmDatabase m_db;
|
2016-12-14 05:52:58 +00:00
|
|
|
char* m_manager{nullptr};
|
2016-11-02 19:22:45 +00:00
|
|
|
};
|
|
|
|
|
2016-11-19 05:22:44 +00:00
|
|
|
POLYBAR_NS_END
|