1
0
Fork 0
mirror of https://github.com/polybar/polybar.git synced 2024-11-11 13:50:56 -05:00
polybar/include/x11/xresources.hpp

35 lines
790 B
C++
Raw Normal View History

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