revert(workspaces): ipc command out of update func
This commit is contained in:
parent
8ce33e0c64
commit
b7e3d10fb7
|
@ -20,6 +20,9 @@ waybar::modules::sway::Workspaces::Workspaces(Bar &bar, Json::Value config)
|
||||||
} else if (!workspaces_.empty()) {
|
} else if (!workspaces_.empty()) {
|
||||||
ipcRecvResponse(ipc_eventfd_);
|
ipcRecvResponse(ipc_eventfd_);
|
||||||
}
|
}
|
||||||
|
std::lock_guard<std::mutex> lock(mutex_);
|
||||||
|
auto res = ipcSingleCommand(ipcfd_, IPC_GET_WORKSPACES, "");
|
||||||
|
workspaces_ = parser_.parse(res.payload);
|
||||||
thread_.emit();
|
thread_.emit();
|
||||||
} catch (const std::exception& e) {
|
} catch (const std::exception& e) {
|
||||||
std::cerr << e.what() << std::endl;
|
std::cerr << e.what() << std::endl;
|
||||||
|
@ -36,8 +39,6 @@ waybar::modules::sway::Workspaces::~Workspaces()
|
||||||
auto waybar::modules::sway::Workspaces::update() -> void
|
auto waybar::modules::sway::Workspaces::update() -> void
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> lock(mutex_);
|
std::lock_guard<std::mutex> lock(mutex_);
|
||||||
auto res = ipcSingleCommand(ipcfd_, IPC_GET_WORKSPACES, "");
|
|
||||||
workspaces_ = parser_.parse(res.payload);
|
|
||||||
bool needReorder = false;
|
bool needReorder = false;
|
||||||
for (auto it = buttons_.begin(); it != buttons_.end();) {
|
for (auto it = buttons_.begin(); it != buttons_.end();) {
|
||||||
auto ws = std::find_if(workspaces_.begin(), workspaces_.end(),
|
auto ws = std::find_if(workspaces_.begin(), workspaces_.end(),
|
||||||
|
|
Loading…
Reference in New Issue