dotfiles/.config/scripts/functions/zathura-md
Sheldon Lee d9405c5166 Split .custom_bash_scripts into a multiple files.
The files are in ~/.config/scripts/functions.
2022-06-26 08:43:03 +08:00

35 lines
614 B
Bash

#!/bin/bash
# view markdown files in zathura
viewmd()
{
[ -z $1 ] && return
[ ! -f $1 ] && return
pdfname=$(basename $1 .md).pdf
echo $pdfname
if [ -f $pdfname ]; then
zathura $pdfname
else
pandoc -t pdf $1 | zathura -
fi
}
# generate markdown files from markdown
makemd()
{
[ -z $1 ] && return
[ ! -f $1 ] && return
pandoc -t pdf $1 -o $(basename $1 .md).pdf
}
# view zathura in tabbed
tzathura()
{
# rm tabbbed.xid if not running
! pgrep -f tabbed && rm /tmp/tabbed.xid
if [ ! -f /tmp/tabbed.xid ]; then
tabbed -c -d > /tmp/tabbed.xid
fi
zathura "$@" -e $(</tmp/tabbed.xid) & disown
}