Skip to content

Skip passing sandbox env to spawned shell in Flatpak - #1116

Merged
raphamorim merged 3 commits into
raphamorim:mainfrom
ranisalt:fix-flatpak-env
May 20, 2025
Merged

raphamorim merged 3 commits into
raphamorim:mainfrom
ranisalt:fix-flatpak-env

Conversation

@ranisalt

@ranisalt ranisalt commented May 19, 2025 •

Copy link
Copy Markdown
Contributor

When passing std::env::vars_os() to the spawned shell inside a Flatpak sandbox, it ends up overriding important host environment variables with overridden values meant for the sandboxed application (in this case, Rio). Most notably, $XDG_CONFIG_HOME is overridden by the value passed to Rio, which is $HOME/.var/app/com.rioterm.Rio/config instead of $HOME/.config (or whatever value the user has set):

image

(current behavior)

There's no need to pass any environment variables to the shell outside the sandbox, they get inherited from the process that spawned the Flatpak sandbox, which is usually the user session that already has the environment properly set up:

image

(fixed behavior)

Additionally, the order of the parameters does not matter in this scenario, so I moved setting TERM_PROGRAM (now TERM and COLORTERM, since TERM_PROGRAM is for Mac) to the initial data of the vector and skip the push.

As a bonus, it now renders icons and ligatures as the shell has access to the host fonts :)

image image

@ranisalt
ranisalt marked this pull request as ready for review May 19, 2025 22:55

@raphamorim raphamorim left a comment •

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

👌

@raphamorim

Copy link
Copy Markdown
Owner

@ranisalt nice! make sense, could you also update the releases.md

@raphamorim
raphamorim merged commit 872bc03 into raphamorim:main May 20, 2025
@ranisalt
ranisalt deleted the fix-flatpak-env branch May 20, 2025 21:14
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.

2 participants