some optimzations in custom commands

This commit is contained in:
Schrottkatze 2025-06-17 14:06:12 +02:00
parent 98e3bc8b32
commit bee13a9391
Signed by: schrottkatze
SSH key fingerprint: SHA256:FPOYVeBy3QP20FEM42uWF1Wa/Qhlk+L3S2+Wuau/Auo

View file

@ -16,10 +16,9 @@ def nr [
def lcr [ def lcr [
file_extension: string file_extension: string
] { ] {
ls **/* glob **/*.($file_extension)
| where name ends-with $".($file_extension)"
| par-each {|file| | par-each {|file|
open $file.name open $file
| lines --skip-empty | lines --skip-empty
| length } | length }
| math sum | math sum
@ -45,7 +44,7 @@ def typed [
} else if ($"($name).pdf" | path exists) { } else if ($"($name).pdf" | path exists) {
typst compile $"($name).typ" 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" mprocs --names Editor,Viewer,Notify $"hx '($name).typ'" $"while true; do mupdf-x11 '($name).pdf' && break; done" $"bash -c 'while inotifywait -e modify \'($name).pdf\' ; do pkill -HUP mupdf; done'"
} }
# figure out when the next event is # figure out when the next event is
@ -99,3 +98,8 @@ def "dp gay" [] {
swaymsg "output DP-3 position 0 0 scale 1 transform normal resolution 1920x1080@60Hz" swaymsg "output DP-3 position 0 0 scale 1 transform normal resolution 1920x1080@60Hz"
bars "LEN G27c-10" bars "LEN G27c-10"
} }
def oobs [] {
set-env SHELL /run/current-system/sw/bin/bash
obs
}