parent
0c39061c98
commit
d9c035381e
@ -19,7 +19,7 @@ namespace i3_util {
|
|||||||
shared_ptr<workspace_t> focused_workspace(const connection_t&);
|
shared_ptr<workspace_t> focused_workspace(const connection_t&);
|
||||||
|
|
||||||
vector<xcb_window_t> root_windows(connection& conn, const string& output_name = "");
|
vector<xcb_window_t> root_windows(connection& conn, const string& output_name = "");
|
||||||
bool restack_to_root(connection& conn, const monitor_t& mon, const xcb_window_t win);
|
bool restack_to_root(connection& conn, const xcb_window_t win);
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
@ -369,7 +369,7 @@ void bar::restack_window() {
|
|||||||
restacked = bspwm_util::restack_to_root(m_connection, m_opts.monitor, m_opts.window);
|
restacked = bspwm_util::restack_to_root(m_connection, m_opts.monitor, m_opts.window);
|
||||||
#if ENABLE_I3
|
#if ENABLE_I3
|
||||||
} else if (wm_restack == "i3" && m_opts.override_redirect) {
|
} else if (wm_restack == "i3" && m_opts.override_redirect) {
|
||||||
restacked = i3_util::restack_to_root(m_connection, m_opts.monitor, m_opts.window);
|
restacked = i3_util::restack_to_root(m_connection, m_opts.window);
|
||||||
} else if (wm_restack == "i3" && !m_opts.override_redirect) {
|
} else if (wm_restack == "i3" && !m_opts.override_redirect) {
|
||||||
m_log.warn("Ignoring restack of i3 window (not needed when `override-redirect = false`)");
|
m_log.warn("Ignoring restack of i3 window (not needed when `override-redirect = false`)");
|
||||||
wm_restack.clear();
|
wm_restack.clear();
|
||||||
@ -492,6 +492,8 @@ void bar::handle(const evt::enter_notify&) {
|
|||||||
m_opts.dimmed = false;
|
m_opts.dimmed = false;
|
||||||
m_sig.emit(dim_window{1.0});
|
m_sig.emit(dim_window{1.0});
|
||||||
});
|
});
|
||||||
|
} else if (m_taskqueue->exist("window-dim")) {
|
||||||
|
m_taskqueue->purge("window-dim");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
#include "utils/socket.hpp"
|
#include "utils/socket.hpp"
|
||||||
#include "utils/string.hpp"
|
#include "utils/string.hpp"
|
||||||
#include "x11/connection.hpp"
|
#include "x11/connection.hpp"
|
||||||
|
#include "x11/ewmh.hpp"
|
||||||
#include "x11/icccm.hpp"
|
#include "x11/icccm.hpp"
|
||||||
|
|
||||||
POLYBAR_NS
|
POLYBAR_NS
|
||||||
@ -38,20 +39,30 @@ namespace i3_util {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get all i3 root windows
|
* Get main root window
|
||||||
*/
|
*/
|
||||||
vector<xcb_window_t> root_windows(connection& conn, const string& output_name) {
|
xcb_window_t root_window(connection& conn) {
|
||||||
vector<xcb_window_t> roots;
|
auto ewmh = ewmh_util::initialize();
|
||||||
auto children = conn.query_tree(conn.screen()->root).children();
|
auto children = conn.query_tree(conn.screen()->root).children();
|
||||||
|
|
||||||
|
const auto wm_name = [&](xcb_ewmh_connection_t* ewmh, xcb_window_t win) -> string {
|
||||||
|
string title;
|
||||||
|
if (!(title = ewmh_util::get_wm_name(ewmh, win)).empty()) {
|
||||||
|
return title;
|
||||||
|
} else if (!(title = icccm_util::get_wm_name(ewmh->connection, win)).empty()) {
|
||||||
|
return title;
|
||||||
|
} else {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
for (auto it = children.begin(); it != children.end(); it++) {
|
for (auto it = children.begin(); it != children.end(); it++) {
|
||||||
auto wm_name = icccm_util::get_wm_name(conn, *it);
|
if (wm_name(&*ewmh, *it) == "i3") {
|
||||||
if (wm_name.compare("[i3 con] output " + output_name) == 0) {
|
return *it;
|
||||||
roots.emplace_back(*it);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return roots;
|
return XCB_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -60,14 +71,13 @@ namespace i3_util {
|
|||||||
*
|
*
|
||||||
* Fixes the issue with always-on-top window's
|
* Fixes the issue with always-on-top window's
|
||||||
*/
|
*/
|
||||||
bool restack_to_root(connection& conn, const monitor_t& mon, const xcb_window_t win) {
|
bool restack_to_root(connection& conn, const xcb_window_t win) {
|
||||||
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_mask = XCB_CONFIG_WINDOW_SIBLING | XCB_CONFIG_WINDOW_STACK_MODE;
|
const uint32_t value_list[2]{root_window(conn), XCB_STACK_MODE_ABOVE};
|
||||||
const uint32_t value_list[2]{root, XCB_STACK_MODE_BELOW};
|
if (value_list[0] != XCB_NONE) {
|
||||||
conn.configure_window_checked(win, value_mask, value_list);
|
conn.configure_window_checked(win, value_mask, value_list);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user