From Hitman, 2 Years ago, written in Plain Text.
Embed
  1. #!/usr/bin/openrc-run
  2.  
  3. depend() {
  4. after logind
  5. after alsasound
  6. }
  7.  
  8. start() {
  9. users="$(users)"
  10. for user in $users $([ -z "$users" ] && getent passwd | grep -P '1[0-9]{3,5}' | cut -d: -f1); do uid=$(getent passwd "$user" | cut -d: -f3) [ "$uid" \< 1000 ] && continue
  11. grp="$(getent group "$user" | cut -d: -f1)"
  12. if pgrep -u "$user" session >/dev/null; then
  13. func_ran=1
  14. su -s /bin/sh -c "dbus-launch env XDG_RUNTIME_DIR=/run/user/$uid pipewire" $user $grp || eend 1 &
  15. sleep 1 && if [ -n "$(command -v wireplumber)" ]; then if ! pgrep wireplumber -u $user; then su -s /bin/sh -c "dbus-launch env XDG_RUNTIME_DIR=/run/user/$uid wireplumber" $user $grp || exit 1; fi
  16. elif [ -n "$(command -v pipweire-media-session)" ]; then if ! pgrep pipewire-media-session -u $user; then su -s /bin/sh -c "dbus-launch env XDG_RUNTIME_DIR=/run/user/$uid pipewire-media-session" $user $grp || exit 1; fi; fi &
  17. sleep 1 && if [ -n "$(command -v pipewire-pulse)" ]; then if ! pgrep pipewire-pulse -u $user; then su -s /bin/sh -c "dbus-launch env XDG_RUNTIME_DIR=/run/user/$uid pipewire-pulse" $user $grp; fi; fi
  18. fi
  19. done
  20. [ -z $func_ran ] && eend 1
  21. }
  22.  
captcha