@@ -308,6 +308,7 @@ export default function SettingsTerminalTab(props: {
308308 | { kind : "found" ; path : string }
309309 | { kind : "not-found" ; searchedPaths : string [ ] }
310310 > ( { kind : "idle" } ) ;
311+ const [ autoDetectedMoshPath , setAutoDetectedMoshPath ] = useState < string | null > ( null ) ;
311312
312313 const discoveredShells = useDiscoveredShells ( ) ;
313314 const [ showCustomShellInput , setShowCustomShellInput ] = useState ( ( ) => {
@@ -513,6 +514,24 @@ export default function SettingsTerminalTab(props: {
513514 return ( ) => clearTimeout ( timeoutId ) ;
514515 } , [ terminalSettings . moshClientPath , t ] ) ;
515516
517+ useEffect ( ( ) => {
518+ const bridge = ( window as unknown as { netcatty ?: NetcattyBridge } ) . netcatty ;
519+ if ( ! bridge ?. detectMoshClient ) return ;
520+ let canceled = false ;
521+ bridge . detectMoshClient ( )
522+ . then ( ( result ) => {
523+ if ( ! canceled ) {
524+ setAutoDetectedMoshPath ( result . found && result . path ? result . path : null ) ;
525+ }
526+ } )
527+ . catch ( ( ) => {
528+ if ( ! canceled ) setAutoDetectedMoshPath ( null ) ;
529+ } ) ;
530+ return ( ) => {
531+ canceled = true ;
532+ } ;
533+ } , [ ] ) ;
534+
516535 const handleDetectMosh = useCallback ( async ( ) => {
517536 const bridge = ( window as unknown as { netcatty ?: NetcattyBridge } ) . netcatty ;
518537 if ( ! bridge ?. detectMoshClient ) return ;
@@ -1143,8 +1162,8 @@ export default function SettingsTerminalTab(props: {
11431162 label = { t ( "settings.terminal.mosh.client" ) }
11441163 description = { t ( "settings.terminal.mosh.client.desc" ) }
11451164 >
1146- < div className = "flex flex-col gap-1 w-72" >
1147- < div className = "flex gap-2" >
1165+ < div className = "flex max-w-full flex-col gap-1.5" style = { { width : "min(420px, 100%)" } } >
1166+ < div className = "grid grid-cols-[minmax(220px,1fr)_auto_auto] gap-2" >
11481167 < Input
11491168 value = { terminalSettings . moshClientPath }
11501169 placeholder = { t ( "settings.terminal.mosh.client.placeholder" ) }
@@ -1172,6 +1191,11 @@ export default function SettingsTerminalTab(props: {
11721191 { t ( "settings.terminal.mosh.browse" ) }
11731192 </ Button >
11741193 </ div >
1194+ { ! terminalSettings . moshClientPath && autoDetectedMoshPath && moshDetectStatus . kind !== "found" && (
1195+ < span className = "text-xs text-muted-foreground" >
1196+ { t ( "settings.terminal.mosh.autoDetected" ) } : < span className = "break-all font-mono" > { autoDetectedMoshPath } </ span >
1197+ </ span >
1198+ ) }
11751199 { moshValidation && ! moshValidation . valid && moshValidation . message && (
11761200 < span className = "text-xs text-destructive flex items-center gap-1" >
11771201 < AlertCircle size = { 12 } />
@@ -1180,7 +1204,7 @@ export default function SettingsTerminalTab(props: {
11801204 ) }
11811205 { moshDetectStatus . kind === "found" && (
11821206 < span className = "text-xs text-muted-foreground" >
1183- { t ( "settings.terminal.mosh.detected" ) } : { moshDetectStatus . path }
1207+ { t ( "settings.terminal.mosh.detected" ) } : < span className = "break-all font-mono" > { moshDetectStatus . path } </ span >
11841208 </ span >
11851209 ) }
11861210 { moshDetectStatus . kind === "not-found" && (
@@ -1198,9 +1222,9 @@ export default function SettingsTerminalTab(props: {
11981222 </ >
11991223 ) }
12001224 </ span >
1201- </ span >
1202- ) }
1203- </ div >
1225+ </ span >
1226+ ) }
1227+ </ div >
12041228 </ SettingRow >
12051229 </ div >
12061230
0 commit comments