"start wox on system startup" config changes.
This commit is contained in:
parent
67f14d6a62
commit
3442081d20
|
@ -66,7 +66,6 @@ namespace Wox.Infrastructure
|
|||
var process = new Process();
|
||||
process.StartInfo = psi;
|
||||
process.Start();
|
||||
process.WaitForExit();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
|
|
@ -9,6 +9,8 @@ namespace Wox.Infrastructure.UserSettings
|
|||
public bool ReplaceWinR { get; set; }
|
||||
public List<WebSearch> WebSearches { get; set; }
|
||||
|
||||
public bool StartWoxOnSystemStartup { get; set; }
|
||||
|
||||
public List<WebSearch> LoadDefaultWebSearches()
|
||||
{
|
||||
List<WebSearch> webSearches = new List<WebSearch>();
|
||||
|
|
|
@ -67,13 +67,20 @@ namespace Wox
|
|||
base.OnStartup(e);
|
||||
|
||||
window = new MainWindow();
|
||||
window.ShowApp();
|
||||
if (e.Args.Length == 0 || e.Args[0].ToLower() != "starthide")
|
||||
{
|
||||
window.ShowApp();
|
||||
}
|
||||
|
||||
window.ParseArgs(e.Args);
|
||||
}
|
||||
|
||||
public void Activate(string[] args)
|
||||
{
|
||||
window.ShowApp();
|
||||
if (args.Length == 0 || args[0].ToLower() != "starthide")
|
||||
{
|
||||
window.ShowApp();
|
||||
}
|
||||
window.ParseArgs(args);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,6 +38,7 @@ namespace Wox
|
|||
{
|
||||
InitializeComponent();
|
||||
|
||||
InitialTray();
|
||||
hook.KeyPressed += OnHotKey;
|
||||
hook.RegisterHotKey(XModifierKeys.Alt, Keys.Space);
|
||||
resultCtrl.resultItemChangedEvent += resultCtrl_resultItemChangedEvent;
|
||||
|
@ -151,7 +152,7 @@ namespace Wox
|
|||
}, TimeSpan.FromSeconds(1), tbQuery.Text);
|
||||
}
|
||||
|
||||
}, TimeSpan.FromMilliseconds(300));
|
||||
}, TimeSpan.FromMilliseconds(150));
|
||||
}
|
||||
|
||||
private void StartProgress()
|
||||
|
@ -196,41 +197,22 @@ namespace Wox
|
|||
tbQuery.SelectAll();
|
||||
}
|
||||
break;
|
||||
|
||||
case "starthide":
|
||||
HideApp();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void SetAutoStart(bool IsAtuoRun)
|
||||
{
|
||||
//string LnkPath = Environment.GetFolderPath(Environment.SpecialFolder.Startup) + "//Wox.lnk";
|
||||
//if (IsAtuoRun)
|
||||
//{
|
||||
// WshShell shell = new WshShell();
|
||||
// IWshShortcut shortcut = (IWshShortcut)shell.CreateShortcut(LnkPath);
|
||||
// shortcut.TargetPath = System.Reflection.Assembly.GetExecutingAssembly().Location;
|
||||
// shortcut.WorkingDirectory = Environment.CurrentDirectory;
|
||||
// shortcut.WindowStyle = 1; //normal window
|
||||
// shortcut.Description = "Wox";
|
||||
// shortcut.Save();
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// System.IO.File.Delete(LnkPath);
|
||||
//}
|
||||
}
|
||||
|
||||
private void MainWindow_OnLoaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Left = (SystemParameters.PrimaryScreenWidth - ActualWidth) / 2;
|
||||
Top = (SystemParameters.PrimaryScreenHeight - ActualHeight) / 3;
|
||||
|
||||
Plugins.Init();
|
||||
InitialTray();
|
||||
SetAutoStart(true);
|
||||
WakeupApp();
|
||||
Plugins.Init();
|
||||
|
||||
//var engine = new Jurassic.ScriptEngine();
|
||||
//MessageBox.Show(engine.Evaluate("5 * 10 + 2").ToString());
|
||||
keyboardListener.hookedKeyboardCallback += KListener_hookedKeyboardCallback;
|
||||
}
|
||||
|
||||
|
|
|
@ -53,6 +53,7 @@ namespace Wox
|
|||
themeComboBox.SelectedItem = CommonStorage.Instance.UserSetting.Theme;
|
||||
cbReplaceWinR.IsChecked = CommonStorage.Instance.UserSetting.ReplaceWinR;
|
||||
webSearchView.ItemsSource = CommonStorage.Instance.UserSetting.WebSearches;
|
||||
cbStartWithWindows.IsChecked = CommonStorage.Instance.UserSetting.StartWoxOnSystemStartup;
|
||||
}
|
||||
|
||||
public void ReloadWebSearchView()
|
||||
|
@ -111,15 +112,21 @@ namespace Wox
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
private void CbStartWithWindows_OnChecked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
OnStartWithWindowsChecked();
|
||||
if (!CommonStorage.Instance.UserSetting.StartWoxOnSystemStartup)
|
||||
{
|
||||
CommonStorage.Instance.UserSetting.StartWoxOnSystemStartup = true;
|
||||
OnStartWithWindowsChecked();
|
||||
CommonStorage.Instance.Save();
|
||||
}
|
||||
}
|
||||
|
||||
private void CbStartWithWindows_OnUnchecked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
CommonStorage.Instance.UserSetting.StartWoxOnSystemStartup = false;
|
||||
OnStartWithWindowUnChecked();
|
||||
CommonStorage.Instance.Save();
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.NoInlining)]
|
||||
|
@ -142,7 +149,7 @@ namespace Wox
|
|||
{
|
||||
if (startup)
|
||||
{
|
||||
rk.SetValue("Wox",Path.Combine(Directory.GetCurrentDirectory(),"Wox.exe startHide"));
|
||||
rk.SetValue("Wox", Path.Combine(Directory.GetCurrentDirectory(), "Wox.exe startHide"));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue