Skip to content

feat(dialog): persist global sort option - #2039

Merged
jackpot51 merged 1 commit into
pop-os:masterfrom
avnyu:state_dialog_sort_name
Sep 22, 2026
Merged

jackpot51 merged 1 commit into
pop-os:masterfrom
avnyu:state_dialog_sort_name

Conversation

@avnyu

@avnyu avnyu commented Sep 3, 2026 •

Copy link
Copy Markdown
Contributor

Required for: pop-os/xdg-desktop-portal-cosmic#258
Fixes: #1963

Allows file dialogs to save and load sort options via State.dialog_sort_name. Previously, dialogs always defaulted to descending modified time.

This PR:
Add dialog_sort_name field to State to track the dialog sort option.
Add state_handler and state fields to Dialog to load saved state.
Implement tab::Command::SetSort for Dialog to apply and persist sort
options.

Tested using the dialog example. Changing sort options updates $HOME/.local/state/cosmic/com.system76.CosmicFiles/v1/dialog_sort_name, and opening new dialogs applies the stored option.
Also tested in archlinux using xdg-cosmic-portal-cosmic package built from archlinux PKGBUILD + patch to change cosmic-files dependency to this branch.

I did use LLM for code review and grammar check. No code is generated.

  • I have disclosed use of any AI generated code in my commit messages.
    • If you are using an LLM, and do not fully understand the changes it is making to the code base, do not create a PR.
    • In our experience, AI generated code often results in overly complex code that lacks enough context for a proper fix or feature inclusion. This results in considerably longer code reviews. Due to this, AI authored or partially authored PRs may be closed without comment.
  • I understand these changes in full and will be able to respond to review comments.
  • My change is accurately described in the commit message.
  • My contribution is tested and working as described.
  • I have read the Developer Certificate of Origin and certify my contribution under its conditions.

Add dialog_sort_name field to State to track the dialog sort option.
Add state_handler and state fields to Dialog to load saved state.
Implement tab::Command::SetSort for Dialog to apply and persist sort
options.
@avnyu
avnyu force-pushed the state_dialog_sort_name branch from acf28d6 to 16ad1e0 Compare September 14, 2026 19:48
@avnyu

avnyu commented Sep 16, 2026

Copy link
Copy Markdown
Contributor Author

Hello, can I ask for review about this PR?

@mmstick
mmstick requested review from a team September 16, 2026 15:44
@jklgrasso jklgrasso self-assigned this Sep 18, 2026

@jklgrasso jklgrasso left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Regression testing passed

Checklist

Basic navigation

  • Middle-click opens directory in a new tab (not focused).
  • Open two scrollable tabs. Scroll one tab, then switch to the other tab; it should not have scrolled.
  • Hover over the top item in the folder, then scroll down until it's out of view (while still hovered).
    On scrolling back up (with the mouse in a different position), the item should not have the hover highlight.
  • Right-click an item in the sidebar. No visual change should occur with the rest of the items.
  • Remove an item from the sidebar, then re-pin it.

File operations

  • Right-click -> Create a new folder, then enter it.
  • Right-click in the empty folder -> Create a new file.
  • Navigate to the parent folder, create another new file, then drag it into the created folder.
  • Files can be renamed.
  • Files can be opened with non-default apps & browsing store for new apps works.
  • Normal right-click shows Move to trash option.
  • Shift right-click, and right-click followed by Shift, both show Permanently delete option.
    - Shift is not passed through then context menu is already open. #2062

Advanced navigation & view settings

  • Image and video thumbnails generate & display in local folders.
  • Gallery preview shows with Spacebar.
  • Details pane shows with Ctrl+Spacebar.
  • Zoom in/out and reset to default zoom work.
  • Ctrl+1 and Ctrl+2 switch between list and icon view.
  • Ctrl+H shows/hides hidden files.
  • Directories can be sorted at top or inline.
  • Settings -> Theme works.
  • Settings -> Type to Search affects behavior as designed.
  • Single-click to open setting takes effect.
  • Sorting options work.
  • Cutting, copying, and pasting files works.
  • F5 reloads current directory.
  • Left sidebar can be collapsed and expanded.

External filesystems

  • Add a network drive (e.g. SFTP) and navigate into it.
  • Plug in a USB drive; able to mount, browse, and eject.

Integrations

  • Desktop icons display as expected
  • Drag-and-drop into Firefox works

@jackpot51
jackpot51 merged commit e2cad97 into pop-os:master Sep 22, 2026
6 checks passed
@trust2k

trust2k commented Oct 2, 2026 •

Copy link
Copy Markdown

@avnyu @jackpot51, the save choose sorting selection in the file save dialog still doesn’t work after updating to version 1.9.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request] Don't force sort_name (Modified, false) in Files dialog

4 participants