From 88a319ec7c49589530ee36c810cd699a4e8270ba Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Thomas=20Venri=C3=A8s?= <thomas.venries@gmail.com>
Date: Wed, 21 Sep 2022 12:37:30 +0200
Subject: [PATCH] sway-user-service: fix deprecated import-environment without
 variable
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit

Fixes #25

Signed-off-by: Alexander Miroshnichenko <alex@millerson.name>
---
 bin/sway-user-service | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/bin/sway-user-service b/bin/sway-user-service
index 946a91e17a60..647e1344d972 100755
--- a/bin/sway-user-service
+++ b/bin/sway-user-service
@@ -22,10 +22,13 @@ source /etc/profile
 export XDG_CURRENT_DESKTOP=sway
 
 # save environment variables that will be added to systemd
-new_env=$(systemctl --user show-environment | cut -d'=' -f 1 | sort | comm -13 - <(env | cut -d'=' -f 1 | sort))
+sys_env=$(systemctl --user show-environment | cut -d'=' -f 1 | sort)
+user_env=$(env | cut -d'=' -f 1 | sort)
+new_env=$(echo "$sys_env" | comm -13 - <(echo "$user_env"))
+shared_env=$(echo "$sys_env" | comm -12 - <(echo "$user_env"))
 
 # import environment variables from the login manager
-systemctl --user import-environment
+systemctl --user import-environment $new_env $shared_env
 
 # then start the service
 systemctl --wait --user start sway.service
-- 
2.35.1

