diff --git a/README.md b/README.md
index f295dd2..2f98da0 100644
--- a/README.md
+++ b/README.md
@@ -10,6 +10,10 @@ While Wayland is the future
I still want Xorg
+# Stuff fixed/added so far
+- Workspace animation direction
+- Relative workspace switching
+
diff --git a/src/KeybindManager.cpp b/src/KeybindManager.cpp
index f399bff..77363d8 100644
--- a/src/KeybindManager.cpp
+++ b/src/KeybindManager.cpp
@@ -171,6 +171,18 @@ void KeybindManager::movefocus(std::string arg) {
g_pWindowManager->moveActiveFocusTo(arg[0]);
}
+void KeybindManager::movetorelativeworkspace(std::string arg) {
+ try {
+ if (arg == "+")
+ g_pWindowManager->moveActiveWindowToRelativeWorkspace(1);
+ else if (arg == "-")
+ g_pWindowManager->moveActiveWindowToRelativeWorkspace(-1);
+ } catch (...) {
+ Debug::log(ERR, "Invalid arg in movetoworkspace, arg: " + arg);
+ }
+
+}
+
void KeybindManager::movetoworkspace(std::string arg) {
try {
if (arg == "scratchpad")
diff --git a/src/KeybindManager.hpp b/src/KeybindManager.hpp
index 30bba23..deb3ba1 100644
--- a/src/KeybindManager.hpp
+++ b/src/KeybindManager.hpp
@@ -28,6 +28,7 @@ namespace KeybindManager {
void toggleActiveWindowFullscreen(std::string args);
void toggleActiveWindowFloating(std::string args);
void movetoworkspace(std::string args);
+ void movetorelativeworkspace(std::string args);
void changeSplitRatio(std::string args);
void togglePseudoActive(std::string args);
void toggleScratchpad(std::string args);
diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp
index c387e49..1870981 100644
--- a/src/config/ConfigManager.cpp
+++ b/src/config/ConfigManager.cpp
@@ -129,6 +129,7 @@ void handleBind(const std::string& command, const std::string& value) {
if (HANDLER == "movewindow") dispatcher = KeybindManager::movewindow;
if (HANDLER == "movefocus") dispatcher = KeybindManager::movefocus;
if (HANDLER == "movetoworkspace") dispatcher = KeybindManager::movetoworkspace;
+ if (HANDLER == "movetorelativeworkspace") dispatcher = KeybindManager::movetorelativeworkspace;
if (HANDLER == "workspace" || HANDLER == "ws") dispatcher = KeybindManager::changeworkspace;
if (HANDLER == "relativeworkspace") dispatcher = KeybindManager::changetorelativeworkspace;
if (HANDLER == "lastworkspace") dispatcher = KeybindManager::changetolastworkspace;
diff --git a/src/windowManager.cpp b/src/windowManager.cpp
index 39a2d2e..a96a779 100644
--- a/src/windowManager.cpp
+++ b/src/windowManager.cpp
@@ -1553,6 +1553,12 @@ void CWindowManager::warpCursorTo(Vector2D to) {
free(pointerreply);
}
+void CWindowManager::moveActiveWindowToRelativeWorkspace(int relativenum) {
+ if (activeWorkspaceID + relativenum < lowerWorkspaceLimit) return;
+ if (activeWorkspaceID + relativenum > upperWorkspaceLimit) return;
+ moveActiveWindowToWorkspace(activeWorkspaceID + relativenum);
+}
+
void CWindowManager::moveActiveWindowToWorkspace(int workspace) {
auto PWINDOW = getWindowFromDrawable(LastWindow);
diff --git a/src/windowManager.hpp b/src/windowManager.hpp
index b646aaa..1464ca2 100644
--- a/src/windowManager.hpp
+++ b/src/windowManager.hpp
@@ -96,6 +96,7 @@ public:
void moveActiveWindowTo(char);
void moveActiveFocusTo(char);
void moveActiveWindowToWorkspace(int);
+ void moveActiveWindowToRelativeWorkspace(int);
void warpCursorTo(Vector2D);
void toggleWindowFullscrenn(const int&);
void recalcAllDocks();