diff options
| author | Vaxry <vaxry@vaxry.net> | 2025-12-23 15:04:56 +0100 |
|---|---|---|
| committer | Vaxry <vaxry@vaxry.net> | 2025-12-23 15:04:56 +0100 |
| commit | f7f357f15f83612078eb0919ca08b71cac01c25e (patch) | |
| tree | 429d932316738748e1eb7c16b1abffb62ed1f8d3 /src/managers/KeybindManager.cpp | |
| parent | abffe75088e2d776e14e5dbd726a835fa157df9a (diff) | |
keybindmgr: fix focusCurrentOrLast
Diffstat (limited to 'src/managers/KeybindManager.cpp')
| -rw-r--r-- | src/managers/KeybindManager.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/managers/KeybindManager.cpp b/src/managers/KeybindManager.cpp index c4d8734e..dbfa4558 100644 --- a/src/managers/KeybindManager.cpp +++ b/src/managers/KeybindManager.cpp @@ -1576,8 +1576,12 @@ SDispatchResult CKeybindManager::focusUrgentOrLast(std::string args) { } SDispatchResult CKeybindManager::focusCurrentOrLast(std::string args) { - const auto& HISTORY = Desktop::History::windowTracker()->fullHistory(); - const auto PWINDOWPREV = Desktop::focusState()->window() ? (HISTORY.size() < 2 ? nullptr : HISTORY[1].lock()) : (HISTORY.empty() ? nullptr : HISTORY[0].lock()); + const auto& HISTORY = Desktop::History::windowTracker()->fullHistory(); + + if (HISTORY.size() <= 1) + return {.success = false, .error = "History too short"}; + + const auto PWINDOWPREV = HISTORY[HISTORY.size() - 2].lock(); if (!PWINDOWPREV) return {.success = false, .error = "Window not found"}; |
