mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-23 06:25:58 +01:00
keybinds: minor adjustments to workspace
This commit is contained in:
parent
7ec23254fd
commit
83f1616a65
1 changed files with 8 additions and 7 deletions
|
@ -736,6 +736,8 @@ void CKeybindManager::changeworkspace(std::string args) {
|
||||||
const auto PMONITOR = g_pCompositor->m_pLastMonitor;
|
const auto PMONITOR = g_pCompositor->m_pLastMonitor;
|
||||||
const auto PCURRENTWORKSPACE = g_pCompositor->getWorkspaceByID(PMONITOR->activeWorkspace);
|
const auto PCURRENTWORKSPACE = g_pCompositor->getWorkspaceByID(PMONITOR->activeWorkspace);
|
||||||
|
|
||||||
|
const bool EXPLICITPREVIOUS = args.find("previous") == 0;
|
||||||
|
|
||||||
if (args.find("previous") == 0) {
|
if (args.find("previous") == 0) {
|
||||||
// Do nothing if there's no previous workspace, otherwise switch to it.
|
// Do nothing if there's no previous workspace, otherwise switch to it.
|
||||||
if (PCURRENTWORKSPACE->m_sPrevWorkspace.iID == -1) {
|
if (PCURRENTWORKSPACE->m_sPrevWorkspace.iID == -1) {
|
||||||
|
@ -749,9 +751,6 @@ void CKeybindManager::changeworkspace(std::string args) {
|
||||||
else
|
else
|
||||||
workspaceName =
|
workspaceName =
|
||||||
PCURRENTWORKSPACE->m_sPrevWorkspace.name.empty() ? std::to_string(PCURRENTWORKSPACE->m_sPrevWorkspace.iID) : PCURRENTWORKSPACE->m_sPrevWorkspace.name;
|
PCURRENTWORKSPACE->m_sPrevWorkspace.name.empty() ? std::to_string(PCURRENTWORKSPACE->m_sPrevWorkspace.iID) : PCURRENTWORKSPACE->m_sPrevWorkspace.name;
|
||||||
|
|
||||||
if (!*PALLOWWORKSPACECYCLES)
|
|
||||||
PCURRENTWORKSPACE->m_sPrevWorkspace = {-1, ""};
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
workspaceToChangeTo = getWorkspaceIDFromString(args, workspaceName);
|
workspaceToChangeTo = getWorkspaceIDFromString(args, workspaceName);
|
||||||
|
@ -766,7 +765,7 @@ void CKeybindManager::changeworkspace(std::string args) {
|
||||||
g_pInputManager->m_bEmptyFocusCursorSet = false;
|
g_pInputManager->m_bEmptyFocusCursorSet = false;
|
||||||
|
|
||||||
if (workspaceToChangeTo == PCURRENTWORKSPACE->m_iID) {
|
if (workspaceToChangeTo == PCURRENTWORKSPACE->m_iID) {
|
||||||
if (!*PBACKANDFORTH || PCURRENTWORKSPACE->m_sPrevWorkspace.iID == -1)
|
if ((!*PBACKANDFORTH && !EXPLICITPREVIOUS) || PCURRENTWORKSPACE->m_sPrevWorkspace.iID == -1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
auto pWorkspaceToChangeTo = g_pCompositor->getWorkspaceByID(PCURRENTWORKSPACE->m_sPrevWorkspace.iID);
|
auto pWorkspaceToChangeTo = g_pCompositor->getWorkspaceByID(PCURRENTWORKSPACE->m_sPrevWorkspace.iID);
|
||||||
|
@ -793,14 +792,16 @@ void CKeybindManager::changeworkspace(std::string args) {
|
||||||
else
|
else
|
||||||
g_pCompositor->focusWindow(nullptr);
|
g_pCompositor->focusWindow(nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*PALLOWWORKSPACECYCLES)
|
|
||||||
pWorkspaceToChangeTo->m_sPrevWorkspace = {PCURRENTWORKSPACE->m_iID, PCURRENTWORKSPACE->m_szName};
|
|
||||||
} else {
|
} else {
|
||||||
pWorkspaceToChangeTo = g_pCompositor->createNewWorkspace(PCURRENTWORKSPACE->m_sPrevWorkspace.iID, PMONITOR->ID, PCURRENTWORKSPACE->m_sPrevWorkspace.name);
|
pWorkspaceToChangeTo = g_pCompositor->createNewWorkspace(PCURRENTWORKSPACE->m_sPrevWorkspace.iID, PMONITOR->ID, PCURRENTWORKSPACE->m_sPrevWorkspace.name);
|
||||||
PMONITOR->changeWorkspace(pWorkspaceToChangeTo);
|
PMONITOR->changeWorkspace(pWorkspaceToChangeTo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (*PALLOWWORKSPACECYCLES)
|
||||||
|
pWorkspaceToChangeTo->m_sPrevWorkspace = {PCURRENTWORKSPACE->m_iID, PCURRENTWORKSPACE->m_szName};
|
||||||
|
else if (!EXPLICITPREVIOUS)
|
||||||
|
pWorkspaceToChangeTo->m_sPrevWorkspace = {-1, ""};
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue