aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/managers
diff options
context:
space:
mode:
authoralaricljs <[email protected]>2023-09-21 17:18:26 -0400
committerGitHub <[email protected]>2023-09-21 22:18:26 +0100
commite4ddfcfa0c944d0851feb9a359e6a224641060f7 (patch)
tree34933ec0377bced94a2924ff40c5f54dfd4a246f /src/managers
parentd41a91e050b242e53e7590e7b9267527f039b9f4 (diff)
downloadHyprland-e4ddfcfa0c944d0851feb9a359e6a224641060f7.tar.gz
Hyprland-e4ddfcfa0c944d0851feb9a359e6a224641060f7.zip
keybinds: implement pushactivetobottom dispacher (#3217)
Co-authored-by: Leeman <[email protected]>
Diffstat (limited to 'src/managers')
-rw-r--r--src/managers/KeybindManager.cpp28
-rw-r--r--src/managers/KeybindManager.hpp1
-rw-r--r--src/managers/input/InputManager.cpp2
3 files changed, 29 insertions, 2 deletions
diff --git a/src/managers/KeybindManager.cpp b/src/managers/KeybindManager.cpp
index 992e15b3..0703ba2e 100644
--- a/src/managers/KeybindManager.cpp
+++ b/src/managers/KeybindManager.cpp
@@ -63,6 +63,7 @@ CKeybindManager::CKeybindManager() {
m_mDispatchers["pin"] = pinActive;
m_mDispatchers["mouse"] = mouse;
m_mDispatchers["bringactivetotop"] = bringActiveToTop;
+ m_mDispatchers["alterzorder"] = alterZOrder;
m_mDispatchers["focusurgentorlast"] = focusUrgentOrLast;
m_mDispatchers["focuscurrentorlast"] = focusCurrentOrLast;
m_mDispatchers["lockgroups"] = lockGroups;
@@ -1910,7 +1911,32 @@ void CKeybindManager::mouse(std::string args) {
void CKeybindManager::bringActiveToTop(std::string args) {
if (g_pCompositor->m_pLastWindow && g_pCompositor->m_pLastWindow->m_bIsFloating)
- g_pCompositor->moveWindowToTop(g_pCompositor->m_pLastWindow);
+ g_pCompositor->changeWindowZOrder(g_pCompositor->m_pLastWindow, true);
+}
+
+void CKeybindManager::alterZOrder(std::string args) {
+ const auto WINDOWREGEX = args.substr(args.find_first_of(',') + 1);
+ const auto POSITION = args.substr(0, args.find_first_of(','));
+ auto PWINDOW = g_pCompositor->getWindowByRegex(WINDOWREGEX);
+
+ if (!PWINDOW && g_pCompositor->m_pLastWindow && g_pCompositor->m_pLastWindow->m_bIsFloating)
+ PWINDOW = g_pCompositor->m_pLastWindow;
+
+ if (!PWINDOW) {
+ Debug::log(ERR, "alterZOrder: no window");
+ return;
+ }
+
+ if (POSITION == "top")
+ g_pCompositor->changeWindowZOrder(PWINDOW, 1);
+ else if (POSITION == "bottom")
+ g_pCompositor->changeWindowZOrder(PWINDOW, 0);
+ else {
+ Debug::log(ERR, "alterZOrder: bad position: %s", POSITION);
+ return;
+ }
+
+ g_pInputManager->simulateMouseMovement();
}
void CKeybindManager::fakeFullscreenActive(std::string args) {
diff --git a/src/managers/KeybindManager.hpp b/src/managers/KeybindManager.hpp
index f0d39192..4a4ebeab 100644
--- a/src/managers/KeybindManager.hpp
+++ b/src/managers/KeybindManager.hpp
@@ -143,6 +143,7 @@ class CKeybindManager {
static void pinActive(std::string);
static void mouse(std::string);
static void bringActiveToTop(std::string);
+ static void alterZOrder(std::string);
static void lockGroups(std::string);
static void lockActiveGroup(std::string);
static void moveIntoGroup(std::string);
diff --git a/src/managers/input/InputManager.cpp b/src/managers/input/InputManager.cpp
index a44e4c51..3567c974 100644
--- a/src/managers/input/InputManager.cpp
+++ b/src/managers/input/InputManager.cpp
@@ -600,7 +600,7 @@ void CInputManager::processMouseDownNormal(wlr_pointer_button_event* e) {
// if clicked on a floating window make it top
if (g_pCompositor->m_pLastWindow && g_pCompositor->m_pLastWindow->m_bIsFloating)
- g_pCompositor->moveWindowToTop(g_pCompositor->m_pLastWindow);
+ g_pCompositor->changeWindowZOrder(g_pCompositor->m_pLastWindow, true);
break;
case WLR_BUTTON_RELEASED: break;