I wish to use the following commands of Latexmk on MacVim (El Capitan):

$compiling_cmd, $success_cmd, $failure_cmd.

The manual gives the following examples:

$compiling_cmd = "xdotool search --name \"%D\" set_window --name \"%D compiling\"";

$success_cmd = "xdotool search --name \"%D\" set_window --name \"%D OK\"";

$failure_cmd = "xdotool search --name \"%D\" set_window --name \"%D FAILURE\"";

But, I do not know how to modify them to suit my configurations. Perhaps, --name should be replaced with something else? In fact, I tried "MacVim" and "VIM", but no luck with Terminal giving the following message:

Defaulting to search window name, class, and classname.

XQuart and xdotool are installed, and XTEST is working fine, following this link.

Can anyone help?

  • The use of xdotool is to change the title of a window. Which window from which program do you wish to be changed? Note that xdotool only works with windows produced by XWindows. Also the examples assume that the window to be changed is from a previewer (e.g., xpdf or gv), with %D being substituted by the name of the viewed file (e.g., a pdf file). Feb 6, 2016 at 19:32
  • Thanks for your comment. I compile a .tex file using Latexmk (LuaLaTeX) on MacVim and view a .pdf file using Skim. I did a bit of study since I posted the question and I realized that I misunderstood what xdotool is for. xdotool apparently does not work for Skim. Is there any XWindows-based pdf viewer which can interact with MacVim, e.g. automatic updating (as the pdf file is updated) and forward+inverse search? What I really want is to know what is happening (or has happened) when (or after) Latexmk is working on a .tex file.
    – T_T
    Feb 8, 2016 at 9:20
  • Since you're using OS X, you could use terminal-notifier or growl-notify (if you use growl) to get notifications. Not the same as changing the window title, but it would be a way of getting feedback.
    – ig0774
    Mar 2, 2016 at 16:12

1 Answer 1


Try following commands:

$compiling_cmd = 'zsh -c "print -n \"\e]0;%D compiling\a\""';
$success_cmd = 'zsh -c "print -n \"\e]0;%D OK\a\""';
$failure_cmd = 'zsh -c "print -n \"\e]0;%D FAILED\a\";"';

Note that you have to make sure in the settings of the terminal that you can change it. See e.g. https://stackoverflow.com/questions/35929200/change-default-title-in-mac-terminal-window. This is slightly different between Terminal.app and iTerm2.app, however, for both terminals you have to make sure that the preferences are correct.

  • Thank you so much for an excellent tip, which I think should be included as an example in the manual. BTW, I am wondering if it is possible to change the background color (e.g. red) of the text "FAILED" to alart me. 'printf' might be useful, as this and this suggest. But I could not figure out how to modify your code. I wonder if you can help me on this as well. Thanks in advance.
    – T_T
    May 18, 2017 at 3:40
  • You are welcome. I agree that the manual should contain something like this instead of xdotool. My code snippet should also work on linux. Anyhow, your 2nd question is most likely not possible. I guess this is a gui element which is determined by the os and afaik osx does not offer to change it. You should ask this on apple.stackexchange.com. However, try following $failure_cmd = 'zsh -c "print -n \"\e]0;%D FAILED\a\";tput bel"';. If an error occurs, the dock icon will bounce when the focus is on your editor or pdf viewer. See advanced settings under profiles to adjust the bell.
    – Hotschke
    May 18, 2017 at 8:57
  • Instead of tput bel you can also use something like osascript -e 'display notification "Compilation %D failed." with title "latexmk FAILED"' to be informed by the notification center of osx.
    – Hotschke
    May 18, 2017 at 9:00
  • Thannks for two more tips. I like tput bel, but I like osascript more. But $failure_cmd = 'osascript -e 'display notification "Compilation %D failed." with title "latexmk FAILED"'' does not work, though osascript -e 'display notification "Compilation %D failed." with title "latexmk FAILED"' perfectly works in Terminal. I would appreciate if you could give me a hint to solve the problem. An alternative option would be to use Terminal Notifier, as ig0774 suggests.
    – T_T
    May 20, 2017 at 0:56
  • The following worked fine $failure_cmd = 'osascript -e "display notification \"LaTeXmk FAILED\" with title \"%D\" "'; Thank you.
    – T_T
    May 20, 2017 at 1:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .