diff --git a/.config/helix/scripts/typst-zathura.fish b/.config/helix/scripts/typst-zathura.fish index 7beaffbc..edb3087e 100755 --- a/.config/helix/scripts/typst-zathura.fish +++ b/.config/helix/scripts/typst-zathura.fish @@ -1,9 +1,12 @@ #!/usr/bin/env fish +set parent_pid (ps -o ppid= -p $fish_pid | string trim) +echo $parent_pid argparse q/quiet -- $argv -function z --wraps zathura +function zopen --wraps zathura zathura "$argv[1]" &>/dev/null & + set zathura_pid $last_pid end function find_pdf @@ -11,7 +14,7 @@ function find_pdf set -l base $argv[2] set -l candidate (fd --no-ignore-vcs -F -1 "$base" "$root") if test "$candidate" != '' - z "$candidate" + zopen "$candidate" else return 1 end @@ -42,7 +45,7 @@ set -l targ (string replace '.typ' '.pdf' $src) set -l base (path basename --no-extension $src).pdf if test -f "$targ" -a '' != '' # zathura "$targ" &>/dev/null & - z "$targ" + zopen "$targ" else # no such file in current dir, time to search! # if we're in a git repo, search from root