mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-16 11:48:06 +01:00
"start wox on system startup" config changes.
This commit is contained in:
@@ -66,7 +66,6 @@ namespace Wox.Infrastructure
|
|||||||
var process = new Process();
|
var process = new Process();
|
||||||
process.StartInfo = psi;
|
process.StartInfo = psi;
|
||||||
process.Start();
|
process.Start();
|
||||||
process.WaitForExit();
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -9,6 +9,8 @@ namespace Wox.Infrastructure.UserSettings
|
|||||||
public bool ReplaceWinR { get; set; }
|
public bool ReplaceWinR { get; set; }
|
||||||
public List<WebSearch> WebSearches { get; set; }
|
public List<WebSearch> WebSearches { get; set; }
|
||||||
|
|
||||||
|
public bool StartWoxOnSystemStartup { get; set; }
|
||||||
|
|
||||||
public List<WebSearch> LoadDefaultWebSearches()
|
public List<WebSearch> LoadDefaultWebSearches()
|
||||||
{
|
{
|
||||||
List<WebSearch> webSearches = new List<WebSearch>();
|
List<WebSearch> webSearches = new List<WebSearch>();
|
||||||
|
|||||||
@@ -67,13 +67,20 @@ namespace Wox
|
|||||||
base.OnStartup(e);
|
base.OnStartup(e);
|
||||||
|
|
||||||
window = new MainWindow();
|
window = new MainWindow();
|
||||||
window.ShowApp();
|
if (e.Args.Length == 0 || e.Args[0].ToLower() != "starthide")
|
||||||
|
{
|
||||||
|
window.ShowApp();
|
||||||
|
}
|
||||||
|
|
||||||
window.ParseArgs(e.Args);
|
window.ParseArgs(e.Args);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Activate(string[] args)
|
public void Activate(string[] args)
|
||||||
{
|
{
|
||||||
window.ShowApp();
|
if (args.Length == 0 || args[0].ToLower() != "starthide")
|
||||||
|
{
|
||||||
|
window.ShowApp();
|
||||||
|
}
|
||||||
window.ParseArgs(args);
|
window.ParseArgs(args);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ namespace Wox
|
|||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
|
InitialTray();
|
||||||
hook.KeyPressed += OnHotKey;
|
hook.KeyPressed += OnHotKey;
|
||||||
hook.RegisterHotKey(XModifierKeys.Alt, Keys.Space);
|
hook.RegisterHotKey(XModifierKeys.Alt, Keys.Space);
|
||||||
resultCtrl.resultItemChangedEvent += resultCtrl_resultItemChangedEvent;
|
resultCtrl.resultItemChangedEvent += resultCtrl_resultItemChangedEvent;
|
||||||
@@ -151,7 +152,7 @@ namespace Wox
|
|||||||
}, TimeSpan.FromSeconds(1), tbQuery.Text);
|
}, TimeSpan.FromSeconds(1), tbQuery.Text);
|
||||||
}
|
}
|
||||||
|
|
||||||
}, TimeSpan.FromMilliseconds(300));
|
}, TimeSpan.FromMilliseconds(150));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void StartProgress()
|
private void StartProgress()
|
||||||
@@ -196,41 +197,22 @@ namespace Wox
|
|||||||
tbQuery.SelectAll();
|
tbQuery.SelectAll();
|
||||||
}
|
}
|
||||||
break;
|
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)
|
private void MainWindow_OnLoaded(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
Left = (SystemParameters.PrimaryScreenWidth - ActualWidth) / 2;
|
Left = (SystemParameters.PrimaryScreenWidth - ActualWidth) / 2;
|
||||||
Top = (SystemParameters.PrimaryScreenHeight - ActualHeight) / 3;
|
Top = (SystemParameters.PrimaryScreenHeight - ActualHeight) / 3;
|
||||||
|
|
||||||
Plugins.Init();
|
|
||||||
InitialTray();
|
|
||||||
SetAutoStart(true);
|
|
||||||
WakeupApp();
|
WakeupApp();
|
||||||
|
Plugins.Init();
|
||||||
|
|
||||||
//var engine = new Jurassic.ScriptEngine();
|
|
||||||
//MessageBox.Show(engine.Evaluate("5 * 10 + 2").ToString());
|
|
||||||
keyboardListener.hookedKeyboardCallback += KListener_hookedKeyboardCallback;
|
keyboardListener.hookedKeyboardCallback += KListener_hookedKeyboardCallback;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -53,6 +53,7 @@ namespace Wox
|
|||||||
themeComboBox.SelectedItem = CommonStorage.Instance.UserSetting.Theme;
|
themeComboBox.SelectedItem = CommonStorage.Instance.UserSetting.Theme;
|
||||||
cbReplaceWinR.IsChecked = CommonStorage.Instance.UserSetting.ReplaceWinR;
|
cbReplaceWinR.IsChecked = CommonStorage.Instance.UserSetting.ReplaceWinR;
|
||||||
webSearchView.ItemsSource = CommonStorage.Instance.UserSetting.WebSearches;
|
webSearchView.ItemsSource = CommonStorage.Instance.UserSetting.WebSearches;
|
||||||
|
cbStartWithWindows.IsChecked = CommonStorage.Instance.UserSetting.StartWoxOnSystemStartup;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ReloadWebSearchView()
|
public void ReloadWebSearchView()
|
||||||
@@ -111,15 +112,21 @@ namespace Wox
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void CbStartWithWindows_OnChecked(object sender, RoutedEventArgs e)
|
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)
|
private void CbStartWithWindows_OnUnchecked(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
|
CommonStorage.Instance.UserSetting.StartWoxOnSystemStartup = false;
|
||||||
OnStartWithWindowUnChecked();
|
OnStartWithWindowUnChecked();
|
||||||
|
CommonStorage.Instance.Save();
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.NoInlining)]
|
[MethodImpl(MethodImplOptions.NoInlining)]
|
||||||
@@ -142,7 +149,7 @@ namespace Wox
|
|||||||
{
|
{
|
||||||
if (startup)
|
if (startup)
|
||||||
{
|
{
|
||||||
rk.SetValue("Wox",Path.Combine(Directory.GetCurrentDirectory(),"Wox.exe startHide"));
|
rk.SetValue("Wox", Path.Combine(Directory.GetCurrentDirectory(), "Wox.exe startHide"));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user