polybar/src/x11/icccm.cpp

25 lines
598 B
C++
Raw Normal View History

#include "x11/icccm.hpp"
2016-11-19 05:22:44 +00:00
POLYBAR_NS
namespace icccm_util {
string get_wm_name(xcb_connection_t* conn, xcb_window_t win) {
xcb_icccm_get_text_property_reply_t reply;
if (xcb_icccm_get_wm_name_reply(conn, xcb_icccm_get_wm_name(conn, win), &reply, nullptr)) {
return get_reply_string(&reply);
2016-11-25 12:55:15 +00:00
}
return "";
}
string get_reply_string(xcb_icccm_get_text_property_reply_t* reply) {
if (reply->name == nullptr) {
return "";
2016-11-25 12:55:15 +00:00
}
string str(reply->name, reply->name_len);
xcb_icccm_get_text_property_reply_wipe(reply);
return str;
}
}
2016-11-19 05:22:44 +00:00
POLYBAR_NS_END