src/components/bar.cpp
/**
 * Move the bar window above defined sibling
 * in the X window stack
 */
Move the bar window above defined sibling
in the X window stack
Move the bar window above defined sibling in the X window stack
void bar::restack_window() {
  string wm_restack;
  try {
    wm_restack = m_conf.get(m_conf.section(), "wm-restack");
  } catch (const key_error& err) {
    return;
  }
  auto restacked = false;
  if (wm_restack == "generic") {
    try {
      auto children = m_connection.query_tree(m_connection.screen()->root).children();
      if (children.begin() != children.end() && *children.begin() != m_opts.window) {
        const unsigned int value_mask = XCB_CONFIG_WINDOW_SIBLING | XCB_CONFIG_WINDOW_STACK_MODE;
        const unsigned int value_list[2]{*children.begin(), XCB_STACK_MODE_BELOW};
        m_connection.configure_window_checked(m_opts.window, value_mask, value_list);
      }
      restacked = true;
    } catch (const exception& err) {
      m_log.err("Failed to restack bar window (err=%s)", err.what());
    }
  } else if (wm_restack == "bspwm") {
    restacked = bspwm_util::restack_to_root(m_connection, m_opts.monitor, m_opts.window);
#if ENABLE_I3
  } else if (wm_restack == "i3" && m_opts.override_redirect) {
    restacked = i3_util::restack_to_root(m_connection, m_opts.window);
  } else if (wm_restack == "i3" && !m_opts.override_redirect) {
    m_log.warn("Ignoring restack of i3 window (not needed when `override-redirect = false`)");
    wm_restack.clear();
#endif
  } else {
    m_log.warn("Ignoring unsupported wm-restack option '%s'", wm_restack);
    wm_restack.clear();
  }
  if (restacked) {
    m_log.info("Successfully restacked bar window");
  } else if (!wm_restack.empty()) {
    m_log.err("Failed to restack bar window");
  }
}
void bar :: restack_window ( ) { string wm_restack ; try { wm_restack = m_conf . get ( m_conf . section ( ) , " " ) ; } catch ( const key_error & err ) { return ; } auto restacked = false ; if ( wm_restack == " " ) { try { auto children = m_connection . query_tree ( m_connection . screen ( ) -> root ) . children ( ) ; if ( children . begin ( ) != children . end ( ) && * children . begin ( ) != m_opts . window ) { const unsigned int value_mask = XCB_CONFIG_WINDOW_SIBLING | XCB_CONFIG_WINDOW_STACK_MODE ; const unsigned int value_list [ 2 ] { * children . begin ( ) , XCB_STACK_MODE_BELOW } ; m_connection . configure_window_checked ( m_opts . window , value_mask , value_list ) ; } restacked = true ; } catch ( const exception & err ) { m_log . err ( " " , err . what ( ) ) ; } } else if ( wm_restack == " " ) { restacked = bspwm_util :: restack_to_root ( m_connection , m_opts . monitor , m_opts . window ) ; #if ENABLE_I3 } else if ( wm_restack == " " && m_opts . override_redirect ) { restacked = i3_util :: restack_to_root ( m_connection , m_opts . window ) ; } else if ( wm_restack == " " && ! m_opts . override_redirect ) { m_log . warn ( " " ) ; wm_restack . clear ( ) ; #endif 
  } else { m_log . warn ( " " , wm_restack ) ; wm_restack . clear ( ) ; } if ( restacked ) { m_log . info ( " " ) ; } else if ( ! wm_restack . empty ( ) ) { m_log . err ( " " ) ; } }
Move the bar window above defined sibling
 in the X window stack
Move the bar window above defined sibling in the X window stack