aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorvaxerski <[email protected]>2023-02-09 14:15:42 +0000
committervaxerski <[email protected]>2023-02-09 14:15:42 +0000
commit4ea4efb871997a245539cae9d966ec8f07d3e907 (patch)
tree3a928ee4675e15a4a7f002c7232ed708a5fec0ae
parent48c86ad863017226503e02ceb2113415beb69c81 (diff)
downloadHyprland-4ea4efb871997a245539cae9d966ec8f07d3e907.tar.gz
Hyprland-4ea4efb871997a245539cae9d966ec8f07d3e907.zip
add prev to getWorkspaceIDFromString
-rw-r--r--src/helpers/MiscFunctions.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/helpers/MiscFunctions.cpp b/src/helpers/MiscFunctions.cpp
index 88e6fa51..40121de3 100644
--- a/src/helpers/MiscFunctions.cpp
+++ b/src/helpers/MiscFunctions.cpp
@@ -288,6 +288,22 @@ int getWorkspaceIDFromString(const std::string& in, std::string& outName) {
if (!PWORKSPACE || (g_pCompositor->getWindowsOnWorkspace(id) == 0))
return id;
}
+ } else if (in.find("prev") == 0) {
+ if (!g_pCompositor->m_pLastMonitor)
+ return INT_MAX;
+
+ const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(g_pCompositor->m_pLastMonitor->activeWorkspace);
+
+ if (!PWORKSPACE)
+ return INT_MAX;
+
+ const auto PLASTWORKSPACE = g_pCompositor->getWorkspaceByID(PWORKSPACE->m_iPrevWorkspaceID);
+
+ if (!PLASTWORKSPACE)
+ return INT_MAX;
+
+ outName = PLASTWORKSPACE->m_szName;
+ return PLASTWORKSPACE->m_iID;
} else {
if ((in[0] == 'm' || in[0] == 'e') && (in[1] == '-' || in[1] == '+') && isNumber(in.substr(2))) {
bool onAllMonitors = in[0] == 'e';