tileos-settings-sway/usr/bin/start-sway
Alexander Oakman 98d42bd113 Pass SSH_AUTH_SOCK env to all processes in the session
As stated in the ssh-agent manual, running desktop-manager as a fork of ssh-agent
is a possible way to configure the agent and pass its socket to all underlying processes.
A similar trick is used in LMDE.
2024-07-24 22:32:35 +03:00

60 lines
1.4 KiB
Bash
Executable file

#!/usr/bin/env sh
## General exports
export XDG_CURRENT_DESKTOP=sway
export XDG_SESSION_DESKTOP=sway
export XDG_SESSION_TYPE=wayland
# Check if system is running in virtual machine
case "$(systemd-detect-virt)" in
qemu)
export WLR_RENDERER=pixman
export WLR_NO_HARDWARE_CURSORS=1
;;
kvm)
export WLR_NO_HARDWARE_CURSORS=1
;;
oracle)
export WLR_NO_HARDWARE_CURSORS=1
;;
esac
# Apply Nvidia-specific variables
if [ -d /sys/module/nvidia ]; then
export WLR_NO_HARDWARE_CURSORS=1
export GBM_BACKEND=nvidia-drm
export __GLX_VENDOR_LIBRARY_NAME=nvidia
export LIBVA_DRIVER_NAME=nvidia
fi
## Load system environment customizations
if [ -d /etc/environment.d ]; then
set -o allexport
for f in /etc/environment.d/*.conf; do
# shellcheck source=/dev/null
. "$f"
done
set +o allexport
fi
## Load user environment customizations
if [ -d "${XDG_CONFIG_HOME:-$HOME/.config}/environment.d" ]; then
set -o allexport
for i in "${XDG_CONFIG_HOME:-$HOME/.config}/environment.d"/*.conf; do
# shellcheck source=/dev/null
. "$i"
done
set +o allexport
fi
# Run Sway under ssh-agent
run_sway() {
exec systemd-cat -- /usr/bin/ssh-agent /usr/bin/sway $@
}
# Check if Nvidia driver installed, start Sway and send output to the journal
if [ -d /sys/module/nvidia ] && [ ! -d /sys/module/amdgpu ] && [ ! -d /sys/module/i915 ]; then
run_sway --unsupported-gpu $@
else
run_sway
fi