Move env variables to start-sway

This commit is contained in:
Aleksey Samoilov 2023-05-25 12:02:57 +04:00
parent e5038a23c5
commit ccf9d50f29
2 changed files with 21 additions and 3 deletions

3
etc/profile.d/sway.sh → etc/sway/environment Executable file → Normal file
View file

@ -1,6 +1,3 @@
# Set XDG_CURRENT_DESKTOP to Sway (for screencasting and screensharing capabilities)
export XDG_CURRENT_DESKTOP=sway
# TileOS specific config dir # TileOS specific config dir
export XDG_CONFIG_DIRS=/etc/xdg/xdg-tileos:/etc/xdg export XDG_CONFIG_DIRS=/etc/xdg/xdg-tileos:/etc/xdg

View file

@ -1,5 +1,10 @@
#!/usr/bin/env sh #!/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 # Check if system is running in virtual machine
case "$(systemd-detect-virt)" in case "$(systemd-detect-virt)" in
qemu) qemu)
@ -22,6 +27,22 @@ if [ -d /sys/module/nvidia ]; then
export LIBVA_DRIVER_NAME=nvidia export LIBVA_DRIVER_NAME=nvidia
fi fi
## Load system environment customizations
if [ -f /etc/sway/environment ]; then
set -o allexport
# shellcheck source=/dev/null
. /etc/sway/environment
set +o allexport
fi
## Load user environment customizations
if [ -f "${XDG_CONFIG_HOME:-$HOME/.config}/sway/environment" ]; then
set -o allexport
# shellcheck source=/dev/null
. "${XDG_CONFIG_HOME:-$HOME/.config}/sway/environment"
set +o allexport
fi
# Check if Nvidia driver installed, start Sway and send output to the journal # Check if Nvidia driver installed, start Sway and send output to the journal
if [ -d /sys/module/nvidia ]; then if [ -d /sys/module/nvidia ]; then
exec systemd-cat -- /usr/bin/sway --unsupported-gpu $@ exec systemd-cat -- /usr/bin/sway --unsupported-gpu $@