Minor code cleanup
This commit is contained in:
@ -105,11 +105,7 @@ void Workspace::initializeWindowMap(const Json::Value &clients_data) {
|
||||
|
||||
void Workspace::setActiveWindow(WindowAddress const &addr) {
|
||||
for (auto &window : m_windowMap) {
|
||||
if (window.address == addr) {
|
||||
window.setActive(true);
|
||||
} else {
|
||||
window.setActive(false);
|
||||
}
|
||||
window.setActive(window.address == addr);
|
||||
}
|
||||
}
|
||||
|
||||
@ -244,6 +240,7 @@ void Workspace::update(const std::string &workspace_icon) {
|
||||
m_labelBefore.set_markup(fmt::format(fmt::runtime(formatBefore), fmt::arg("id", id()),
|
||||
fmt::arg("name", name()), fmt::arg("icon", workspace_icon),
|
||||
fmt::arg("windows", windows)));
|
||||
m_labelBefore.get_style_context()->add_class("workspace-label");
|
||||
|
||||
if (m_workspaceManager.enableTaskbar()) {
|
||||
updateTaskbar(workspace_icon);
|
||||
@ -261,7 +258,7 @@ void Workspace::updateTaskbar(const std::string &workspace_icon) {
|
||||
for (const auto &window_repr : m_windowMap) {
|
||||
if (isFirst) {
|
||||
isFirst = false;
|
||||
} else {
|
||||
} else if (m_workspaceManager.getWindowSeparator() != "") {
|
||||
auto windowSeparator = Gtk::make_managed<Gtk::Label>(m_workspaceManager.getWindowSeparator());
|
||||
m_content.pack_start(*windowSeparator, false, false);
|
||||
windowSeparator->show();
|
||||
|
@ -595,21 +595,13 @@ void Workspaces::onActiveWindowChanged(WindowAddress const &activeWindowAddress)
|
||||
m_currentActiveWindowAddress = activeWindowAddress;
|
||||
|
||||
for (auto &[address, window] : m_orphanWindowMap) {
|
||||
if (address == activeWindowAddress) {
|
||||
window.setActive(true);
|
||||
} else {
|
||||
window.setActive(false);
|
||||
}
|
||||
window.setActive(address == activeWindowAddress);
|
||||
}
|
||||
for (auto const &workspace : m_workspaces) {
|
||||
workspace->setActiveWindow(activeWindowAddress);
|
||||
}
|
||||
for (auto &window : m_windowsToCreate) {
|
||||
if (window.getAddress() == activeWindowAddress) {
|
||||
window.setActive(true);
|
||||
} else {
|
||||
window.setActive(false);
|
||||
}
|
||||
window.setActive(window.getAddress() == activeWindowAddress);
|
||||
}
|
||||
}
|
||||
|
||||
@ -953,7 +945,7 @@ auto Workspaces::update() -> void {
|
||||
|
||||
void Workspaces::updateWindowCount() {
|
||||
const Json::Value workspacesJson = m_ipc.getSocket1JsonReply("workspaces");
|
||||
for (auto &workspace : m_workspaces) {
|
||||
for (auto const &workspace : m_workspaces) {
|
||||
auto workspaceJson = std::ranges::find_if(workspacesJson, [&](Json::Value const &x) {
|
||||
return x["name"].asString() == workspace->name() ||
|
||||
(workspace->isSpecial() && x["name"].asString() == "special:" + workspace->name());
|
||||
|
Reference in New Issue
Block a user