1

I tried using QProcess to invoke an executable (Truecrypt, in this case) in Linux, but found no way to hide the Truecrypt window from popping up.
Invoking Truecrypt via the terminal in Ubuntu (even after sending the password via the commandline) causes the Truecrypt GUI to pop up when the volume is mounted, and even the folder mounted is shown.

I had managed to avoid making the GUI coming up in Windows by using CreateProcess() in VC++ with CREATE_NO_WINDOW, but can't seem to find a way to do it in Linux. Is there a command in Linux through which a user can invoke an external executable via C++ code, and prevent the executable from showing its GUI?

Nav
  • 19,885
  • 27
  • 92
  • 135
  • Please explain how you are running TrueCrypt via command line. In general, if you prohibit an application from displaying the GUI (for example, by unsetting the environmental variable DISPLAY), it is up to the application to decide whether work without GUI is at all possible. Most GUI programs will fail, though. – January Jul 01 '13 at 11:30
  • Am trying to invoke the executable via C++ code. Tried with `QProcess`, but there doesn't seem to be a way to hide the window of the executable. If there's a way, it is what I need to know. – Nav Jul 08 '13 at 06:47

1 Answers1

0

There are two problems or questions here. The question about preventing an executable from showing the GUI is easily answered, but does not help with the TrueCrypt problem.

Essentially, there are two ways of prohibiting an application to use GUI. Either the application has a configuration or command line option that does exactly that (for example, the --headless option for libreoffice), or you can hold back the information about the display from the GUI.

Any GUI in Linux needs to know what the display is, and this information is provided via the $DISPLAY environmental variable. If this variable is unset or removed, the application will not be able to display the GUI. Most of the GUI applications will then fail:

~$ echo $DISPLAY
:0
~$ xterm 
~$ DISPLAY=""
~$ xterm 
xterm: Xt error: Can't open display: 
xterm: DISPLAY is not set

I cannot answer the question about TrueCrypt, however a brief glance through the trucrypt command line manual suggests that if you provide sufficient information on the command line, then truecrypt should not be running interactively; however, that running interactively seems to be the default action for some of the commands.

January
  • 16,320
  • 6
  • 52
  • 74
  • Thank you. `$DISPLAY` is definitely not the way to go for me. I was considering invoking the executable via an external process invocation via QT. Was hoping there would be a way to hide the window via QT. Even if I supply the necessary parameters to Truecrypt via the commandline, the GUI pops up. – Nav Jul 03 '13 at 07:05