mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Merge branch 'warnings' of https://github.com/nachmore/Flow.Launcher into warnings
This commit is contained in:
commit
eb26070b8e
12 changed files with 145 additions and 63 deletions
|
|
@ -93,4 +93,4 @@ namespace Flow.Launcher.Core.Plugin
|
|||
|
||||
public Dictionary<string, object> SettingsChange { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -85,10 +85,13 @@ namespace Flow.Launcher.Core.Resource
|
|||
|
||||
Settings.Theme = theme;
|
||||
|
||||
// reload all resources even if the theme itself hasn't changed in order to pickup changes
|
||||
// to things like fonts
|
||||
UpdateResourceDictionary(GetResourceDictionary());
|
||||
|
||||
//always allow re-loading default theme, in case of failure of switching to a new theme from default theme
|
||||
if (_oldTheme != theme || theme == defaultTheme)
|
||||
{
|
||||
UpdateResourceDictionary(GetResourceDictionary());
|
||||
_oldTheme = Path.GetFileNameWithoutExtension(_oldResource.Source.AbsolutePath);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
|
@ -104,14 +104,22 @@ namespace Flow.Launcher
|
|||
});
|
||||
}
|
||||
|
||||
|
||||
private void AutoStartup()
|
||||
{
|
||||
if (_settings.StartFlowLauncherOnSystemStartup)
|
||||
// we try to enable auto-startup on first launch, or reenable if it was removed
|
||||
// but the user still has the setting set
|
||||
if (_settings.StartFlowLauncherOnSystemStartup && !Helper.AutoStartup.IsEnabled)
|
||||
{
|
||||
if (!SettingWindow.StartupSet())
|
||||
try
|
||||
{
|
||||
SettingWindow.SetStartup();
|
||||
Helper.AutoStartup.Enable();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
// but if it fails (permissions, etc) then don't keep retrying
|
||||
// this also gives the user a visual indication in the Settings widget
|
||||
_settings.StartFlowLauncherOnSystemStartup = false;
|
||||
Notification.Show(InternationalizationManager.Instance.GetTranslation("setAutoStartFailed"), e.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
63
Flow.Launcher/Helper/AutoStartup.cs
Normal file
63
Flow.Launcher/Helper/AutoStartup.cs
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Flow.Launcher.Infrastructure;
|
||||
using Flow.Launcher.Infrastructure.Logger;
|
||||
using Microsoft.Win32;
|
||||
|
||||
namespace Flow.Launcher.Helper
|
||||
{
|
||||
public class AutoStartup
|
||||
{
|
||||
private const string StartupPath = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run";
|
||||
|
||||
public static bool IsEnabled
|
||||
{
|
||||
get
|
||||
{
|
||||
try
|
||||
{
|
||||
using var key = Registry.CurrentUser.OpenSubKey(StartupPath, true);
|
||||
var path = key?.GetValue(Constant.FlowLauncher) as string;
|
||||
return path == Constant.ExecutablePath;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Log.Error("AutoStartup", $"Ignoring non-critical registry error (querying if enabled): {e}");
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static void Disable()
|
||||
{
|
||||
try
|
||||
{
|
||||
using var key = Registry.CurrentUser.OpenSubKey(StartupPath, true);
|
||||
key?.DeleteValue(Constant.FlowLauncher, false);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Log.Error("AutoStartup", $"Failed to disable auto-startup: {e}");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
internal static void Enable()
|
||||
{
|
||||
try
|
||||
{
|
||||
using var key = Registry.CurrentUser.OpenSubKey(StartupPath, true);
|
||||
key?.SetValue(Constant.FlowLauncher, Constant.ExecutablePath);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Log.Error("AutoStartup", $"Failed to enable auto-startup: {e}");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -30,6 +30,7 @@
|
|||
<system:String x:Key="portableMode">Portable Mode</system:String>
|
||||
<system:String x:Key="portableModeToolTIp">Store all settings and user data in one folder (Useful when used with removable drives or cloud services).</system:String>
|
||||
<system:String x:Key="startFlowLauncherOnSystemStartup">Start Flow Launcher on system startup</system:String>
|
||||
<system:String x:Key="setAutoStartFailed">Error setting launch on startup</system:String>
|
||||
<system:String x:Key="hideFlowLauncherWhenLoseFocus">Hide Flow Launcher when focus is lost</system:String>
|
||||
<system:String x:Key="dontPromptUpdateMsg">Do not show new version notifications</system:String>
|
||||
<system:String x:Key="rememberLastLocation">Remember last launch location</system:String>
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ namespace Flow.Launcher
|
|||
}
|
||||
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Interoperability", "CA1416:Validate platform compatibility", Justification = "<Pending>")]
|
||||
public static void Show(string title, string subTitle, string iconPath)
|
||||
public static void Show(string title, string subTitle, string iconPath = null)
|
||||
{
|
||||
// Handle notification for win7/8/early win10
|
||||
if (legacy)
|
||||
|
|
@ -45,4 +45,4 @@ namespace Flow.Launcher
|
|||
msg.Show(title, subTitle, iconPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
|
|
@ -285,4 +285,4 @@ namespace Flow.Launcher
|
|||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -598,10 +598,8 @@
|
|||
<TextBlock Style="{DynamicResource SettingTitleLabel}" Text="{DynamicResource startFlowLauncherOnSystemStartup}" />
|
||||
</StackPanel>
|
||||
<CheckBox
|
||||
Checked="OnAutoStartupChecked"
|
||||
IsChecked="{Binding Settings.StartFlowLauncherOnSystemStartup}"
|
||||
Style="{DynamicResource SideControlCheckBox}"
|
||||
Unchecked="OnAutoStartupUncheck" />
|
||||
IsChecked="{Binding StartFlowLauncherOnSystemStartup}"
|
||||
Style="{DynamicResource SideControlCheckBox}" />
|
||||
<TextBlock Style="{StaticResource Glyph}">
|
||||

|
||||
</TextBlock>
|
||||
|
|
@ -917,6 +915,7 @@
|
|||
Padding="0,0,0,0"
|
||||
Background="{DynamicResource Color01B}">
|
||||
<ListBox
|
||||
Name="Plugins"
|
||||
Width="Auto"
|
||||
Margin="5,0,0,0"
|
||||
Padding="0,0,7,0"
|
||||
|
|
@ -928,8 +927,7 @@
|
|||
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
|
||||
SelectedItem="{Binding SelectedPlugin}"
|
||||
SelectionChanged="SelectedPluginChanged"
|
||||
SnapsToDevicePixels="True"
|
||||
Name="Plugins">
|
||||
SnapsToDevicePixels="True">
|
||||
<ListBox.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<StackPanel Margin="0,0,0,18" />
|
||||
|
|
@ -1118,8 +1116,8 @@
|
|||
Margin="0"
|
||||
Padding="1"
|
||||
VerticalAlignment="Stretch"
|
||||
Content="{Binding SettingControl}"
|
||||
SizeChanged="ItemSizeChanged"/>
|
||||
Content="{Binding SettingControl}"
|
||||
SizeChanged="ItemSizeChanged" />
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel>
|
||||
|
|
@ -1129,8 +1127,7 @@
|
|||
VerticalAlignment="Center"
|
||||
BorderThickness="0,1,0,0"
|
||||
CornerRadius="0"
|
||||
Style="{DynamicResource SettingGroupBox}"
|
||||
Visibility="{Binding ActionKeywordsVisibility}">
|
||||
Style="{DynamicResource SettingGroupBox}">
|
||||
<ItemsControl Style="{DynamicResource SettingGrid}">
|
||||
<StackPanel
|
||||
Margin="0,0,-14,0"
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ using Flow.Launcher.Core.Resource;
|
|||
using Flow.Launcher.Helper;
|
||||
using Flow.Launcher.Infrastructure;
|
||||
using Flow.Launcher.Infrastructure.Hotkey;
|
||||
using Flow.Launcher.Infrastructure.Logger;
|
||||
using Flow.Launcher.Infrastructure.UserSettings;
|
||||
using Flow.Launcher.Plugin;
|
||||
using Flow.Launcher.Plugin.SharedCommands;
|
||||
|
|
@ -30,8 +31,6 @@ namespace Flow.Launcher
|
|||
{
|
||||
public partial class SettingWindow
|
||||
{
|
||||
private const string StartupPath = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run";
|
||||
|
||||
public readonly IPublicAPI API;
|
||||
private Settings settings;
|
||||
private SettingWindowViewModel viewModel;
|
||||
|
|
@ -57,39 +56,6 @@ namespace Flow.Launcher
|
|||
hwndTarget.RenderMode = RenderMode.SoftwareOnly;
|
||||
}
|
||||
|
||||
private void OnAutoStartupChecked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
SetStartup();
|
||||
}
|
||||
|
||||
private void OnAutoStartupUncheck(object sender, RoutedEventArgs e)
|
||||
{
|
||||
RemoveStartup();
|
||||
}
|
||||
|
||||
public static void SetStartup()
|
||||
{
|
||||
using var key = Registry.CurrentUser.OpenSubKey(StartupPath, true);
|
||||
key?.SetValue(Constant.FlowLauncher, Constant.ExecutablePath);
|
||||
}
|
||||
|
||||
private void RemoveStartup()
|
||||
{
|
||||
using var key = Registry.CurrentUser.OpenSubKey(StartupPath, true);
|
||||
key?.DeleteValue(Constant.FlowLauncher, false);
|
||||
}
|
||||
|
||||
public static bool StartupSet()
|
||||
{
|
||||
using var key = Registry.CurrentUser.OpenSubKey(StartupPath, true);
|
||||
var path = key?.GetValue(Constant.FlowLauncher) as string;
|
||||
if (path != null)
|
||||
{
|
||||
return path == Constant.ExecutablePath;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private void OnSelectPythonDirectoryClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var dlg = new FolderBrowserDialog
|
||||
|
|
|
|||
|
|
@ -306,8 +306,8 @@ namespace Flow.Launcher.ViewModel
|
|||
{
|
||||
Notification.Show(
|
||||
InternationalizationManager.Instance.GetTranslation("success"),
|
||||
InternationalizationManager.Instance.GetTranslation("completedSuccessfully"),
|
||||
"");
|
||||
InternationalizationManager.Instance.GetTranslation("completedSuccessfully")
|
||||
);
|
||||
}), TaskScheduler.Default)
|
||||
.ConfigureAwait(false);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
|
@ -60,7 +60,30 @@ namespace Flow.Launcher.ViewModel
|
|||
Settings.AutoUpdates = value;
|
||||
|
||||
if (value)
|
||||
{
|
||||
UpdateApp();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool StartFlowLauncherOnSystemStartup
|
||||
{
|
||||
get => Settings.StartFlowLauncherOnSystemStartup;
|
||||
set
|
||||
{
|
||||
Settings.StartFlowLauncherOnSystemStartup = value;
|
||||
|
||||
try
|
||||
{
|
||||
if (value)
|
||||
AutoStartup.Enable();
|
||||
else
|
||||
AutoStartup.Disable();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Notification.Show(InternationalizationManager.Instance.GetTranslation("setAutoStartFailed"), e.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
29
README.md
29
README.md
|
|
@ -38,10 +38,13 @@ Dedicated to making your workflow flow more seamless. Search everything from app
|
|||
<img src="https://user-images.githubusercontent.com/6903107/144858082-8b654daf-60fb-4ee6-89b2-6183b73510d1.png" width="100%">
|
||||
|
||||
<h4 align="center">
|
||||
<a href="#Getting-Started">Getting Started</a> • <a href="#Features">Features</a> • <a href="#Plugins">Plugins</a> •
|
||||
<a href="#Hotkeys">Hotkeys</a> •
|
||||
<a href="#QuestionsSuggestions">Questions/Suggestions</a> •
|
||||
<a href="#Development">Development</a> •
|
||||
<a href="#-getting-started">Getting Started</a> •
|
||||
<a href="#-features">Features</a> •
|
||||
<a href="#-plugins">Plugins</a> •
|
||||
<a href="#%EF%B8%8F-hotkeys">Hotkeys</a> •
|
||||
<a href="#sponsors">Sponsors</a> •
|
||||
<a href="#-questionssuggestions">Questions/Suggestions</a> •
|
||||
<a href="#development">Development</a> •
|
||||
<a href="https://flowlauncher.com/docs">Docs</a>
|
||||
</h4>
|
||||
|
||||
|
|
@ -262,10 +265,28 @@ And you can download <a href="https://github.com/Flow-Launcher/Flow.Launcher/dis
|
|||
|
||||
<img src="https://user-images.githubusercontent.com/6903107/144858082-8b654daf-60fb-4ee6-89b2-6183b73510d1.png" width="100%">
|
||||
|
||||
## Sponsors
|
||||
|
||||
<p align="center">
|
||||
<a href="https://appwrite.io">
|
||||
<img src='https://appwrite.io/images-ee/press/logo-1.svg' width="25%"/>
|
||||
</a>
|
||||
</p>
|
||||
|
||||
<p align="left">
|
||||
<a href="https://dev.to/appwrite/appwrite-loves-open-source-why-i-chose-to-support-flow-launcher-54pj">
|
||||
:sparkles:<i>Why I Chose to Support Flow-Launcher</i>:sparkles:
|
||||
</a>
|
||||
</p>
|
||||
|
||||
<img src="https://user-images.githubusercontent.com/6903107/144858082-8b654daf-60fb-4ee6-89b2-6183b73510d1.png" width="100%">
|
||||
|
||||
## ❔ Questions/Suggestions
|
||||
|
||||
Yes please, let us know in the [Q&A](https://github.com/Flow-Launcher/Flow.Launcher/discussions/categories/q-a) section. **Join our community on [Discord](https://discord.gg/AvgAQgh)!**
|
||||
|
||||
<img src="https://user-images.githubusercontent.com/6903107/144858082-8b654daf-60fb-4ee6-89b2-6183b73510d1.png" width="100%">
|
||||
|
||||
## Development
|
||||
|
||||
### Contributing
|
||||
|
|
|
|||
Loading…
Reference in a new issue