Allow different user in Archbox to access host user's X server and allow apps to run as Wayland-native.

This commit is contained in:
lemniskett 2021-01-13 12:47:53 +07:00
parent b5f0e108d1
commit 9c69b290f1
2 changed files with 17 additions and 4 deletions

View File

@ -14,9 +14,18 @@ asroot(){
[[ $EUID -ne 0 ]] && err "Run this as root!" [[ $EUID -ne 0 ]] && err "Run this as root!"
} }
#storeenv(){
# echo $DBUS_SESSION_BUS_ADDRESS > /tmp/archbox_dbus_session_address
# echo $XDG_RUNTIME_DIR > /tmp/archbox_xdg_runtime_dir
#}
storeenv() { storeenv() {
echo $DBUS_SESSION_BUS_ADDRESS > /tmp/archbox_dbus_session_address echo "# This will be sourced when entering Archbox" > /tmp/archbox_env
echo $XDG_RUNTIME_DIR > /tmp/archbox_xdg_runtime_dir [[ ! -z $WAYLAND_DISPLAY ]] && echo "WAYLAND_DISPLAY=$WAYLAND_DISPLAY" >> /tmp/archbox_env
[[ ! -z $DISPLAY ]] && checkdep xhost && xhost +local: > /dev/null \
&& echo "DISPLAY=$DISPLAY" >> /tmp/archbox_env
echo "DBUS_SESSION_BUS_ADDRESS=$DBUS_SESSION_BUS_ADDRESS" >> /tmp/archbox_env
echo "XDG_RUNTIME_DIR=$XDG_RUNTIME_DIR" >> /tmp/archbox_env
} }
help_text(){ help_text(){

View File

@ -1,8 +1,12 @@
#!/usr/bin/env bash #!/usr/bin/env bash
source /etc/archbox.conf source /etc/archbox.conf
source /tmp/archbox_env
REQ_ENV="DBUS_SESSION_BUS_ADDRESS=$(cat /tmp/archbox_dbus_session_address) XDG_RUNTIME_DIR=$(cat /tmp/archbox_xdg_runtime_dir)" REQ_ENV="DBUS_SESSION_BUS_ADDRESS=$DBUS_SESSION_BUS_ADDRESS "
REQ_ENV+="XDG_RUNTIME_DIR=$XDG_RUNTIME_DIR "
[[ ! -z $DISPLAY ]] && REQ_ENV+="DISPLAY=$DISPLAY "
[[ ! -z $WAYLAND_DISPLAY ]] && REQ_ENV+="WAYLAND_DISPLAY=$WAYLAND_DISPLAY "
ENV="$REQ_ENV $ENV_VAR" ENV="$REQ_ENV $ENV_VAR"
COMMAND="$@" COMMAND="$@"