mirror of
https://github.com/hyprwm/Hyprland
synced 2024-12-22 23:09:51 +01:00
allow for pure workspace names in dispatchers
This commit is contained in:
parent
458ba3237b
commit
e3b1d3c3c5
1 changed files with 14 additions and 6 deletions
|
@ -192,7 +192,7 @@ int getWorkspaceIDFromString(const std::string& in, std::string& outName) {
|
||||||
}
|
}
|
||||||
outName = WORKSPACENAME;
|
outName = WORKSPACENAME;
|
||||||
} else {
|
} else {
|
||||||
if (in[0] == 'm' || in[0] == 'e') {
|
if ((in[0] == 'm' || in[0] == 'e') && (in[1] == '-' || in[1] == '+') && isNumber(in.substr(2))) {
|
||||||
bool onAllMonitors = in[0] == 'e';
|
bool onAllMonitors = in[0] == 'e';
|
||||||
|
|
||||||
if (!g_pCompositor->m_pLastMonitor) {
|
if (!g_pCompositor->m_pLastMonitor) {
|
||||||
|
@ -253,14 +253,22 @@ int getWorkspaceIDFromString(const std::string& in, std::string& outName) {
|
||||||
outName = g_pCompositor->getWorkspaceByID(currentID)->m_szName;
|
outName = g_pCompositor->getWorkspaceByID(currentID)->m_szName;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (g_pCompositor->m_pLastMonitor)
|
if (in[0] == '+' || in[0] == '-') {
|
||||||
result = std::max((int)getPlusMinusKeywordResult(in, g_pCompositor->m_pLastMonitor->activeWorkspace), 1);
|
if (g_pCompositor->m_pLastMonitor)
|
||||||
else if (isNumber(in))
|
result = std::max((int)getPlusMinusKeywordResult(in, g_pCompositor->m_pLastMonitor->activeWorkspace), 1);
|
||||||
|
else {
|
||||||
|
Debug::log(ERR, "Relative workspace on no mon!");
|
||||||
|
result = INT_MAX;
|
||||||
|
}
|
||||||
|
} else if (isNumber(in))
|
||||||
result = std::max(std::stoi(in), 1);
|
result = std::max(std::stoi(in), 1);
|
||||||
else {
|
else {
|
||||||
Debug::log(ERR, "Relative workspace on no mon!");
|
// maybe name
|
||||||
result = INT_MAX;
|
const auto PWORKSPACE = g_pCompositor->getWorkspaceByName(in);
|
||||||
|
if (PWORKSPACE)
|
||||||
|
result = PWORKSPACE->m_iID;
|
||||||
}
|
}
|
||||||
|
|
||||||
outName = std::to_string(result);
|
outName = std::to_string(result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue