dotfiles/fish/.config/fish/functions/opdf.fish

21 lines
771 B
Fish

function opdf --description 'Open PDF with fuzzel in existing Zathura'
set pdf (fd -H -e pdf "" ~/Study ~/Documents ~/Downloads | fuzzel --dmenu --width 128)
if test -n "$pdf"
set zathuraid (dbus-send --session \
--dest=org.freedesktop.DBus \
--type=method_call \
--print-reply \
/org/freedesktop/DBus \
org.freedesktop.DBus.ListNames | grep -o 'org.pwmt.zathura.PID-[0-9]*' | fuzzel --dmenu --width 128)
if test -n "$zathuraid"
dbus-send --session \
--dest=$zathuraid \
--type=method_call \
/org/pwmt/zathura \
org.pwmt.zathura.ExecuteCommand \
string:"open \"$pdf\""
end
end
end