From 6434165758bd81d8437203dbab6c43199494f3b5 Mon Sep 17 00:00:00 2001
From: c4pp4 <c4pp4@seznam.cz>
Date: Mon, 25 Mar 2019 02:59:20 +0100
Subject: [PATCH 1/1] Fix environment variables

Set XDG_CURRENT_DESKTOP environment variable to use an icon theme
according to gsettings override per session. Import DISPLAY environment
variable into the systemd manager environment block to show nm-applet
notifications and fix keyboard layout to correspond with
indicator-keyboard icon. Import XDG_SESSION_CLASS environment variable
used by indicator-sound.

Signed-off-by: c4pp4 <c4pp4@seznam.cz>
---
 src/unity-greeter.vala | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/src/unity-greeter.vala b/src/unity-greeter.vala
index a683836..81fcc22 100644
--- a/src/unity-greeter.vala
+++ b/src/unity-greeter.vala
@@ -543,6 +543,17 @@ public class UnityGreeter
         /* Protect memory from being paged to disk, as we deal with passwords */
         Posix.mlockall (Posix.MCL_CURRENT | Posix.MCL_FUTURE);
 
+        try
+        {
+            Process.spawn_command_line_sync ("systemctl --user import-environment DISPLAY XDG_SESSION_CLASS");
+        }
+        catch (Error e)
+        {
+            warning ("Error importing environment variables: %s", e.message);
+        }
+
+        Environment.set_variable ("XDG_CURRENT_DESKTOP", "unity-greeter", false);
+
         /* Disable the stupid global menubar */
         Environment.unset_variable ("UBUNTU_MENUPROXY");
 
-- 
2.19.2
