feat(windows): add 'Open in Terax' shell integration#265
Open
amaralkaff wants to merge 7 commits into
Open
Conversation
Owner
|
Thanks. only a few things I'd want before merging:
Happy to merge once these four land |
- Set NoWorkingDirectory on shell verbs (Explorer was overriding %V) - Canonicalize launch dir and strip \?\ prefix - Replace silent poison swallow with explicit expect - Catch invoke rejection in App.tsx
Resolve get_launch_dir before ReactDOM.render so useTabs seeds the default tab at the target cwd, eliminating the default-cwd PTY mount and resetWorkspace teardown that caused a brief white flash on launch.
Contributor
Author
Contributor
Author
|
@crynta u can check this one |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds a Windows Explorer right-click entry — "Open in Terax" — for folders, folder backgrounds, and drives. Clicking it launches Terax with that path as the workspace cwd (explorer rooted there, first terminal pty spawned there).
Why
Common terminal-emulator integration. Mirrors "Open in Terminal" / "Open with Visual Studio" entries other Windows tools register.
How
NSIS installer (
src-tauri/installer-hooks.nsh, wired viatauri.conf.json→bundle.windows.nsis.installerHooks):POSTINSTALLwrites registry keys toHKCU\Software\Classes\Directory\shell\OpenInTerax,Directory\Background\shell\OpenInTerax, andDrive\shell\OpenInTerax— name, icon (fromterax.exe,0), and command"$INSTDIR\terax.exe" "%V".POSTUNINSTALLdeletes those keys.currentUsermode (no admin needed).CLI handling (
src-tauri/src/lib.rs):parse_launch_dir()scansstd::env::args()for the first non-flag arg that resolves to an existing directory.LaunchDir(Mutex<Option<String>>)state, drained once via a newget_launch_dircommand (drain semantics live in the backend so HMR / re-mounts can't replay it).Frontend (
src/app/App.tsx):useEffectinvokesget_launch_dir. If a directory comes back, calls the existingresetWorkspace(dir)to replace the default tab with a fresh terminal at that path. Explorer root + new-tab cwd inheritance follow from the active tab's cwd as they already do.Testing
pnpm exec tsc --noEmitcleantarget/debug/terax.exe "C:\some\folder"— terminal spawns at that path, explorer rooted there.cd src-tauri && cargo checkcleanpnpm tauri build --bundles nsisproducesTerax_0.6.5_x64-setup.exe— makensis accepts the hook file (signing step fails locally on missingTAURI_SIGNING_PRIVATE_KEY, unrelated to this change).Screenshots / GIFs
See screenshot at top — Windows Explorer right-click in
Documents\Ophion\asmshows the new "Open in Terax" entry.Notes for reviewer
get_launch_dirconsumes on read by design — second invocation in the same process returnsNone. This prevents HMR or future re-mounts from re-triggeringresetWorkspace. If we later addtauri-plugin-single-instancefor focus-existing-window behavior, the single-instance handler can re-fill theLaunchDirslot before re-emitting.get_launch_dirresolves and is then disposed byresetWorkspace— visible as one extrapty opened … pty closedcycle in the log when launched with a path. Acceptable trade-off for keepinguseTabssynchronous; happy to refactor if you'd prefer launch-time blocking.tauri.windows.conf.jsonsince the integration is configured under the sharedbundle.windowsblock intauri.conf.json.