aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authoralaricljs <[email protected]>2023-09-11 05:23:57 -0400
committerGitHub <[email protected]>2023-09-11 10:23:57 +0100
commit99fac5993892e2ef82d40f333ac73ac6a8fdd899 (patch)
tree07abd1d89cd728617b987c120d8d97f4b7866bc1
parente96e0dc02d9368580100bbabd8f098746a42af6b (diff)
downloadHyprland-99fac5993892e2ef82d40f333ac73ac6a8fdd899.tar.gz
Hyprland-99fac5993892e2ef82d40f333ac73ac6a8fdd899.zip
keybinds: movewindow to screen edge for floating windows (#3245)
* movewindow to screen edge for floating windows * review changes * constify vars --------- Co-authored-by: Leeman <[email protected]> Co-authored-by: vaxerski <[email protected]>
-rw-r--r--src/managers/KeybindManager.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/managers/KeybindManager.cpp b/src/managers/KeybindManager.cpp
index 60163150..72fa559e 100644
--- a/src/managers/KeybindManager.cpp
+++ b/src/managers/KeybindManager.cpp
@@ -1136,6 +1136,24 @@ void CKeybindManager::moveActiveTo(std::string args) {
if (!PLASTWINDOW || PLASTWINDOW->m_bIsFullscreen)
return;
+ if (PLASTWINDOW->m_bIsFloating) {
+ auto vPos = PLASTWINDOW->m_vRealPosition.goalv();
+ const auto PMONITOR = g_pCompositor->getMonitorFromID(PLASTWINDOW->m_iMonitorID);
+ const auto BORDERSIZE = PLASTWINDOW->getRealBorderSize();
+
+ switch (arg) {
+ case 'l': vPos.x = PMONITOR->vecReservedTopLeft.x + BORDERSIZE; break;
+ case 'r': vPos.x = PMONITOR->vecSize.x - PMONITOR->vecReservedBottomRight.x - PLASTWINDOW->m_vRealSize.goalv().x - BORDERSIZE; break;
+ case 't':
+ case 'u': vPos.y = PMONITOR->vecReservedTopLeft.y + BORDERSIZE; break;
+ case 'b':
+ case 'd': vPos.y = PMONITOR->vecSize.y - PMONITOR->vecReservedBottomRight.y - PLASTWINDOW->m_vRealSize.goalv().y - BORDERSIZE; break;
+ }
+
+ PLASTWINDOW->m_vRealPosition = vPos + PMONITOR->vecPosition;
+ return;
+ }
+
// If the window to change to is on the same workspace, switch them
const auto PWINDOWTOCHANGETO = g_pCompositor->getWindowInDirection(PLASTWINDOW, arg);
if (PWINDOWTOCHANGETO) {