From 594ca225e0d70543d6d7abec2a7ee58e13e9dbc9 Mon Sep 17 00:00:00 2001 From: Felipe Erias Date: Tue, 4 Feb 2025 20:25:09 +0900 Subject: [PATCH] Preserve the order of tabs when reopening Wolvic Tabs in the tray are sorted by recently used, while tabs in the visible bars have a fixed placement. In order to preserve the tab order between Wolvic sessions, we take the location of tabs into account when storing the list of tabs to disk. --- .../shared/com/igalia/wolvic/ui/widgets/Windows.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/src/common/shared/com/igalia/wolvic/ui/widgets/Windows.java b/app/src/common/shared/com/igalia/wolvic/ui/widgets/Windows.java index 03f67c4ce0..04d405dc5b 100644 --- a/app/src/common/shared/com/igalia/wolvic/ui/widgets/Windows.java +++ b/app/src/common/shared/com/igalia/wolvic/ui/widgets/Windows.java @@ -238,7 +238,14 @@ private void saveStateOnDiskIO() { WindowsState state = new WindowsState(); state.privateMode = mPrivateMode; state.focusedWindowPlacement = mFocusedWindow.isFullScreen() ? mFocusedWindow.getWindowPlacementBeforeFullscreen() : mFocusedWindow.getWindowPlacement(); - ArrayList sessions = SessionStore.get().getSortedSessions(false); + List sessions; + if (SettingsStore.getInstance(mContext).getTabsLocation() == SettingsStore.TABS_LOCATION_TRAY) { + // Tabs in the tray are sorted by recently used, so we preserve their current order. + sessions = SessionStore.get().getSortedSessions(false); + } else { + // Tabs in the visible bars keep a fixed order. + sessions = SessionStore.get().getSessions(false); + } state.tabs = sessions.stream() .map(Session::getSessionState) .filter(sessionState -> HistoryStore.getBLOCK_LIST().stream().noneMatch(uri ->