Skip to content

fix(open): start launched programs in the folder of the opened file - #1990

Merged
l0gicgate merged 2 commits into
lgse:mainfrom
Bluesboy:fix/launch-in-file-folder
Nov 1, 2026
Merged

l0gicgate merged 2 commits into
lgse:mainfrom
Bluesboy:fix/launch-in-file-folder

Conversation

@Bluesboy

@Bluesboy Bluesboy commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

Description

Programs opened from Strata started in / (#1989). leave_launch_folder() moves Strata to / at startup so it never keeps a mount busy (#1729), and gio::AppInfo::launch spawns a program with the parent's working directory unless its desktop entry sets Path, so every launched program inherited /.

launch_with_recent_registration, which every Open and Open With launch goes through, now calls launch_in_folder. It enters the folder of the first file, launches, and returns to the previous folder right away. GIO spawns synchronously inside launch, so the child starts in the file's folder while Strata leaves it as soon as launch returns and still keeps no mount busy. Files without a local path, and a folder Strata cannot enter, launch as before. A desktop entry's Path still wins, and D-Bus activated applications are unaffected.

Open in Terminal already passes its folder explicitly and is unchanged. URI launches (launch_default_for_uri for links and help pages) have no file folder and are unchanged.

Test, failing without the change:

  • ui::open_with::tests::launched_programs_start_in_the_folder_of_the_first_file launches sh -c 'pwd > started-in' sh %f on a file in a temporary folder, checks that the test process is back in its own folder, and that the program wrote the file's folder.

Visual evidence

Not a visual change.

How to test

  1. Open a folder, for example ~/notes, and open a text file in it with a GUI editor such as Neovide or gVim.
  2. Run :pwd in the editor: it prints ~/notes, not /.
  3. Open a file on a removable drive with an editor, close the editor, and unmount the drive while Strata stays open: it unmounts, Strata does not keep it busy.

Related issue

Fixes #1989

Strata moves to / at startup so it never keeps a mount busy, and GIO
spawns programs with the parent's working directory unless the desktop
entry sets Path. Every program opened from Strata therefore started in /.

Enter the folder of the first file around the synchronous GIO launch and
return right after, so the program starts where a shell would start it
while Strata still holds no folder.
@github-actions github-actions Bot added the fix label Nov 1, 2026
Strata's working folder stays `/`, but Open and Open With now start the
program in the first file's folder, so the filesystem-compatibility notes
must no longer say launched programs start in `/`. Tighten the helper's
doc comment to the rationale alone.
@l0gicgate

Copy link
Copy Markdown
Contributor

Review pass (merged main at 0f9bb00, already the PR's base, so no merge commit was needed).

What I changed (bb3aa90)

  • docs/filesystem-compatibility.md still said a program started by Open With begins in /. That is exactly the behaviour this PR removes, so the note now describes the new rule: the program starts in the first file's folder unless its desktop entry sets Path, Strata enters that folder only while GIO spawns and returns to / immediately, and files without a local path or a folder Strata cannot enter leave the program in /.
  • Tightened the launch_in_folder doc comment to the rationale alone.

Review notes, no change needed

  • Every Open / Open With launch runs on the GTK main thread (desktop.rs and context_menu.rs call launch/launch_at from spawn_local), so the save/chdir/launch/restore sequence is never interleaved with another launch and the process-wide working folder cannot be left pointing at a file's folder.
  • Non-local files (path() is None), an unenterable folder, D-Bus activated applications, and desktop entries with Path behave as before, as described.
  • The new test exercises the helper directly, checks the test process is back in its own folder and that the child saw the file's folder; it is behavioural, not tautological, and kept as is.

Verification

  • ./scripts/test-headless.py -- ui::open_with:: keyboard_dispatch::file_verbs ui::browser::desktop::: 28 passed, 0 failed.
  • cargo fmt --all --check, cargo clippy --all-targets --all-features -- -D warnings: clean.
  • Approved the fork's CI run for bb3aa90 (first-time contributor runs wait for approval).

@l0gicgate
l0gicgate merged commit 2970e7a into lgse:main Nov 1, 2026
11 checks passed
wmfeht pushed a commit to wmfeht/strata-feature-map that referenced this pull request Nov 2, 2026
…rd formats node

Work in progress for the sync of lgse/strata#1990..#2040; the node
updates follow in the next commit.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01RQ23ACSBaVdBtSbREZjCtd
wmfeht added a commit to wmfeht/strata-feature-map that referenced this pull request Nov 7, 2026
Sync lgse/strata#1990–#2040: QA-sweep fixes, #2022 module split, clipboard formats, path-bar middle-click
@Bluesboy
Bluesboy deleted the fix/launch-in-file-folder branch November 9, 2026 08:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Programs opened from Strata start in / instead of the file's folder

2 participants