mirror of
https://github.com/rad4day/Waybar.git
synced 2023-12-21 10:22:59 +01:00
fix(window): pick only con title
This commit is contained in:
parent
969c1ceedd
commit
8ce33e0c64
@ -70,6 +70,13 @@ struct SleeperThread {
|
||||
condvar_.notify_all();
|
||||
}
|
||||
|
||||
void emit()
|
||||
{
|
||||
Glib::signal_idle().connect_once([this] {
|
||||
sig_update.emit();
|
||||
});
|
||||
}
|
||||
|
||||
~SleeperThread()
|
||||
{
|
||||
do_run_ = false;
|
||||
|
@ -33,7 +33,7 @@ waybar::modules::Battery::Battery(Json::Value config)
|
||||
if (nbytes != sizeof(event)) {
|
||||
return;
|
||||
}
|
||||
thread_.sig_update.emit();
|
||||
thread_.emit();
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -8,7 +8,7 @@ waybar::modules::Clock::Clock(Json::Value config)
|
||||
thread_.sig_update.connect(sigc::mem_fun(*this, &Clock::update));
|
||||
thread_ = [this, interval] {
|
||||
auto now = waybar::chrono::clock::now();
|
||||
thread_.sig_update.emit();
|
||||
thread_.emit();
|
||||
auto timeout = std::chrono::floor<std::chrono::seconds>(now
|
||||
+ std::chrono::seconds(interval));
|
||||
thread_.sleep_until(timeout);
|
||||
|
@ -7,7 +7,7 @@ waybar::modules::Cpu::Cpu(Json::Value config)
|
||||
uint32_t interval = config_["interval"] ? config_["inveral"].asUInt() : 10;
|
||||
thread_.sig_update.connect(sigc::mem_fun(*this, &Cpu::update));
|
||||
thread_ = [this, interval] {
|
||||
thread_.sig_update.emit();
|
||||
thread_.emit();
|
||||
thread_.sleep_for(chrono::seconds(interval));
|
||||
};
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ waybar::modules::Custom::Custom(std::string name, Json::Value config)
|
||||
}
|
||||
}
|
||||
if (can_update) {
|
||||
thread_.sig_update.emit();
|
||||
thread_.emit();
|
||||
}
|
||||
thread_.sleep_for(chrono::seconds(interval));
|
||||
};
|
||||
|
@ -7,7 +7,7 @@ waybar::modules::Memory::Memory(Json::Value config)
|
||||
uint32_t interval = config_["interval"] ? config_["inveral"].asUInt() : 30;
|
||||
thread_.sig_update.connect(sigc::mem_fun(*this, &Memory::update));
|
||||
thread_ = [this, interval] {
|
||||
thread_.sig_update.emit();
|
||||
thread_.emit();
|
||||
thread_.sleep_for(chrono::seconds(interval));
|
||||
};
|
||||
}
|
||||
|
@ -69,7 +69,7 @@ waybar::modules::Network::Network(Json::Value config)
|
||||
}
|
||||
if (need_update) {
|
||||
getInfo();
|
||||
thread_.sig_update.emit();
|
||||
thread_.emit();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -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"]);
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user