lxqt / qterminal

A lightweight Qt-based terminal emulator
https://lxqt.github.io
GNU General Public License v2.0
611 stars 153 forks source link

--keep-open for -e to keep the window open after the command exits #1030

Closed probonopd closed 2 weeks ago

probonopd commented 1 year ago

Is your feature request related to a problem? Please describe.

It would be nice if there was an easy and clean way to run commands in QTerminal without QTerminal closing when the command exits.

Describe the solution you'd like

Run a command in QTerminal with --execute but keep the window open after the command exits by using the --keep-open option.

Describe eventual alternatives you've considered

https://askubuntu.com/questions/20330/how-to-run-a-script-without-closing-the-terminal

Context

My use case is that when I type, e. g., "man hier" in a launcher application, that launcher application should run QTerminal to show man hier, but not exit afterwards.

https://github.com/helloSystem/Menu/commit/0df31ccc66c5ed8697dec2f017c03435af6f0c97#diff-e8df92e19e41a93f64f17393a9ed8b5413fac614d3a12cc425235f14e32f6fc2R779

(Note to self: The same could also used to run executable scripts with the .command suffix when double-clicked in the file manager.)

josiahtripp commented 2 weeks ago

I did a little looking into what it would take to implement this feature. When a command is passed using the --execute option, it's executed through a function defined in the QTermWidget dependency. I may be wrong, but I believe preventing the terminal from closing after executing a command would require changes to be made to [QTermWidget] (https://github.com/lxqt/qtermwidget)

tsujan commented 2 weeks ago

Duplicate of https://github.com/lxqt/qterminal/issues/554. See https://github.com/lxqt/qterminal/issues/554#issuecomment-471252822

I'll add it to the wiki.

EDIT: Done in https://github.com/lxqt/qterminal/wiki#how-to-launch-an-instance-to-execute-a-command-and-keep-its-window-open

probonopd commented 2 weeks ago

Thank you very much @tsujan

tsujan commented 2 weeks ago

You're welcome. I just added it to the wiki.