Created
January 9, 2024 16:58
-
-
Save jirib/6d1c87b511ee459d4d9031d16bc55e8b to your computer and use it in GitHub Desktop.
wrapper
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#set -x | |
DUSER=badbrowser | |
# X11 display | |
xhost +SI:localuser:${DUSER} >/dev/null | |
# pulseaudo | |
setfacl -m u:${DUSER}:x ${XDG_RUNTIME_DIR}/pulse | |
# pulseaudio cookie | |
[[ ! -d ${XDG_RUNTIME_DIR}/${DUSER} ]] && mkdir ${XDG_RUNTIME_DIR}/${DUSER} | |
if ! cmp ${HOME}/.config/pulse/cookie \ | |
${XDG_RUNTIME_DIR}/${DUSER}/pulse-cookie 2>/dev/null ; then | |
install -m 0600 $HOME/.config/pulse/cookie ${XDG_RUNTIME_DIR}/${DUSER}/pulse-cookie | |
setfacl -m u:${DUSER}:r ${XDG_RUNTIME_DIR}/${DUSER}/pulse-cookie | |
fi | |
sudo -Hiu ${DUSER} bash -c "DISPLAY=${DISPLAY} PULSE_SERVER=unix:${XDG_RUNTIME_DIR}/pulse/native \ | |
PULSE_COOKIE=${XDG_RUNTIME_DIR}/${DUSER}/pulse-cookie brave-browser $@ </dev/null >/dev/null 2>&1 &" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment