diff --git a/.config/helix/scripts/typst-zathura.fish b/.config/helix/scripts/typst-zathura.fish index e9a6d9f8..1e9fd186 100755 --- a/.config/helix/scripts/typst-zathura.fish +++ b/.config/helix/scripts/typst-zathura.fish @@ -8,6 +8,13 @@ else set ret 0 end +# only echo if -q not set +function qecho + if not set -q _flag_q + echo $argv[1] + end +end + # traverse up process tree to find caller Helix PID function find_parent_process -a target set current_pid $fish_pid @@ -28,6 +35,11 @@ function find_parent_process -a target end set parent_pid (find_parent_process hx) +if test -z "$parent_pid" + qecho "Couldn't find parent hx process!" + return $ret +end +echo $parent_pid function zopen --wraps zathura zathura "$argv[1]" &>/dev/null & @@ -45,13 +57,6 @@ function find_pdf end end -# only echo if -q not set -function qecho - if not set -q _flag_q - echo $argv[1] - end -end - set -l src (path resolve $argv[1]) # echo $src # string replace