improve typed command

This commit is contained in:
Schrottkatze 2025-01-05 03:19:20 +01:00
parent cbf71bded5
commit edafaf3c14
Signed by: schrottkatze
SSH key fingerprint: SHA256:FPOYVeBy3QP20FEM42uWF1Wa/Qhlk+L3S2+Wuau/Auo

View file

@ -38,8 +38,13 @@ def glog [
def typed [
name: string
] {
touch $"($name).typ"
typst compile $"($name).typ"
const DEFAULT_TYPST_FILE = "#import \"@local/typst-configs:0.1.0\": generic, sf;\n#show: generic.with();"
if not ($"($name).typ" | path exists) and not ($"($name).pdf" | path exists) {
$DEFAULT_TYPST_FILE | save $"($name).typ"
typst compile $"($name).typ"
} else if ($"($name).pdf" | path exists) {
typst compile $"($name).typ"
}
mprocs --names Editor,Viewer,Notify $"hx '($name).typ'" $"while true; do mupdf-x11 '($name).pdf' && break; done" $"while inotifywait -e modify '($name).pdf' ; do pkill -HUP mupdf; done"
}