I am running a zsh function to open a .tex file in vim, while opening its related .pdf file in evince. I am currently using xdotool to open a new tab in the current gnome-terminal window, and then executing vim in that tab. I would rather silence the command line output of evince and open vim in the current window.
Unfortunately, with a standard redirect such as evince name.pdf &> /dev/null
, evince does not open graphically. Can I run a GUI program from a terminal without having its standard output/error in that terminal?
The function is below:
edittex () {
# open a new terminal tab in current terminal
WID=$(xprop -root | grep "_NET_ACTIVE_WINDOW(WINDOW)"| awk '{print $5}')
xdotool windowfocus $WID
xdotool key ctrl+shift+t
wmctrl -i -a $WID
# open vim in the new terminal tab
xdotool type "vim $@.tex"
xdotool key KP_Enter
# open evince in old terminal tab
evince "$@.pdf"
}
Usage: edittex filename
, assuming the .pdf and .tex files are named filename.pdf and filename.tex.
evince filename &> /dev/null
works for me in Zsh. I guess the problem is actually another one.