mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-26 16:06:00 +01:00
keybinds: add empty on monitor and next empty flags (#5936)
* empty on monitor * add flag for next empty * clang-format changes * next also uses m_pLastMonitor
This commit is contained in:
parent
70b5e6df70
commit
36d32973dd
1 changed files with 10 additions and 2 deletions
|
@ -282,10 +282,18 @@ int getWorkspaceIDFromString(const std::string& in, std::string& outName) {
|
||||||
}
|
}
|
||||||
outName = WORKSPACENAME;
|
outName = WORKSPACENAME;
|
||||||
} else if (in.starts_with("empty")) {
|
} else if (in.starts_with("empty")) {
|
||||||
int id = 0;
|
const bool same_mon = in.substr(5).contains("m");
|
||||||
|
const bool next = in.substr(5).contains("n");
|
||||||
|
if (same_mon || next) {
|
||||||
|
if (!g_pCompositor->m_pLastMonitor) {
|
||||||
|
Debug::log(ERR, "Empty monitor workspace on monitor null!");
|
||||||
|
return WORKSPACE_INVALID;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
int id = next ? g_pCompositor->m_pLastMonitor->activeWorkspaceID() : 0;
|
||||||
while (++id < INT_MAX) {
|
while (++id < INT_MAX) {
|
||||||
const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(id);
|
const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(id);
|
||||||
if (!PWORKSPACE || (g_pCompositor->getWindowsOnWorkspace(id) == 0))
|
if (!PWORKSPACE || (g_pCompositor->getWindowsOnWorkspace(id) == 0 && (!same_mon || PWORKSPACE->m_iMonitorID == g_pCompositor->m_pLastMonitor->ID)))
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
} else if (in.starts_with("prev")) {
|
} else if (in.starts_with("prev")) {
|
||||||
|
|
Loading…
Reference in a new issue