fix(i3): Filter root window

Ref #207
This commit is contained in:
Michael Carlberg 2016-11-30 16:56:48 +01:00
parent eddda10c23
commit d5587bf6f6

View File

@ -1,5 +1,4 @@
#include <xcb/xcb.h>
#include <xcb/xcb_icccm.h>
#include <i3ipc++/ipc.hpp>
#include "common.hpp"
@ -8,6 +7,7 @@
#include "utils/socket.hpp"
#include "utils/string.hpp"
#include "x11/connection.hpp"
#include "x11/icccm.hpp"
POLYBAR_NS
@ -20,20 +20,12 @@ namespace i3_util {
auto children = conn.query_tree(conn.screen()->root).children();
for (auto it = children.begin(); it != children.end(); it++) {
xcb_icccm_get_text_property_reply_t reply;
reply.name = nullptr;
if (xcb_icccm_get_wm_name_reply(conn, xcb_icccm_get_wm_name(conn, *it), &reply, nullptr)) {
if (("[i3 con] output " + output_name).compare(0, 16 + output_name.length(), reply.name) == 0) {
auto wm_name = icccm_util::get_wm_name(conn, *it);
if (wm_name.compare("[i3 con] output " + output_name) == 0) {
roots.emplace_back(*it);
}
}
if (reply.name != nullptr) {
xcb_icccm_get_text_property_reply_wipe(&reply);
}
}
return roots;
}
@ -47,10 +39,7 @@ namespace i3_util {
for (auto&& root : root_windows(conn, mon->name)) {
const uint32_t value_mask = XCB_CONFIG_WINDOW_SIBLING | XCB_CONFIG_WINDOW_STACK_MODE;
const uint32_t value_list[2]{root, XCB_STACK_MODE_ABOVE};
conn.configure_window_checked(win, value_mask, value_list);
conn.flush();
return true;
}