Skip to content

Fix mimeapps.list corruption from QSettings escaping - #104

Merged
dim-ghub merged 2 commits into
AstraSuite:mainfrom
swopnil7:fix-mimeapps-qsettings-corruption
Oct 7, 2026
Merged

dim-ghub merged 2 commits into
AstraSuite:mainfrom
swopnil7:fix-mimeapps-qsettings-corruption

Conversation

@swopnil7

Copy link
Copy Markdown
Contributor

Fixes #100.

setDefaultApp() wrote mimeapps.list via QSettings(IniFormat), which
escapes to [Added%20Associations] / application\\json — unreadable to
gio, xdg-mime, and GTK, so every default set in Atlas silently broke
everywhere except Atlas (QSettings unescapes its own writes, hiding it).

This replaces the read/write path with a small spec-compliant INI
parse/mutate/serialize (atomic via QSaveFile), migrates legacy mangled
entries on first write, treats Default values as ;-lists, strips
Removed Associations, and drops the redundant xdg-mime spawn.

Before: [Added%20Associations] + application\\pdf=chromium.desktop
After: [Default Applications] + application/pdf=helium.desktop

Tested the usual flows (fresh file, changing defaults, old mangled file,
unreadable file) and confirmed with gio mime that the written file
resolves correctly.

@dim-ghub
dim-ghub merged commit 9f9837d into AstraSuite:main Oct 7, 2026
2 checks passed
Better-Than-You added a commit to Better-Than-You/Atlas that referenced this pull request Oct 10, 2026
Replace our hand-rolled Default/Added-association writer with the more
robust implementation merged upstream (AstraSuite/Atlas PR AstraSuite#104, commit
9f9837d): a plain-XDG MimeappsData model, parseMimeapps/writeMimeapps
helpers, migration of group/key names previously mangled by
QSettings::IniFormat, and Removed Associations handling.

setDefaultApp now reports success (bool) and warns when a per-desktop
* -mimeapps.list shadows the shared file.

Our extra behaviour is preserved on top of it:
- desktop entries are still parsed by hand so multi-valued MimeType
  fields are not collapsed by QSettings
- NoDisplay handlers (e.g. swappy) still appear in Open With and can be
  resolved as defaults
- setting a default still registers the whole MIME group the app
  declares
- Terminal=true entries are still launched in a terminal emulator
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.

File associations corrupt ~/.config/mimeapps.list

2 participants