2017-11-25 08:59:48 -07:00
|
|
|
|
using ShiftOS.Main.ShiftOS;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using ShiftOS.Engine;
|
|
|
|
|
using static ShiftOS.Engine.CodepointUpgrade;
|
|
|
|
|
using static ShiftOS.Engine.SaveSystem;
|
2018-12-23 19:15:07 -06:00
|
|
|
|
using ShiftOS.Main;
|
|
|
|
|
using System.Windows.Forms;
|
2017-11-25 08:59:48 -07:00
|
|
|
|
|
|
|
|
|
namespace ShiftOS.Main.Terminal.Commands
|
|
|
|
|
{
|
|
|
|
|
public class startx : TerminalCommand, ICodepointUpgrade
|
|
|
|
|
{
|
|
|
|
|
private bool hasGUI = false;
|
|
|
|
|
private bool autostart = false;
|
2018-12-23 19:15:07 -06:00
|
|
|
|
private Timer timer = new Timer();
|
2017-11-25 08:59:48 -07:00
|
|
|
|
public override string Name { get; } = "startx";
|
|
|
|
|
public override string Summary { get; } = "Starts the ShiftX driver.";
|
|
|
|
|
public override string Usage { get; } = "startx";
|
|
|
|
|
public override bool Unlocked { get; set; } = false;
|
|
|
|
|
public int codePoints { get; set; } = 150;
|
|
|
|
|
public override void Run(params string[] args)
|
|
|
|
|
{
|
|
|
|
|
if (args.Length > 0)
|
|
|
|
|
{
|
|
|
|
|
if (args[0] == "autostart")
|
|
|
|
|
{
|
|
|
|
|
if (!autostart)
|
|
|
|
|
{
|
|
|
|
|
WriteLine("startx: Toggled autostart ON.");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
WriteLine("startx: Toggled autostart OFF.");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
WriteLine($"sbash: unexpected token: {args[0]}");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (!hasGUI)
|
|
|
|
|
{
|
2018-12-23 19:15:07 -06:00
|
|
|
|
WriteLine("[startx] starting driver...");
|
|
|
|
|
new System.Threading.ManualResetEvent(false).WaitOne(1500);
|
|
|
|
|
|
|
|
|
|
new Desktop().Show();
|
2017-11-25 08:59:48 -07:00
|
|
|
|
hasGUI = true;
|
2018-12-23 19:15:07 -06:00
|
|
|
|
return;
|
2017-11-25 08:59:48 -07:00
|
|
|
|
}
|
2018-12-23 19:15:07 -06:00
|
|
|
|
if (hasGUI)
|
2017-11-25 08:59:48 -07:00
|
|
|
|
{
|
2018-12-23 19:15:07 -06:00
|
|
|
|
WriteLine("startx: the ShiftX driver has already been intialized.");
|
2017-11-25 08:59:48 -07:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|