mirror of
https://github.com/rad4day/Waybar.git
synced 2023-12-21 10:22:59 +01:00
feat(window): update when window title change
This commit is contained in:
parent
a9246a09eb
commit
3fdc50163d
@ -21,10 +21,11 @@ waybar::modules::sway::Window::Window(Bar &bar, Json::Value config)
|
||||
}
|
||||
auto res = ipc_recv_response(_ipcEventfd);
|
||||
auto parsed = _parser.parse(res.payload);
|
||||
if (parsed["change"] != "focus")
|
||||
return;
|
||||
if ((parsed["change"] == "focus" || parsed["change"] == "title")
|
||||
&& parsed["container"]["focused"].asBool()) {
|
||||
_window = parsed["container"]["name"].asString();
|
||||
Glib::signal_idle().connect_once(sigc::mem_fun(*this, &Window::update));
|
||||
}
|
||||
} catch (const std::exception& e) {
|
||||
std::cerr << e.what() << std::endl;
|
||||
}
|
||||
@ -34,6 +35,7 @@ waybar::modules::sway::Window::Window(Bar &bar, Json::Value config)
|
||||
auto waybar::modules::sway::Window::update() -> void
|
||||
{
|
||||
_label.set_text(_window);
|
||||
_label.set_tooltip_text(_window);
|
||||
}
|
||||
|
||||
std::string waybar::modules::sway::Window::_getFocusedNode(Json::Value nodes)
|
||||
|
Loading…
Reference in New Issue
Block a user