Skip to content

Commit

Permalink
Improved zathuras get_pid (cf. #947)
Browse files Browse the repository at this point in the history
  • Loading branch information
lervag committed Sep 27, 2017
1 parent cabb51d commit 770b518
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion autoload/vimtex/view/zathura.vim
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,18 @@ endfunction

" }}}1
function! s:zathura.get_pid() dict " {{{1
" First try to match full output file name
let cmd = 'pgrep -nf "zathura.*'
\ . escape(get(self, 'outfile', self.out()), '~\%.') . '"'
let pid = str2nr(system(cmd)[:-2])
return pid > 0 ? pid : 0

" Now try to match correct servername as fallback
if empty(pid)
let cmd = 'pgrep -nf "zathura.+--servername ' . v:servername . '"'
let pid = str2nr(system(cmd)[:-2])
endif

return pid
endfunction

" }}}1
Expand Down

0 comments on commit 770b518

Please sign in to comment.