Skip to content

Commit

Permalink
Preserve the order of tabs when reopening Wolvic
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
felipeerias committed Feb 4, 2025
1 parent 1e871dd commit 594ca22
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,14 @@ private void saveStateOnDiskIO() {
WindowsState state = new WindowsState();
state.privateMode = mPrivateMode;
state.focusedWindowPlacement = mFocusedWindow.isFullScreen() ? mFocusedWindow.getWindowPlacementBeforeFullscreen() : mFocusedWindow.getWindowPlacement();
ArrayList<Session> sessions = SessionStore.get().getSortedSessions(false);
List<Session> 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 ->
Expand Down

0 comments on commit 594ca22

Please sign in to comment.