Maybe this plug-in helps you:
https://forum.audacityteam.org/t/arrange-your-tracks-with-chain-it-up-ny/26201/1
It searches both, from the start and the end until it finds a sound that is louder than the threshold.
For the transition type choose “Trim and align left”.
If the threshold is equal or less than -120 dB, then only digital silence i.e. only zeros are going to be removed.
However, in this case, you can also use the command Edit >> Clip Boundaries >> Detach at Silences.