I prefer to launch GUI applications from a terminal window rather than by using a graphical desktop. A frequent annoyance is that often the developers haven't anticipated this type of use, so the app prints lots of useless, cryptic, or uninformative messages to stdout or stderr. Further clutter on the terminal occurs because running the program in the background, with an &, generates reports of the creation and termination of the job.
What is a workaround for these problems that will accept command line arguments and handle autocompletion?
Related: https://stackoverflow.com/questions/7131670/make-bash-alias-that-takes-parameter
Best Answer
Redirecting the standard error immediately to
/dev/null
is a bad idea as it will hide early error messages, and failures may be hard to diagnostic. I suggest something like the followingstart-app
zsh script:Just run it with:
start-app your_command argument ...
This script will output at most 10 lines of messages and for at most 5 seconds. Note however that if the application crashes immediately (e.g. due to a segmentation fault), you won't see any error message. Of course, you can modify this script in various ways to do what you want...
Note: To make completions work with
start-app
in zsh, it suffices to do:and in bash:
(copied from the one for
exec
andtime
in/usr/share/bash-completion/bash_completion
).