Files
flatpak/profile
qweered 3891a228c6 profile: Skip flatpak --installations for fish if already in XDG_DATA_DIRS
Sourcing profile/flatpak.fish spawns `flatpak --installations` on every
fish shell startup, which costs ~15 ms on a typical desktop and
dominates fish's non-interactive init time when flatpak is installed.

On any system where the login stack (pam_env, systemd user session,
distro-specific init) has already populated XDG_DATA_DIRS with the
canonical user flatpak export path, this spawn is redundant: the
subsequent `contains` loop would be a no-op because the canonical
entry is already there.

Add a fast-path guard that checks for `$XDG_DATA_HOME/flatpak/exports/share`
(falling back to `$HOME/.local/share/flatpak/exports/share` when
XDG_DATA_HOME is unset) at the top of the script. When present, skip
the slow path entirely.

The slow path is preserved verbatim for sessions where the canonical
entry is missing — e.g. a freshly-created user, or environments where
session init hasn't populated XDG_DATA_DIRS yet — so custom
installations configured via /etc/flatpak/installations.d/*.conf are
still discovered in that case.

Measured on Linux with `hyperfine --warmup 5 'fish -c exit'`:
  before: ~23 ms of startup spent in `flatpak --installations`
  after:  ~10 us (a single `contains` check) on the common path.
2026-05-27 14:34:21 +00:00
..
2025-05-07 17:54:28 +00:00
2024-06-04 17:23:32 +01:00