aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorvaxerski <[email protected]>2022-08-23 23:34:36 +0200
committervaxerski <[email protected]>2022-08-23 23:34:36 +0200
commit09f3999b1e2ad6033c93ed84849188839e335c7f (patch)
tree7847343771c650fbbac9dd60c82919ac0cc30ad6
parentfba7ed97fbb3dfe7c2a9ac45ceef2243624eaa04 (diff)
downloadHyprland-09f3999b1e2ad6033c93ed84849188839e335c7f.tar.gz
Hyprland-09f3999b1e2ad6033c93ed84849188839e335c7f.zip
Unfocus first on non-internal ws changes
-rw-r--r--src/managers/KeybindManager.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/managers/KeybindManager.cpp b/src/managers/KeybindManager.cpp
index 8d09d650..b1b51dd7 100644
--- a/src/managers/KeybindManager.cpp
+++ b/src/managers/KeybindManager.cpp
@@ -496,11 +496,15 @@ void CKeybindManager::changeworkspace(std::string args) {
// to a previous workspace.
bool isSwitchingToPrevious = false;
+ bool internal = false;
+
if (args.find("[internal]") == 0) {
workspaceToChangeTo = std::stoi(args.substr(10));
const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(workspaceToChangeTo);
if (PWORKSPACE)
workspaceName = PWORKSPACE->m_szName;
+
+ internal = true;
} else if (args.find("previous") == 0) {
const auto PCURRENTWORKSPACE = g_pCompositor->getWorkspaceByID(
g_pCompositor->m_pLastMonitor->activeWorkspace);
@@ -551,6 +555,10 @@ void CKeybindManager::changeworkspace(std::string args) {
// remove constraints
g_pInputManager->unconstrainMouse();
+ // if it's not internal, we will unfocus to prevent stuck focus
+ if (!internal)
+ g_pCompositor->focusWindow(nullptr);
+
// if it exists, we warp to it
if (g_pCompositor->getWorkspaceByID(workspaceToChangeTo)) {
const auto PMONITOR = g_pCompositor->getMonitorFromID(g_pCompositor->getWorkspaceByID(workspaceToChangeTo)->m_iMonitorID);