Most of the time running a gtk
application from the command line it starts dumping debug information to the stdout
even though I put them in background.
Example:
~$ gedit test.html # and ctrl+z to suspend
zsh: suspended gedit .zshrc
~$ bg
[1] + continued gedit .zshrc
~$
# do some editing
(gedit:6208): GtkSourceView-WARNING **: Could not find word to remove in buffer (whoosh), this should not happen!
(gedit:6208): GtkSourceView-WARNING **: Could not find word to remove in buffer (haystack), this should not happen!
I want to note that the error, or warning, changes according to what I'm doing at the moment. The GtkSourceView-WARNING
shown here is one of the cases.
Anyway... Do you know if it's at all possible to avoid getting that information printed out?
You can send those standard output and error messages to the null device, so that they don't show up in your terminal, e.g.
gedit test.html >/dev/null 2>&1
Another way to do it would be to start the command as a background process and then detach it from the current shell. This will 'hide' all output in the sense that the current shell is no longer interested in the process. The syntax in bash is:
I often use the output redirection mentioned in the other answer because it is very flexible. You can output to files, devices, connect outputs, etc. However this is useful for when you have no interest in the output, you just want to start a GUI application from a shell and then have no other interaction with it.
I don't know if this is exactly what you're looking for and if it'll help you, but:
Since you're saying that you want to run a GTK application in the background, you could do this:
nohup <applicationname> > /dev/null < /dev/null &
The nohup programm basically detaches the application passed to it from your terminal, allowing the terminal session to end, but with the application can still running.
You can close the terminal, or continue to use it (since all output is sent to /dev/null) without issues, because of the
&
command. A nice simple explanation for it can be seen here.