various updates
[distro-setup] / brc2
diff --git a/brc2 b/brc2
index 3a5ab9d59b681d076120e79f887ffbc76d229ff0..4877c3f25e0af35708135e86e5ee72b64d7bd73a 100644 (file)
--- a/brc2
+++ b/brc2
@@ -472,7 +472,7 @@ jrun() { # journal run. run args, log to journal, tail and grep the journal.
   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.
@@ -1316,6 +1316,26 @@ mdt() {
 
 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 "$@";
 }
@@ -1873,7 +1893,7 @@ servicepid() {
 
 sdnbash() { # systemd namespace bash
   local unit pid
-  if (( $# != 0 )); then
+  if (( $# != 1 )); then
     echo $0: error wrong number of args >&2
     return 1
   fi
@@ -1884,7 +1904,7 @@ sdnbash() { # systemd namespace bash
 
 sdncmd() { # systemd namespace cmd
   local unit pid
-  if (( $# != 0 )); then
+  if (( $# <= 2 )); then
     echo $0: error wrong number of args >&2
     return 1
   fi
@@ -1986,8 +2006,12 @@ vpn() {
 }
 
 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