From ccf9d50f297c5afd5f5d9dc09c6db2f6ec3d96fd Mon Sep 17 00:00:00 2001 From: Sunderland93 Date: Thu, 25 May 2023 12:02:57 +0400 Subject: [PATCH] Move env variables to start-sway --- etc/{profile.d/sway.sh => sway/environment} | 3 --- usr/bin/start-sway | 21 +++++++++++++++++++++ 2 files changed, 21 insertions(+), 3 deletions(-) rename etc/{profile.d/sway.sh => sway/environment} (79%) mode change 100755 => 100644 diff --git a/etc/profile.d/sway.sh b/etc/sway/environment old mode 100755 new mode 100644 similarity index 79% rename from etc/profile.d/sway.sh rename to etc/sway/environment index ffc3aa2..a09f05d --- a/etc/profile.d/sway.sh +++ b/etc/sway/environment @@ -1,6 +1,3 @@ -# Set XDG_CURRENT_DESKTOP to Sway (for screencasting and screensharing capabilities) -export XDG_CURRENT_DESKTOP=sway - # TileOS specific config dir export XDG_CONFIG_DIRS=/etc/xdg/xdg-tileos:/etc/xdg diff --git a/usr/bin/start-sway b/usr/bin/start-sway index 22e1ea1..d164e94 100755 --- a/usr/bin/start-sway +++ b/usr/bin/start-sway @@ -1,5 +1,10 @@ #!/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) @@ -22,6 +27,22 @@ if [ -d /sys/module/nvidia ]; then export LIBVA_DRIVER_NAME=nvidia 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 if [ -d /sys/module/nvidia ]; then exec systemd-cat -- /usr/bin/sway --unsupported-gpu $@