AutoYADM commit: 2025-04-22 14:20:13

This commit is contained in:
Daniel Fichtinger 2025-04-22 14:20:13 -04:00
parent 0a37f956b8
commit 57a20179d1

View file

@ -1,9 +1,34 @@
#!/usr/bin/env fish
set parent_pid (ps -o ppid= -p $fish_pid | string trim)
echo $parent_pid
argparse q/quiet -- $argv
# only return status 1 if -q not set
if set -q _flag_q
set ret 1
else
set ret 0
end
# traverse up process tree to find caller Helix PID
function find_parent_process -a target
set current_pid $fish_pid
while test $current_pid -ne 1 # Stop when we reach init (PID 1)
set parent (ps -o ppid= -p $current_pid | string trim)
set cmd (ps -o comm= -p $parent | string trim)
if string match -q -- $target $cmd
echo "$parent"
return 0
end
set current_pid $parent
end
return 1
end
set parent_pid (find_parent_process hx)
function zopen --wraps zathura
zathura "$argv[1]" &>/dev/null &
set zathura_pid $last_pid
@ -20,13 +45,6 @@ function find_pdf
end
end
# only return status 1 if -q not set
if set -q _flag_q
set ret 1
else
set ret 0
end
# only echo if -q not set
function qecho
if not set -q _flag_q