Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Two okular instances on first :VimtexCompile (despite --unique) #1364

Closed
saladpanda opened this issue Apr 18, 2019 · 3 comments
Closed

Two okular instances on first :VimtexCompile (despite --unique) #1364

saladpanda opened this issue Apr 18, 2019 · 3 comments

Comments

@saladpanda
Copy link

saladpanda commented Apr 18, 2019

I'm not sure whether this counts as a bug in vimtex or in okular or whether it counts as a bug at all, but it could certainly be worked around in vimtex.

Observed behavior:

With arbitrary *.tex files the first call of :VimtexCompile causes okular to be lauched twice.
The second instance has a popup saying "There is already a unique Okular instance running. This instance won't be the unique one."

.vimrc contains:

let g:vimtex_view_general_viewer = 'okular'
let g:vimtex_view_general_options = '--noraise --unique @pdf\#src:@line@tex'
let g:vimtex_view_general_options_latexmk = '--unique'

I don't know how the --unique tries to ensure uniqueness but the issue seems to be that two okular instances are called too fast for --unique to work.
Same behavior can be seen with:

#!/bin/bash
okular --unique build/test.pdf &
okular --unique build/test.pdf &

Introducing a slight delay between both okular launches gets rid of the problem.

Workaround:

My current workaround is:

Put okular-delayed onto PATH:

#!/bin/bash
ARGS=$@
if [ "$1" == "--delayed" ]
then
    sleep 0.5
    # Filter out the --delayed
    ARGS=${@:2}
fi
okular $ARGS

Change .vimrc to use it:

let g:vimtex_view_general_viewer = 'okular-delayed'
let g:vimtex_view_general_options = '--noraise --unique @pdf\#src:@line@tex'
let g:vimtex_view_general_options_latexmk = '--delayed --unique'

Further information

Okular Version 1.6.3

@saladpanda saladpanda changed the title Two okular instances on first :VimtexCompile (although --unique) Two okular instances on first :VimtexCompile (despite --unique) Apr 18, 2019
@lervag
Copy link
Owner

lervag commented Apr 18, 2019

Can you specify a full minimal example to reproduce it?

@saladpanda
Copy link
Author

Sure.

" .vimrc
call plug#begin('~/.vim/plugged') # using vim-plug
Plug 'lervag/vimtex'
call plug#end()

let g:vimtex_view_general_viewer = 'okular'
let g:vimtex_view_general_options = '--noraise --unique @pdf\#src:@line@tex'
let g:vimtex_view_general_options_latexmk = '--unique'
% test.tex
\documentclass{minimal}
\begin{document}
test
\end{document}

No .latexmkrc
Then run vim test.tex and :VimtexCompile.

lervag added a commit that referenced this issue Apr 18, 2019
@lervag
Copy link
Owner

lervag commented Apr 18, 2019

I think this was caused by a recent change that was probably not quite correct, cf. #1355 and #1362. I've fixed it, I think, without causing regression problems for the mentioned issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants