mirror of
https://github.com/polybar/polybar.git
synced 2024-12-02 14:05:27 -05:00
fix(tray): Handle error when trying to restack window
This commit is contained in:
parent
8750894bb3
commit
20991a3465
2 changed files with 12 additions and 7 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue