1
0

zsh: aliases and related

This commit is contained in:
2021-12-07 02:46:50 +03:00
parent 95d73f7f64
commit 731471aee7
15 changed files with 66 additions and 35 deletions

View File

@@ -1,9 +1,30 @@
#!/bin/zsh
function {
idle() {
local f
f=$(type "$1")
case "$f" in
"$1 is /"*) z-idle-ext "$@" ;;
*) z-idle-int "$@" ;;
esac
}
z-idle-ext() {
local -a s
s+=( $(z-alt-find 'nice -n +40') )
s+=( $(z-alt-find 'chrt -i 0' ) )
s+=( $(z-alt-find 'ionice -c 3') )
z-alt-set-static idle "$s|env"
command ${s[@]} "$@"
}
z-idle-int() {
## execute in subshell
(
{
command renice -n +40 -p ${sysparams[pid]}
command chrt -i -p 0 ${sysparams[pid]}
command ionice -c 3 -p ${sysparams[pid]}
} </dev/null &>/dev/null
"$@"
)
}