Skip to content

fix(base): follow the XDG base directory specification in paths - #43

Closed
scriptk1d wants to merge 2 commits into
cutefishos:mainfrom
scriptk1d:main
Closed

scriptk1d wants to merge 2 commits into
cutefishos:mainfrom
scriptk1d:main

Conversation

@scriptk1d

@scriptk1d scriptk1d commented Oct 23, 2026 •

Copy link
Copy Markdown

Problem

base::paths hardcoded every directory instead of reading the environment:

  • dataHome() -> ~/.local/share, dataDirectories() -> /usr/local/share:/usr/share
  • configHome() -> ~/.config, configDirectories() -> /etc/xdg
  • cacheHome() -> ~/.cache, stateHome() -> ~/.local/state
  • runtimeDirectory() -> /run/user/<uid>

Two visible consequences:

  1. Everything built on the application registry — the launcher, the switcher,
    the task manager — cannot see applications installed anywhere else. On
    distributions using Flatpak, every .desktop file lives outside the
    hardcoded data directories (/var/lib/flatpak/exports/share,
    ~/.local/share/flatpak/exports/share), so Flatpak applications never show
    up in the launcher.
  2. A user or deployment that sets XDG_CONFIG_HOME, XDG_CACHE_HOME,
    XDG_STATE_HOME, XDG_RUNTIME_DIR, XDG_CONFIG_DIRS or XDG_DATA_DIRS
    gets a split desktop: Qt applications follow the variables, Cutefish's own
    do not.

Fix

Read each variable when it is set and non-empty and keep the previous defaults
as the fallback, as the XDG base directory specification describes. The two directory
lists are parsed with shared rules: empty entries drop out, the remaining
entries keep their order, duplicates collapse.

Testing

Fedora 44:

  • with XDG_DATA_DIRS unset/empty the directories are exactly the previous
    defaults;
  • with XDG_DATA_DIRS=/d1::/d2 the registry scans /d1 and /d2 (empty entry
    skipped, duplicates collapsed);
  • after re-login into the Cutefish session with /etc/profile.d/flatpak.sh
    in place (scriptk1d/cutefish-core#52), the launcher lists Flatpak
    applications that were missing before.

dataDirectories() hardcoded /usr/local/share and /usr/share, so the
launcher, the switcher and every other registry user missed the
directories Flatpak exports its applications to (/var/lib/flatpak and
~/.local/share/flatpak). Read the environment as the XDG base directory
spec describes, with the same defaults when it is unset or empty.
…ing paths

configHome(), cacheHome(), stateHome() and runtimeDirectory() hardcoded
the per-user defaults and configDirectories() hardcoded /etc/xdg, so a
user or deployment that sets XDG_CONFIG_HOME, XDG_CACHE_HOME,
XDG_STATE_HOME, XDG_RUNTIME_DIR or XDG_CONFIG_DIRS gets a split: Qt
applications follow the variables, Cutefish's own do not.

Read every variable when it is set and non-empty, keep the previous
defaults as fallback, and parse the two directory lists with the same
rules as dataDirectories(): empty entries drop out, the rest keep their
order, duplicates collapse.
@scriptk1d scriptk1d changed the title fix(base): honor XDG_DATA_HOME and XDG_DATA_DIRS in the paths fix(base): follow the XDG base directory specification in paths Oct 23, 2026
@scriptk1d scriptk1d closed this by deleting the head repository Oct 25, 2026
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.

1 participant