diff --git a/src/utils/i3.cpp b/src/utils/i3.cpp index f676c4de..bd2190e6 100644 --- a/src/utils/i3.cpp +++ b/src/utils/i3.cpp @@ -1,5 +1,4 @@ #include -#include #include #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,17 +20,9 @@ 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) { - roots.emplace_back(*it); - } - } - - if (reply.name != nullptr) { - xcb_icccm_get_text_property_reply_wipe(&reply); + auto wm_name = icccm_util::get_wm_name(conn, *it); + if (wm_name.compare("[i3 con] output " + output_name) == 0) { + roots.emplace_back(*it); } } @@ -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; }