dotfiles/zprofile
Naman Sood 5215868d3d set LIBVA_DRIVER_NAME for arch
Signed-off-by: Naman Sood <mail@nsood.in>
2024-11-15 01:07:22 -05:00

35 lines
1.1 KiB
Bash

# fix for WSL not starting ssh-agent on boot
if [ -z "$SSH_AUTH_SOCK" ] ; then
eval `ssh-agent -s`
grep -slR PRIVATE ~/.ssh/ | xargs ssh-add
fi
# fix for firefox using xwayland instead of wayland native
if [ "$XDG_SESSION_TYPE" = "wayland" ]; then
export MOZ_ENABLE_WAYLAND=1
export GDK_BACKEND=wayland
fi
# make AUR packages not compress, since they immediately get
# decompressed anyway
export PKGEXT=".pkg.tar"
export TENDS_TO=42
DISTRO=$(cat /etc/os-release | grep '^ID=' | awk -F'=' '{print $2}')
if [ $DISTRO = 'arch' ]; then
# configure VA-API for hardware video acceleration
VIDEO_DRIVERS=($(ls /usr/lib/dri | grep drv_video | awk -F_ '{print $1}'))
VIDEO_DRIVERS_LEN=${#VIDEO_DRIVERS[@]}
if [ $VIDEO_DRIVERS_LEN -eq 1 ]; then
export LIBVA_DRIVER_NAME=$VIDEO_DRIVERS
elif [ $VIDEO_DRIVERS_LEN -gt 1 ]; then
if [ ! -v $LIBVA_DRIVER_NAME]; then
echo "Warning: more than one VA-API driver detected! Found: ${VIDEO_DRIVERS}." >&2
echo "Either delete the wrong driver or choose one manually by setting LIBVA_DRIVER_NAME." >&2
fi
fi
export LC_ALL=C
fi