treewide: move zsh functions to sh scripts
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
This commit is contained in:
42
.config/zsh/alias/idle.zsh.old
Normal file
42
.config/zsh/alias/idle.zsh.old
Normal file
@@ -0,0 +1,42 @@
|
||||
#!/bin/zsh
|
||||
|
||||
idle() {
|
||||
[ -n "${1:?}" ]
|
||||
|
||||
local f
|
||||
|
||||
f=$(type "$1")
|
||||
case "$f" in
|
||||
"$1 is /"* )
|
||||
z-idle-ext "$@"
|
||||
;;
|
||||
* )
|
||||
z-idle-int "$@"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
z-idle-ext() {
|
||||
[ -n "${1:?}" ]
|
||||
|
||||
local -a s
|
||||
|
||||
s+=( $(z-alt-find 'nice -n +40') )
|
||||
s+=( $(z-alt-find 'chrt -i 0' ) )
|
||||
s+=( $(z-alt-find 'ionice -c 3') )
|
||||
command ${s[@]} "$@"
|
||||
}
|
||||
|
||||
z-idle-int() {
|
||||
[ -n "${1:?}" ]
|
||||
|
||||
## 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
|
||||
"$@"
|
||||
)
|
||||
}
|
Reference in New Issue
Block a user