fix(window): pick only con title

This commit is contained in:
Alexis
2018-08-19 20:37:33 +02:00
parent 969c1ceedd
commit 8ce33e0c64
9 changed files with 16 additions and 9 deletions

View File

@ -18,7 +18,7 @@ waybar::modules::sway::Window::Window(Bar &bar, Json::Value config)
if ((parsed["change"] == "focus" || parsed["change"] == "title")
&& parsed["container"]["focused"].asBool()) {
window_ = parsed["container"]["name"].asString();
thread_.sig_update.emit();
thread_.emit();
}
} catch (const std::exception& e) {
std::cerr << e.what() << std::endl;
@ -41,7 +41,7 @@ auto waybar::modules::sway::Window::update() -> void
std::string waybar::modules::sway::Window::getFocusedNode(Json::Value nodes)
{
for (auto &node : nodes) {
if (node["focused"].asBool()) {
if (node["focused"].asBool() && node["type"] == "con") {
return node["name"].asString();
}
auto res = getFocusedNode(node["nodes"]);

View File

@ -20,7 +20,7 @@ waybar::modules::sway::Workspaces::Workspaces(Bar &bar, Json::Value config)
} else if (!workspaces_.empty()) {
ipcRecvResponse(ipc_eventfd_);
}
thread_.sig_update.emit();
thread_.emit();
} catch (const std::exception& e) {
std::cerr << e.what() << std::endl;
}