fix(xworkspaces): Show _NET_NUMBER_OF_DESKTOPS desktops

In the case where _NET_NUMBER_OF_DESKTOPS > |_NET_DESKTOP_NAMES|
the last branch of the get_desktop_names method would return a vector
with _NET_NUMBER_OF_DESKTOPS + 1 elements because we iterate until
_NET_NUMBER_OF_DESKTOPS + 1.

Fixes #1983
This commit is contained in:
patrick96 2020-01-07 13:40:24 +01:00 committed by Patrick Ziegler
parent 51f9f35599
commit 3854fc91b5

View File

@ -5,13 +5,12 @@
#include "drawtypes/iconset.hpp" #include "drawtypes/iconset.hpp"
#include "drawtypes/label.hpp" #include "drawtypes/label.hpp"
#include "modules/meta/base.inl"
#include "utils/factory.hpp" #include "utils/factory.hpp"
#include "utils/math.hpp" #include "utils/math.hpp"
#include "x11/atoms.hpp" #include "x11/atoms.hpp"
#include "x11/connection.hpp" #include "x11/connection.hpp"
#include "modules/meta/base.inl"
POLYBAR_NS POLYBAR_NS
namespace { namespace {
@ -240,8 +239,8 @@ namespace modules {
names.erase(names.begin() + desktops_number, names.end()); names.erase(names.begin() + desktops_number, names.end());
return names; return names;
} }
for (unsigned int i = names.size(); i < desktops_number + 1; i++) { for (unsigned int i = names.size(); i < desktops_number; i++) {
names.insert(names.end(), to_string(i)); names.insert(names.end(), to_string(i + 1));
} }
return names; return names;
} }