I made a .desktop file to compile and execute a c++ file but the terminal (lxterminal - lubuntu) is not holding after running the file.
Although I did mark "Keep terminal window open after command execution." on the .desktop file properties !
I am using Lubuntu 16.04.1 LXDE desktop environment.
You can run your command(s) via a shellscript. (Maybe you do that already.) And at the end of the shellscript you add a line, for example like this:
Then you can scroll the window and check the output from your command(s), and then press Enter to get rid of the terminal window.
I don't know why the first method did not work. Maybe your script or some program called by it is sending a signal that finishes the script at once (without reaching the final statement). You could try to fix that, but maybe it is easier to run in an xterm window (tweaked to look better and with the
-hold
option.Please compare how these two command lines work:
You can tweak the xterm window to look better, for example like this
Put the name of your script after -e in the xterm command line, or start the xterm in interactive mode (with the hold feature), and start your script in xterm.
I don't know if this is optimal for you use case, but you can put
yourCommand; read -n 1 -s
in the Exec line of your .desktop file, causing the terminal to wait for one character input (silently, not echoing it back to stdout).You should end with something like this:
Exec=lxterminal -e "/path/to/yourCommand; read -n 1 -s"
Also can use
&&
or||
according to you app exit value/code, waiting only if execution was successful, for example:Exec=lxterminal -e "/path/to/yourCommand && read -n 1 -s"
Hope it helps.
You can use this
Just replace "top" with your command.