summaryrefslogtreecommitdiff
path: root/src/managers/KeybindManager.cpp
diff options
context:
space:
mode:
authorMaarten de Vries <maarten@de-vri.es>2024-04-17 13:04:16 +0200
committerGitHub <noreply@github.com>2024-04-17 12:04:16 +0100
commite57a2d7ec87ae775828ea8628ef4eeafce8e6e70 (patch)
tree45e5f30a7e463924a380bb3394ba314667efc7bc /src/managers/KeybindManager.cpp
parente8e02e81e84bb04efa0c926361ec80c60744f665 (diff)
keybindmgr: add optional `silent` suffix to `movewindow`. (#5597)
With the `silent` suffix, the focus remains on the current position in the layout or the current monitor, instead of following the moved window. When combined with `movewindow mon:X`, this this allows you to get the same behavior as xmonad's `windowToScreen` command.
Diffstat (limited to 'src/managers/KeybindManager.cpp')
-rw-r--r--src/managers/KeybindManager.cpp22
1 files changed, 15 insertions, 7 deletions
diff --git a/src/managers/KeybindManager.cpp b/src/managers/KeybindManager.cpp
index 1a97c3da..e6d54ae1 100644
--- a/src/managers/KeybindManager.cpp
+++ b/src/managers/KeybindManager.cpp
@@ -1216,15 +1216,20 @@ void CKeybindManager::swapActive(std::string args) {
}
void CKeybindManager::moveActiveTo(std::string args) {
- char arg = args[0];
+ char arg = args[0];
+ bool silent = args.ends_with(" silent");
+ if (silent)
+ args = args.substr(0, args.length() - 7);
if (args.starts_with("mon:")) {
const auto PNEWMONITOR = g_pCompositor->getMonitorFromString(args.substr(4));
if (!PNEWMONITOR)
return;
- moveActiveToWorkspace(PNEWMONITOR->activeWorkspace->getConfigName());
- return;
+ if (silent)
+ moveActiveToWorkspaceSilent(PNEWMONITOR->activeWorkspace->getConfigName());
+ else
+ moveActiveToWorkspace(PNEWMONITOR->activeWorkspace->getConfigName());
}
if (!isDirection(args)) {
@@ -1258,8 +1263,9 @@ void CKeybindManager::moveActiveTo(std::string args) {
// If the window to change to is on the same workspace, switch them
const auto PWINDOWTOCHANGETO = g_pCompositor->getWindowInDirection(PLASTWINDOW, arg);
if (PWINDOWTOCHANGETO) {
- g_pLayoutManager->getCurrentLayout()->moveWindowTo(PLASTWINDOW, args);
- g_pCompositor->warpCursorTo(PLASTWINDOW->middle());
+ g_pLayoutManager->getCurrentLayout()->moveWindowTo(PLASTWINDOW, args, silent);
+ if (!silent)
+ g_pCompositor->warpCursorTo(PLASTWINDOW->middle());
return;
}
@@ -1269,8 +1275,10 @@ void CKeybindManager::moveActiveTo(std::string args) {
return;
const auto PWORKSPACE = PMONITORTOCHANGETO->activeWorkspace;
-
- moveActiveToWorkspace(PWORKSPACE->getConfigName());
+ if (silent)
+ moveActiveToWorkspaceSilent(PWORKSPACE->getConfigName());
+ else
+ moveActiveToWorkspace(PWORKSPACE->getConfigName());
}
void CKeybindManager::toggleGroup(std::string args) {