dua-cli icon indicating copy to clipboard operation
dua-cli copied to clipboard

Terminal apps cause interactive session to effectively hang

Open benjamb opened this issue 9 months ago • 4 comments

While this is potentially more of an issue with xdg-open1 than dua, other TUI applications are able to handle this better (e.g. yazi).

My default editor is helix and my default file browser is yazi, both of which have .desktop files which indicate they are terminal applications. Currently, xdg-open will attempt to open terminal based applications using the same terminal it was called from, effectively attempting to take over the current terminal from dua, and while it appears as though the key presses are going through to the spawned app (i.e. q will exit yazi), the terminal window only displays the dua TUI.

Here's a demonstration of the issue that captures running instances of hx and yazi as well as displaying key presses:

https://github.com/user-attachments/assets/c76722cd-15c4-4ad4-a510-f2d1ec634574

benjamb avatar Mar 26 '25 11:03 benjamb

Thanks a lot for reporting!

Indeed, the open crate is used to open paths and I never had an idea that this could spawn an application in the same terminal. Thus, I do not have any idea of what would need to be done to improve this. On the bright side, helix can already do it and their codebase might hold the answer.

Byron avatar Mar 26 '25 22:03 Byron

Looks like gitgui implemented a solution like so: https://github.com/gitui-org/gitui/commit/ce4f3af767574fdda07484d6cc6c2236cfb24302

I can't see yazi or helix doing similar, except on exit, so not sure how it's working there.

benjamb avatar Mar 28 '25 20:03 benjamb

It may be simpler than that, it could be that open-rs isn't allowing the process to inherit stdout/stderr.

benjamb avatar Mar 29 '25 13:03 benjamb

It does inherit everything by default, but when executing it it will disable all output.

Maybe it would work better without doing that, assuming that the launcher doesn't output anything to stderr/stdout.

Byron avatar Mar 30 '25 00:03 Byron