diff --git a/include/components/x11/connection.hpp b/include/components/x11/connection.hpp index 77acf14c..cb2b0f25 100644 --- a/include/components/x11/connection.hpp +++ b/include/components/x11/connection.hpp @@ -57,7 +57,7 @@ class connection : public xpp_connection { */ auto id(xcb_window_t w) const { return string_util::from_stream( - std::stringstream() << "0x" << std::hex << std::setw(8) << std::setfill('0') << w); + std::stringstream() << "0x" << std::hex << std::setw(7) << std::setfill('0') << w); } /** diff --git a/include/components/x11/tray.hpp b/include/components/x11/tray.hpp index 15ebd4db..5e07ba5f 100644 --- a/include/components/x11/tray.hpp +++ b/include/components/x11/tray.hpp @@ -325,12 +325,17 @@ class traymanager m_settings.width + m_settings.spacing * 2, m_settings.height + m_settings.spacing * 2, 0, XCB_WINDOW_CLASS_INPUT_OUTPUT, scr->root_visual, mask, values); - // Put the tray window above the defined sibling in the window stack - if (m_settings.sibling != XCB_NONE) { - const uint32_t value_mask = XCB_CONFIG_WINDOW_SIBLING | XCB_CONFIG_WINDOW_STACK_MODE; - const uint32_t value_list[2]{m_settings.sibling, XCB_STACK_MODE_ABOVE}; - m_connection.configure_window_checked(m_tray, value_mask, value_list); - m_connection.flush(); + try { + // Put the tray window above the defined sibling in the window stack + if (m_settings.sibling != XCB_NONE) { + const uint32_t value_mask = XCB_CONFIG_WINDOW_SIBLING | XCB_CONFIG_WINDOW_STACK_MODE; + const uint32_t value_list[2]{m_settings.sibling, XCB_STACK_MODE_ABOVE}; + m_connection.configure_window_checked(m_tray, value_mask, value_list); + m_connection.flush(); + } + } catch (const std::exception& err) { + auto id = m_connection.id(m_settings.sibling); + m_logger.trace("tray: Failed to put tray above %s in the stack (%s)", id, err.what()); } }