journalctl -qn2 -f -u "$cmd_name" &
# Guess of time needed to avoid missing initial lines.
# .5 was not reliable. 1 was not reliable. 2 was not reliable
- sleep 3
+ sleep 4
# We kill this in prompt-command for the case that we ctrl-c the
# systemd-cat. i dont know any way to trap ctrl-c and still run the
# normal action for it. There might be a way, unsure.
mo() { xset dpms force off; } # monitor off
+mpvgpu() {
+ # seems to be the best gpu decoding on my nvidia 670.
+ # vlc gets similar or better framerate, but is much darker output on my test movie at least.
+
+
+ case $HOSTNAME in
+ kd)
+ echo 0f | sudo tee -a /sys/kernel/debug/dri/0/pstate
+ ;;
+ esac
+ # going back to the default slow clock, and slower fan:
+ # echo 07 | sudo tee -a /sys/kernel/debug/dri/0/pstate
+ if [[ $DISPLAY ]]; then
+ mpv --vo=vdpau --hwdec=auto "$@"
+ else
+ # waylandvk seems to work the same
+ mpv --gpu-context=wayland --hwdec=auto
+ fi
+}
+
mpvd() {
mpv --profile=d "$@";
}
sdnbash() { # systemd namespace bash
local unit pid
+ if (( $# != 1 )); then
+ echo $0: error wrong number of args >&2
+ return 1
+ fi
unit=$1
pid=$(servicepid $unit)
m sudo nsenter -t $pid -n -m sudo -u $USER -i bash
sdncmd() { # systemd namespace cmd
local unit pid
+ if (( $# <= 2 )); then
+ echo $0: error wrong number of args >&2
+ return 1
+ fi
unit=$1
shift
pid=$(servicepid $unit)
}
fixu() {
+ local stats
ls -lad /run/user/1000
- s chmod 700 /run/user/1000; s chown iank.iank /run/user/1000
+ stats=$(stat -c%a-%g-%u /run/user/1000)
+ if [[ $stats != 700-1000-1000 ]]; then
+ m s chmod 700 /run/user/1000; m s chown iank.iank /run/user/1000
+ fi
}
# systemctl is-enabled / status / cat says nothing, instead theres