From c84328e1a530986607cd08758dfab490cada3f84 Mon Sep 17 00:00:00 2001 From: Jared Date: Fri, 2 Oct 2020 12:02:02 -0700 Subject: [PATCH] Change how Linux session display is determined. --- Agent/Services/AppLauncherLinux.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Agent/Services/AppLauncherLinux.cs b/Agent/Services/AppLauncherLinux.cs index cd92aab7..b7749a06 100644 --- a/Agent/Services/AppLauncherLinux.cs +++ b/Agent/Services/AppLauncherLinux.cs @@ -90,7 +90,7 @@ namespace Remotely.Agent.Services var xauthority = GetXorgAuth(); var display = ":0"; - var whoString = EnvironmentHelper.StartProcessWithResults("w", "-h")?.Trim(); + var whoString = EnvironmentHelper.StartProcessWithResults("who", "")?.Trim(); var username = ""; if (!string.IsNullOrWhiteSpace(whoString)) @@ -103,7 +103,7 @@ namespace Remotely.Agent.Services var whoSplit = whoLine.Split(' ', StringSplitOptions.RemoveEmptyEntries); username = whoSplit[0]; - display = whoSplit[2]; + display = whoSplit.Last().TrimStart('(').TrimEnd(')'); xauthority = $"/home/{username}/.Xauthority"; args = $"-u {username} {args}"; }