diff --git a/Desktop.Linux/Controls/MessageBox.xaml b/Desktop.Linux/Controls/MessageBox.xaml
index b460b6f0..493455e1 100644
--- a/Desktop.Linux/Controls/MessageBox.xaml
+++ b/Desktop.Linux/Controls/MessageBox.xaml
@@ -5,7 +5,7 @@
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
xmlns:vm="clr-namespace:Remotely.Desktop.Linux.ViewModels;assembly=Remotely_Desktop"
x:Class="Remotely.Desktop.Linux.Controls.MessageBox"
- Title="{Binding Caption}" SizeToContent="WidthAndHeight" MinWidth="200" MinHeight="100" WindowStartupLocation="CenterOwner">
+ Title="{Binding Caption}" SizeToContent="WidthAndHeight" MinWidth="200" MinHeight="100" WindowStartupLocation="CenterScreen">
diff --git a/Desktop.Linux/ViewModels/MainWindowViewModel.cs b/Desktop.Linux/ViewModels/MainWindowViewModel.cs
index 6bfa4240..9f7d88b4 100644
--- a/Desktop.Linux/ViewModels/MainWindowViewModel.cs
+++ b/Desktop.Linux/ViewModels/MainWindowViewModel.cs
@@ -132,6 +132,48 @@ namespace Remotely.Desktop.Linux.ViewModels
}
public ObservableCollection Viewers { get; } = new ObservableCollection();
+ private async Task CheckDependencies()
+ {
+ var dependencies = new string[]
+ {
+ "libx11-dev",
+ "libc6-dev",
+ "libgdiplus",
+ "libxtst-dev",
+ "xclip"
+ };
+
+ foreach (var dependency in dependencies)
+ {
+ var proc = Process.Start("dpkg", $"-s {dependency}");
+ proc.WaitForExit();
+ if (proc.ExitCode != 0)
+ {
+ var commands = "sudo apt-get -y install libx11-dev ; " +
+ "sudo apt-get -y install libc6-dev ; " +
+ "sudo apt-get -y install libgdiplus ; " +
+ "sudo apt-get -y install libxtst-dev ; " +
+ "sudo apt-get -y install xclip";
+
+ await App.Current.Clipboard.SetTextAsync(commands);
+
+ var message = "The following dependencies are required. Install commands have been copied to your clipboard." +
+ Environment.NewLine + Environment.NewLine +
+ "Please paste them into a terminal and run, then try opening Remotely again." +
+ Environment.NewLine + Environment.NewLine +
+ "libx11-dev" + Environment.NewLine +
+ "libc6-dev" + Environment.NewLine +
+ "libgdiplus" + Environment.NewLine +
+ "libxtst-dev" + Environment.NewLine +
+ "xclip";
+
+ await MessageBox.Show(message, "Dependencies Required", MessageBoxType.OK);
+
+ Environment.Exit(0);
+ }
+ }
+ }
+
public async Task GetSessionID()
{
await Conductor.CasterSocket.SendDeviceInfo(Conductor.ServiceID, Environment.MachineName, Conductor.DeviceID);
@@ -142,7 +184,8 @@ namespace Remotely.Desktop.Linux.ViewModels
{
try
{
- await Task.Run(CheckDependencies);
+
+ await CheckDependencies();
SessionID = "Retrieving...";
@@ -234,30 +277,6 @@ namespace Remotely.Desktop.Linux.ViewModels
ServiceContainer.Instance = serviceCollection.BuildServiceProvider();
}
- private async Task CheckDependencies()
- {
- var result = EnvironmentHelper.StartProcessWithResults("bash", "-c \"dpkg -s libc6-dev ; " +
- "dpkg -s libgdiplus ; " +
- "dpkg -s libxtst-dev ; " +
- "dpkg -s xclip\"");
-
- if (result?.Contains("is not installed", StringComparison.OrdinalIgnoreCase) == true)
- {
- var commands = "sudo apt-get -y install libc6-dev" + Environment.NewLine +
- "sudo apt-get -y install libgdiplus" + Environment.NewLine +
- "sudo apt-get -y install libxtst-dev" + Environment.NewLine +
- "sudo apt-get -y install xclip" + Environment.NewLine;
-
- ServiceContainer.Instance.GetRequiredService().SetText(commands);
-
- var message = "The following commands have been copied to your clipboard. " +
- "Please run them to install missing dependencies." +
- Environment.NewLine + Environment.NewLine +
- commands;
-
- await MessageBox.Show(message, "Dependencies Required", MessageBoxType.OK);
- }
- }
private void ScreenCastRequested(object sender, ScreenCastRequest screenCastRequest)
{
Dispatcher.UIThread.InvokeAsync(async () =>
diff --git a/ScreenCast.Core/Conductor.cs b/ScreenCast.Core/Conductor.cs
index bb024cce..72ab77bd 100644
--- a/ScreenCast.Core/Conductor.cs
+++ b/ScreenCast.Core/Conductor.cs
@@ -62,7 +62,6 @@ namespace Remotely.ScreenCast.Core
public void ProcessArgs(string[] args)
{
ArgDict = new Dictionary();
-
for (var i = 0; i < args.Length; i += 2)
{
try
diff --git a/ScreenCast.Linux/Program.cs b/ScreenCast.Linux/Program.cs
index f5981836..7669d4a2 100644
--- a/ScreenCast.Linux/Program.cs
+++ b/ScreenCast.Linux/Program.cs
@@ -27,7 +27,7 @@ namespace Remotely.ScreenCast.Linux
Conductor = Services.GetRequiredService();
- Conductor.ProcessArgs(Environment.GetCommandLineArgs().Skip(1).ToArray());
+ Conductor.ProcessArgs(Environment.GetCommandLineArgs().SkipWhile(x => !x.StartsWith("-")).ToArray());
if (Conductor.Mode == Core.Enums.AppMode.Chat)
{
diff --git a/ScreenCast.Win/Program.cs b/ScreenCast.Win/Program.cs
index 5bca8ce4..e897555c 100644
--- a/ScreenCast.Win/Program.cs
+++ b/ScreenCast.Win/Program.cs
@@ -40,7 +40,7 @@ namespace Remotely.ScreenCast.Win
BuildServices();
Conductor = Services.GetRequiredService();
- Conductor.ProcessArgs(Environment.GetCommandLineArgs().Skip(1).ToArray());
+ Conductor.ProcessArgs(Environment.GetCommandLineArgs().SkipWhile(x => !x.StartsWith("-")).ToArray());
if (Conductor.Mode == Core.Enums.AppMode.Chat)
{
diff --git a/Server/wwwroot/Downloads/Install-Linux-x64.sh b/Server/wwwroot/Downloads/Install-Linux-x64.sh
index 350d400e..9b5cd478 100644
--- a/Server/wwwroot/Downloads/Install-Linux-x64.sh
+++ b/Server/wwwroot/Downloads/Install-Linux-x64.sh
@@ -21,6 +21,7 @@ apt-get update
apt-get install dotnet-runtime-3.1
rm packages-microsoft-prod.deb
+apt-get -y install libx11-dev
apt-get -y install unzip
apt-get -y install libc6-dev
apt-get -y install libgdiplus