Add option for retrieving first empty workspace (#1085)

This commit is contained in:
Julian Schuler 2022-11-23 15:10:26 +01:00 committed by GitHub
parent dcb6a0425c
commit 79a9bc9076
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -244,6 +244,13 @@ int getWorkspaceIDFromString(const std::string& in, std::string& outName) {
result = WORKSPACE->m_iID;
}
outName = WORKSPACENAME;
} else if (in.find("empty") == 0) {
int id = 0;
while (++id < INT_MAX) {
const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(id);
if (!PWORKSPACE || (g_pCompositor->getWindowsOnWorkspace(id) == 0))
return id;
}
} else {
if ((in[0] == 'm' || in[0] == 'e') && (in[1] == '-' || in[1] == '+') && isNumber(in.substr(2))) {
bool onAllMonitors = in[0] == 'e';
@ -485,4 +492,4 @@ int64_t configStringToInt(const std::string& VALUE) {
return 0;
}
return stol(VALUE);
}
}