1

I am trying to set up Zathura on Windows 10 by using Ubuntu as available from the Microsoft Store. I would like to use Zathura as my PDF viewer when writing with vim/vimtex, and am currently facing the issue:

Unable to init server: Could not connect: Connection refused (zathura:10420): 
Gtk-WARNING **: 15:58:19.628: cannot open display :0

This occurs when I type zathura into an Ubuntu terminal. I am new (and struggling) with Ubuntu and have only done the following:

  1. I downloaded Ubuntu from the Microsoft Store.

  2. I opened terminal, and typed vim. This successfully launches.

  3. sudo apt update && sudo apt install zathura

  4. Typing zathura produces the error mentioned above.

I've been Google searching for a few days, but I think my unfamiliarity with this technology has made difficult to spot an appropriate solution.

NotTheDr01ds
  • 22,381
Fraguh
  • 11
  • Did you run sudo apt-get install zathura or just sudo apt-get zathura? If you do not have the install factor, the software will not be, well, installed. – David Dec 23 '19 at 00:54
  • 1
    I just typed sudo apt-get install zathura, which is performed successfully, and the error remains. Thank you for your edits and suggestion. – Fraguh Dec 23 '19 at 01:17
  • WSL does not come with an X server for GUI applications. If you need to run Zathura on WSL (not recommended), you can check out various X server solutions for Windows, including XMing and vcxsrv. – Junelilly Dec 23 '19 at 01:20
  • I see. Thanks for identifying the main issue. Now I can explore options – Fraguh Dec 23 '19 at 01:25
  • 1
    This question is similar to: What's the easiest way to run GUI apps on Windows Subsystem for Linux?. If you believe it’s different, please edit the question, make it clear how it’s different and/or how the answers on that question are not helpful for your problem. – muru Jun 30 '24 at 01:31

1 Answers1

0

I also encountered the same problem. My solution is to use the google chrome browser.

# step 1
sudo ln /path/to/your/chrome/in/windows /usr/bin/chrome
# e.g., /mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe

step 2 add the following line in your ~/.vimrc

let g:vimtex_view_general_viewer='chrome'

However, there is still a little problem that every time you preview the compiled pdf file, it always open a new tab in chrome instead of the previous pdf tab.

  • You might need to quote /mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe since it contain whitespaces. – Kulfy Dec 21 '20 at 09:52