Linux Desktop fixes.

This commit is contained in:
Jared Goodwin 2020-04-20 07:53:33 -07:00
parent 28589df7d3
commit 81db15cfe1
6 changed files with 48 additions and 29 deletions

View File

@ -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">
<Window.DataContext>
<vm:MessageBoxViewModel></vm:MessageBoxViewModel>
</Window.DataContext>

View File

@ -132,6 +132,48 @@ namespace Remotely.Desktop.Linux.ViewModels
}
public ObservableCollection<Viewer> Viewers { get; } = new ObservableCollection<Viewer>();
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<IClipboardService>().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 () =>

View File

@ -62,7 +62,6 @@ namespace Remotely.ScreenCast.Core
public void ProcessArgs(string[] args)
{
ArgDict = new Dictionary<string, string>();
for (var i = 0; i < args.Length; i += 2)
{
try

View File

@ -27,7 +27,7 @@ namespace Remotely.ScreenCast.Linux
Conductor = Services.GetRequiredService<Conductor>();
Conductor.ProcessArgs(Environment.GetCommandLineArgs().Skip(1).ToArray());
Conductor.ProcessArgs(Environment.GetCommandLineArgs().SkipWhile(x => !x.StartsWith("-")).ToArray());
if (Conductor.Mode == Core.Enums.AppMode.Chat)
{

View File

@ -40,7 +40,7 @@ namespace Remotely.ScreenCast.Win
BuildServices();
Conductor = Services.GetRequiredService<Conductor>();
Conductor.ProcessArgs(Environment.GetCommandLineArgs().Skip(1).ToArray());
Conductor.ProcessArgs(Environment.GetCommandLineArgs().SkipWhile(x => !x.StartsWith("-")).ToArray());
if (Conductor.Mode == Core.Enums.AppMode.Chat)
{

View File

@ -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