mirror of
https://github.com/hyprwm/Hyprland.git
synced 2024-09-11 13:25:42 +03:00
Unfocus first on non-internal ws changes
This commit is contained in:
parent
fba7ed97fb
commit
09f3999b1e
@ -496,11 +496,15 @@ void CKeybindManager::changeworkspace(std::string args) {
|
|||||||
// to a previous workspace.
|
// to a previous workspace.
|
||||||
bool isSwitchingToPrevious = false;
|
bool isSwitchingToPrevious = false;
|
||||||
|
|
||||||
|
bool internal = false;
|
||||||
|
|
||||||
if (args.find("[internal]") == 0) {
|
if (args.find("[internal]") == 0) {
|
||||||
workspaceToChangeTo = std::stoi(args.substr(10));
|
workspaceToChangeTo = std::stoi(args.substr(10));
|
||||||
const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(workspaceToChangeTo);
|
const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(workspaceToChangeTo);
|
||||||
if (PWORKSPACE)
|
if (PWORKSPACE)
|
||||||
workspaceName = PWORKSPACE->m_szName;
|
workspaceName = PWORKSPACE->m_szName;
|
||||||
|
|
||||||
|
internal = true;
|
||||||
} else if (args.find("previous") == 0) {
|
} else if (args.find("previous") == 0) {
|
||||||
const auto PCURRENTWORKSPACE = g_pCompositor->getWorkspaceByID(
|
const auto PCURRENTWORKSPACE = g_pCompositor->getWorkspaceByID(
|
||||||
g_pCompositor->m_pLastMonitor->activeWorkspace);
|
g_pCompositor->m_pLastMonitor->activeWorkspace);
|
||||||
@ -551,6 +555,10 @@ void CKeybindManager::changeworkspace(std::string args) {
|
|||||||
// remove constraints
|
// remove constraints
|
||||||
g_pInputManager->unconstrainMouse();
|
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 it exists, we warp to it
|
||||||
if (g_pCompositor->getWorkspaceByID(workspaceToChangeTo)) {
|
if (g_pCompositor->getWorkspaceByID(workspaceToChangeTo)) {
|
||||||
const auto PMONITOR = g_pCompositor->getMonitorFromID(g_pCompositor->getWorkspaceByID(workspaceToChangeTo)->m_iMonitorID);
|
const auto PMONITOR = g_pCompositor->getMonitorFromID(g_pCompositor->getWorkspaceByID(workspaceToChangeTo)->m_iMonitorID);
|
||||||
|
Loading…
Reference in New Issue
Block a user