This commit is contained in:
Adam Stankiewicz
2020-04-28 01:09:08 +02:00
parent 1d348d0c2d
commit c7b5826d53
10 changed files with 86 additions and 24 deletions

View File

@@ -153,9 +153,10 @@ function! s:xwin_template.xwin_exists() dict abort " {{{1
" If xwin_id is unset, check if matching viewer windows exist
"
if self.xwin_id == 0
if has_key(self, 'get_pid')
let l:pid = has_key(self, 'get_pid') ? self.get_pid() : 0
if l:pid > 0
let cmd = 'xdotool search'
\ . ' --all --pid ' . self.get_pid()
\ . ' --all --pid ' . l:pid
\ . ' --name ' . fnamemodify(self.out(), ':t')
let self.xwin_id = get(split(system(cmd), '\n'), 0)
else

View File

@@ -90,21 +90,20 @@ function! s:zathura.compiler_callback(status) dict abort " {{{1
if !filereadable(self.out()) | return | endif
if g:vimtex_view_automatic
if g:vimtex_view_automatic && !has_key(self, 'started_through_callback')
"
" Search for existing window created by latexmk
" It may be necessary to wait some time before it is opened and
" recognized. Sometimes it is very quick, other times it may take
" a second. This way, we don't block longer than necessary.
" Note: It may be necessary to wait some time before it is opened and
" recognized. Sometimes it is very quick, other times it may take
" a second. This way, we don't block longer than necessary.
"
if !has_key(self, 'started_through_callback')
for l:dummy in range(30)
sleep 50m
if self.xwin_exists() | break | endif
endfor
endif
for l:dummy in range(30)
let l:xwin_exists = self.xwin_exists()
if l:xwin_exists | break | endif
sleep 50m
endfor
if !self.xwin_exists() && !has_key(self, 'started_through_callback')
if ! l:xwin_exists
call self.start(self.out())
let self.started_through_callback = 1
endif