Desktop/history: Move history to desktop (#12676)

This commit is contained in:
Vaxry 2025-12-20 22:16:13 +00:00 committed by GitHub
parent 70f54a1e1b
commit b9bef69554
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
17 changed files with 372 additions and 181 deletions

View file

@ -45,6 +45,7 @@ using namespace Hyprutils::OS;
#include "helpers/MiscFunctions.hpp"
#include "../desktop/view/LayerSurface.hpp"
#include "../desktop/rule/Engine.hpp"
#include "../desktop/history/WindowHistoryTracker.hpp"
#include "../desktop/state/FocusState.hpp"
#include "../version.h"
@ -354,9 +355,10 @@ static std::string getGroupedData(PHLWINDOW w, eHyprCtlOutputFormat format) {
std::string CHyprCtl::getWindowData(PHLWINDOW w, eHyprCtlOutputFormat format) {
auto getFocusHistoryID = [](PHLWINDOW wnd) -> int {
for (size_t i = 0; i < Desktop::focusState()->windowHistory().size(); ++i) {
if (Desktop::focusState()->windowHistory()[i].lock() == wnd)
return i;
const auto& HISTORY = Desktop::History::windowTracker()->fullHistory();
for (size_t i = 0; i < HISTORY.size(); ++i) {
if (HISTORY[i].lock() == wnd)
return HISTORY.size() - i - 1; // reverse order for backwards compat
}
return -1;
};