diff --git a/include/modules/xworkspaces.hpp b/include/modules/xworkspaces.hpp index 495ed8ee..6d07571f 100644 --- a/include/modules/xworkspaces.hpp +++ b/include/modules/xworkspaces.hpp @@ -33,10 +33,9 @@ namespace modules { }; struct desktop { - explicit desktop(unsigned int index, unsigned int offset, desktop_state state, label_t&& label) - : index(index), offset(offset), state(state), label(label) {} + explicit desktop(unsigned int index, desktop_state state, label_t&& label) + : index(index), state(state), label(label) {} unsigned int index; - unsigned int offset; desktop_state state; label_t label; }; diff --git a/src/modules/xworkspaces.cpp b/src/modules/xworkspaces.cpp index d6a1d496..8709e118 100644 --- a/src/modules/xworkspaces.cpp +++ b/src/modules/xworkspaces.cpp @@ -225,7 +225,7 @@ namespace modules { for (size_t i = 0; i < ws_positions.size(); i++) { auto&& ws_pos = ws_positions[i]; if (ws_pos == viewport_pos) { - viewport->desktops.emplace_back(make_unique(i, 0, desktop_state::EMPTY, label_t{})); + viewport->desktops.emplace_back(make_unique(i, desktop_state::EMPTY, label_t{})); } } @@ -255,7 +255,7 @@ namespace modules { d->label = m_labels.at(d->state)->clone(); d->label->reset_tokens(); - d->label->replace_token("%index%", to_string(d->index - d->offset + 1)); + d->label->replace_token("%index%", to_string(d->index + 1)); d->label->replace_token("%name%", m_desktop_names[d->index]); d->label->replace_token("%icon%", m_icons->get(m_desktop_names[d->index], DEFAULT_ICON)->get()); } @@ -292,7 +292,7 @@ namespace modules { d->label = m_labels.at(d->state)->clone(); d->label->reset_tokens(); - d->label->replace_token("%index%", to_string(d->index - d->offset + 1)); + d->label->replace_token("%index%", to_string(d->index + 1)); d->label->replace_token("%name%", m_desktop_names[d->index]); d->label->replace_token("%icon%", m_icons->get(m_desktop_names[d->index], DEFAULT_ICON)->get()); return;