Merge remote-tracking branch 'upstream/dev' into GlobalHotkeyRefactor

This commit is contained in:
Kevin Zhang 2021-12-05 17:41:17 -06:00
commit b3155bcfed
91 changed files with 45576 additions and 800 deletions

View file

@ -1,4 +1,4 @@
using System;
using System;
using System.Diagnostics;
using System.IO;
using System.Threading;
@ -28,6 +28,11 @@ namespace Flow.Launcher.Core.Plugin
var path = Path.Combine(Constant.ProgramDirectory, JsonRPC);
_startInfo.EnvironmentVariables["PYTHONPATH"] = path;
_startInfo.EnvironmentVariables["FLOW_VERSION"] = Constant.Version;
_startInfo.EnvironmentVariables["FLOW_PROGRAM_DIRECTORY"] = Constant.ProgramDirectory;
_startInfo.EnvironmentVariables["FLOW_APPLICATION_DIRECTORY"] = Constant.ApplicationDirectory;
//Add -B flag to tell python don't write .py[co] files. Because .pyc contains location infos which will prevent python portable
_startInfo.ArgumentList.Add("-B");
}
@ -57,4 +62,4 @@ namespace Flow.Launcher.Core.Plugin
return Task.CompletedTask;
}
}
}
}

View file

@ -10,6 +10,7 @@ using Flow.Launcher.Infrastructure.Logger;
using Flow.Launcher.Infrastructure.UserSettings;
using Flow.Launcher.Plugin;
using System.Globalization;
using System.Threading.Tasks;
namespace Flow.Launcher.Core.Resource
{
@ -95,10 +96,13 @@ namespace Flow.Launcher.Core.Resource
{
LoadLanguage(language);
}
UpdatePluginMetadataTranslations();
Settings.Language = language.LanguageCode;
CultureInfo.CurrentCulture = new CultureInfo(language.LanguageCode);
CultureInfo.CurrentUICulture = CultureInfo.CurrentCulture;
Task.Run(() =>
{
UpdatePluginMetadataTranslations();
});
}
public bool PromptShouldUsePinyin(string languageCodeToSet)

View file

@ -15,7 +15,7 @@ namespace Flow.Launcher.Infrastructure.UserSettings
private string language = "en";
public string Hotkey { get; set; } = $"{KeyConstant.Alt} + {KeyConstant.Space}";
public string OpenResultModifiers { get; set; } = KeyConstant.Alt;
public string DarkMode { get; set; } = "System";
public string ColorScheme { get; set; } = "System";
public bool ShowOpenResultHotkey { get; set; } = true;
public double WindowSize { get; set; } = 580;
@ -39,6 +39,7 @@ namespace Flow.Launcher.Infrastructure.UserSettings
public string ResultFontWeight { get; set; }
public string ResultFontStretch { get; set; }
public bool UseGlyphIcons { get; set; } = true;
public bool FirstLaunch { get; set; } = true;
public int CustomExplorerIndex { get; set; } = 0;
@ -133,8 +134,8 @@ namespace Flow.Launcher.Infrastructure.UserSettings
public bool DontPromptUpdateMsg { get; set; }
public bool EnableUpdateLog { get; set; }
public bool StartFlowLauncherOnSystemStartup { get; set; } = true;
public bool HideOnStartup { get; set; }
public bool StartFlowLauncherOnSystemStartup { get; set; } = false;
public bool HideOnStartup { get; set; } = true;
bool _hideNotifyIcon { get; set; }
public bool HideNotifyIcon
{
@ -167,7 +168,7 @@ namespace Flow.Launcher.Infrastructure.UserSettings
Preserved
}
public enum DarkMode
public enum ColorSchemes
{
System,
Light,

View file

@ -1,4 +1,6 @@
namespace Flow.Launcher.Plugin
using System.Globalization;
namespace Flow.Launcher.Plugin
{
/// <summary>
/// Represent plugins that support internationalization
@ -8,5 +10,13 @@
string GetTranslatedPluginTitle();
string GetTranslatedPluginDescription();
/// <summary>
/// The method will be invoked when language of flow changed
/// </summary>
void OnCultureInfoChanged(CultureInfo newCulture)
{
}
}
}

View file

@ -37,6 +37,12 @@ namespace Flow.Launcher.Plugin
/// <exception cref="FileNotFoundException">Thrown when unable to find the file specified in the command </exception>
/// <exception cref="Win32Exception">Thrown when error occurs during the execution of the command </exception>
void ShellRun(string cmd, string filename = "cmd.exe");
/// <summary>
/// Copy Text to clipboard
/// </summary>
/// <param name="Text">Text to save on clipboard</param>
public void CopyToClipboard(string text);
/// <summary>
/// Save everything, all of Flow Launcher and plugins' data and settings

View file

@ -29,6 +29,13 @@ namespace Flow.Launcher.Plugin
/// </summary>
public string ActionKeywordAssigned { get; set; }
/// <summary>
/// This holds the text which can be provided by plugin to help Flow autocomplete text
/// for user on the plugin result. If autocomplete action for example is tab, pressing tab will have
/// the default constructed autocomplete text (result's Title), or the text provided here if not empty.
/// </summary>
public string AutoCompleteText { get; set; }
public string IcoPath
{
get { return _icoPath; }

View file

@ -13,7 +13,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Plugins", "Plugins", "{3A73
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Flow.Launcher", "Flow.Launcher\Flow.Launcher.csproj", "{DB90F671-D861-46BB-93A3-F1304F5BA1C5}"
ProjectSection(ProjectDependencies) = postProject
{1EE20B48-82FB-48A2-8086-675D6DDAB4F0} = {1EE20B48-82FB-48A2-8086-675D6DDAB4F0}
{0B9DE348-9361-4940-ADB6-F5953BFFCCEC} = {0B9DE348-9361-4940-ADB6-F5953BFFCCEC}
{4792A74A-0CEA-4173-A8B2-30E6764C6217} = {4792A74A-0CEA-4173-A8B2-30E6764C6217}
{FDB3555B-58EF-4AE6-B5F1-904719637AB4} = {FDB3555B-58EF-4AE6-B5F1-904719637AB4}
@ -23,6 +22,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Flow.Launcher", "Flow.Launc
{9B130CC5-14FB-41FF-B310-0A95B6894C37} = {9B130CC5-14FB-41FF-B310-0A95B6894C37}
{FDED22C8-B637-42E8-824A-63B5B6E05A3A} = {FDED22C8-B637-42E8-824A-63B5B6E05A3A}
{A3DCCBCA-ACC1-421D-B16E-210896234C26} = {A3DCCBCA-ACC1-421D-B16E-210896234C26}
{5043CECE-E6A7-4867-9CBE-02D27D83747A} = {5043CECE-E6A7-4867-9CBE-02D27D83747A}
{403B57F2-1856-4FC7-8A24-36AB346B763E} = {403B57F2-1856-4FC7-8A24-36AB346B763E}
{588088F4-3262-4F9F-9663-A05DE12534C3} = {588088F4-3262-4F9F-9663-A05DE12534C3}
EndProjectSection
@ -35,8 +35,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Flow.Launcher.Plugin.Progra
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Flow.Launcher.Plugin.WebSearch", "Plugins\Flow.Launcher.Plugin.WebSearch\Flow.Launcher.Plugin.WebSearch.csproj", "{403B57F2-1856-4FC7-8A24-36AB346B763E}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Flow.Launcher.Plugin.ControlPanel", "Plugins\Flow.Launcher.Plugin.ControlPanel\Flow.Launcher.Plugin.ControlPanel.csproj", "{1EE20B48-82FB-48A2-8086-675D6DDAB4F0}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Flow.Launcher.Plugin.PluginIndicator", "Plugins\Flow.Launcher.Plugin.PluginIndicator\Flow.Launcher.Plugin.PluginIndicator.csproj", "{FDED22C8-B637-42E8-824A-63B5B6E05A3A}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Flow.Launcher.Plugin.Sys", "Plugins\Flow.Launcher.Plugin.Sys\Flow.Launcher.Plugin.Sys.csproj", "{0B9DE348-9361-4940-ADB6-F5953BFFCCEC}"
@ -68,6 +66,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Flow.Launcher.Plugin.Proces
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Flow.Launcher.Plugin.PluginsManager", "Plugins\Flow.Launcher.Plugin.PluginsManager\Flow.Launcher.Plugin.PluginsManager.csproj", "{4792A74A-0CEA-4173-A8B2-30E6764C6217}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Flow.Launcher.Plugin.WindowsSettings", "Plugins\Flow.Launcher.Plugin.WindowsSettings\Flow.Launcher.Plugin.WindowsSettings.csproj", "{5043CECE-E6A7-4867-9CBE-02D27D83747A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -162,18 +162,6 @@ Global
{403B57F2-1856-4FC7-8A24-36AB346B763E}.Release|x64.Build.0 = Release|Any CPU
{403B57F2-1856-4FC7-8A24-36AB346B763E}.Release|x86.ActiveCfg = Release|Any CPU
{403B57F2-1856-4FC7-8A24-36AB346B763E}.Release|x86.Build.0 = Release|Any CPU
{1EE20B48-82FB-48A2-8086-675D6DDAB4F0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1EE20B48-82FB-48A2-8086-675D6DDAB4F0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1EE20B48-82FB-48A2-8086-675D6DDAB4F0}.Debug|x64.ActiveCfg = Debug|Any CPU
{1EE20B48-82FB-48A2-8086-675D6DDAB4F0}.Debug|x64.Build.0 = Debug|Any CPU
{1EE20B48-82FB-48A2-8086-675D6DDAB4F0}.Debug|x86.ActiveCfg = Debug|Any CPU
{1EE20B48-82FB-48A2-8086-675D6DDAB4F0}.Debug|x86.Build.0 = Debug|Any CPU
{1EE20B48-82FB-48A2-8086-675D6DDAB4F0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1EE20B48-82FB-48A2-8086-675D6DDAB4F0}.Release|Any CPU.Build.0 = Release|Any CPU
{1EE20B48-82FB-48A2-8086-675D6DDAB4F0}.Release|x64.ActiveCfg = Release|Any CPU
{1EE20B48-82FB-48A2-8086-675D6DDAB4F0}.Release|x64.Build.0 = Release|Any CPU
{1EE20B48-82FB-48A2-8086-675D6DDAB4F0}.Release|x86.ActiveCfg = Release|Any CPU
{1EE20B48-82FB-48A2-8086-675D6DDAB4F0}.Release|x86.Build.0 = Release|Any CPU
{FDED22C8-B637-42E8-824A-63B5B6E05A3A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FDED22C8-B637-42E8-824A-63B5B6E05A3A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FDED22C8-B637-42E8-824A-63B5B6E05A3A}.Debug|x64.ActiveCfg = Debug|Any CPU
@ -283,6 +271,18 @@ Global
{4792A74A-0CEA-4173-A8B2-30E6764C6217}.Release|x64.Build.0 = Release|Any CPU
{4792A74A-0CEA-4173-A8B2-30E6764C6217}.Release|x86.ActiveCfg = Release|Any CPU
{4792A74A-0CEA-4173-A8B2-30E6764C6217}.Release|x86.Build.0 = Release|Any CPU
{5043CECE-E6A7-4867-9CBE-02D27D83747A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5043CECE-E6A7-4867-9CBE-02D27D83747A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5043CECE-E6A7-4867-9CBE-02D27D83747A}.Debug|x64.ActiveCfg = Debug|Any CPU
{5043CECE-E6A7-4867-9CBE-02D27D83747A}.Debug|x64.Build.0 = Debug|Any CPU
{5043CECE-E6A7-4867-9CBE-02D27D83747A}.Debug|x86.ActiveCfg = Debug|Any CPU
{5043CECE-E6A7-4867-9CBE-02D27D83747A}.Debug|x86.Build.0 = Debug|Any CPU
{5043CECE-E6A7-4867-9CBE-02D27D83747A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5043CECE-E6A7-4867-9CBE-02D27D83747A}.Release|Any CPU.Build.0 = Release|Any CPU
{5043CECE-E6A7-4867-9CBE-02D27D83747A}.Release|x64.ActiveCfg = Release|Any CPU
{5043CECE-E6A7-4867-9CBE-02D27D83747A}.Release|x64.Build.0 = Release|Any CPU
{5043CECE-E6A7-4867-9CBE-02D27D83747A}.Release|x86.ActiveCfg = Release|Any CPU
{5043CECE-E6A7-4867-9CBE-02D27D83747A}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -290,7 +290,6 @@ Global
GlobalSection(NestedProjects) = preSolution
{FDB3555B-58EF-4AE6-B5F1-904719637AB4} = {3A73F5A7-0335-40D8-BF7C-F20BE5D0BA87}
{403B57F2-1856-4FC7-8A24-36AB346B763E} = {3A73F5A7-0335-40D8-BF7C-F20BE5D0BA87}
{1EE20B48-82FB-48A2-8086-675D6DDAB4F0} = {3A73F5A7-0335-40D8-BF7C-F20BE5D0BA87}
{FDED22C8-B637-42E8-824A-63B5B6E05A3A} = {3A73F5A7-0335-40D8-BF7C-F20BE5D0BA87}
{0B9DE348-9361-4940-ADB6-F5953BFFCCEC} = {3A73F5A7-0335-40D8-BF7C-F20BE5D0BA87}
{A3DCCBCA-ACC1-421D-B16E-210896234C26} = {3A73F5A7-0335-40D8-BF7C-F20BE5D0BA87}
@ -300,6 +299,7 @@ Global
{F9C4C081-4CC3-4146-95F1-E102B4E10A5F} = {3A73F5A7-0335-40D8-BF7C-F20BE5D0BA87}
{588088F4-3262-4F9F-9663-A05DE12534C3} = {3A73F5A7-0335-40D8-BF7C-F20BE5D0BA87}
{4792A74A-0CEA-4173-A8B2-30E6764C6217} = {3A73F5A7-0335-40D8-BF7C-F20BE5D0BA87}
{5043CECE-E6A7-4867-9CBE-02D27D83747A} = {3A73F5A7-0335-40D8-BF7C-F20BE5D0BA87}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {F26ACB50-3F6C-4907-B0C9-1ADACC1D0DED}

View file

@ -1,6 +1,8 @@
using System;
using System.Globalization;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Media;
using Flow.Launcher.Infrastructure.Logger;
using Flow.Launcher.ViewModel;
@ -10,13 +12,13 @@ namespace Flow.Launcher.Converters
{
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
{
if (values.Length != 2)
if (values.Length != 3)
{
return string.Empty;
}
var QueryTextBox = values[0] as TextBox;
// first prop is the current query string
var queryText = (string)values[0];
var queryText = (string)values[2];
if (string.IsNullOrEmpty(queryText))
return string.Empty;
@ -43,8 +45,20 @@ namespace Flow.Launcher.Converters
if (!selectedResultPossibleSuggestion.StartsWith(queryText, StringComparison.CurrentCultureIgnoreCase))
return string.Empty;
// For AutocompleteQueryCommand.
// When user typed lower case and result title is uppercase, we still want to display suggestion
return queryText + selectedResultPossibleSuggestion.Substring(queryText.Length);
selectedItem.QuerySuggestionText = queryText + selectedResultPossibleSuggestion.Substring(queryText.Length);
// Check if Text will be larger then our QueryTextBox
System.Windows.Media.Typeface typeface = new Typeface(QueryTextBox.FontFamily, QueryTextBox.FontStyle, QueryTextBox.FontWeight, QueryTextBox.FontStretch);
System.Windows.Media.FormattedText ft = new FormattedText(QueryTextBox.Text, System.Globalization.CultureInfo.CurrentCulture, System.Windows.FlowDirection.LeftToRight, typeface, QueryTextBox.FontSize, Brushes.Black);
if (ft.Width > QueryTextBox.ActualWidth || QueryTextBox.HorizontalOffset != 0)
{
return string.Empty;
};
return selectedItem.QuerySuggestionText;
}
catch (Exception e)
{

View file

@ -50,6 +50,7 @@
VerticalContentAlignment="Center"
input:InputMethod.IsInputMethodEnabled="False"
PreviewKeyDown="TbHotkey_OnPreviewKeyDown"
TabIndex="100" />
TabIndex="100"
LostFocus="tbHotkey_LostFocus"/>
</Grid>
</UserControl>

View file

@ -8,11 +8,16 @@ using Flow.Launcher.Core.Resource;
using Flow.Launcher.Helper;
using Flow.Launcher.Infrastructure.Hotkey;
using Flow.Launcher.Plugin;
using System.Threading;
namespace Flow.Launcher
{
public partial class HotkeyControl : UserControl
{
private Brush tbMsgForegroundColorOriginal;
private string tbMsgTextOriginal;
public HotkeyModel CurrentHotkey { get; private set; }
public bool CurrentHotkeyAvailable { get; private set; }
@ -23,15 +28,22 @@ namespace Flow.Launcher
public HotkeyControl()
{
InitializeComponent();
tbMsgTextOriginal = tbMsg.Text;
tbMsgForegroundColorOriginal = tbMsg.Foreground;
}
void TbHotkey_OnPreviewKeyDown(object sender, KeyEventArgs e)
private CancellationTokenSource hotkeyUpdateSource;
private void TbHotkey_OnPreviewKeyDown(object sender, KeyEventArgs e)
{
hotkeyUpdateSource?.Cancel();
hotkeyUpdateSource?.Dispose();
hotkeyUpdateSource = new();
var token = hotkeyUpdateSource.Token;
e.Handled = true;
tbMsg.Visibility = Visibility.Hidden;
//when alt is pressed, the real key should be e.SystemKey
Key key = (e.Key == Key.System ? e.SystemKey : e.Key);
Key key = e.Key == Key.System ? e.SystemKey : e.Key;
SpecialKeyState specialKeyState = GlobalHotkey.CheckModifiers();
@ -49,14 +61,15 @@ namespace Flow.Launcher
return;
}
Dispatcher.InvokeAsync(async () =>
_ = Dispatcher.InvokeAsync(async () =>
{
await Task.Delay(500);
SetHotkey(hotkeyModel);
await Task.Delay(500, token);
if (!token.IsCancellationRequested)
await SetHotkey(hotkeyModel);
});
}
public void SetHotkey(HotkeyModel keyModel, bool triggerValidate = true)
public async Task SetHotkey(HotkeyModel keyModel, bool triggerValidate = true)
{
CurrentHotkey = keyModel;
@ -78,6 +91,13 @@ namespace Flow.Launcher
}
tbMsg.Visibility = Visibility.Visible;
OnHotkeyChanged();
var token = hotkeyUpdateSource.Token;
await Task.Delay(500, token);
if (token.IsCancellationRequested)
return;
FocusManager.SetFocusedElement(FocusManager.GetFocusScope(this), null);
Keyboard.ClearFocus();
}
}
@ -88,9 +108,12 @@ namespace Flow.Launcher
private bool CheckHotkeyAvailability() => HotKeyMapper.CheckAvailability(CurrentHotkey);
public new bool IsFocused
public new bool IsFocused => tbHotkey.IsFocused;
private void tbHotkey_LostFocus(object sender, RoutedEventArgs e)
{
get { return tbHotkey.IsFocused; }
tbMsg.Text = tbMsgTextOriginal;
tbMsg.Foreground = tbMsgForegroundColorOriginal;
}
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB

View file

@ -87,10 +87,10 @@
<system:String x:Key="theme_load_failure_parse_error">Fail to load theme {0}, fallback to default theme</system:String>
<system:String x:Key="ThemeFolder">Theme Folder</system:String>
<system:String x:Key="OpenThemeFolder">Open Theme Folder</system:String>
<system:String x:Key="DarkMode">Dark Mode</system:String>
<system:String x:Key="DarkModeSystem">System Default</system:String>
<system:String x:Key="DarkModeLight">Light</system:String>
<system:String x:Key="DarkModeDark">Dark</system:String>
<system:String x:Key="ColorScheme">Color Scheme</system:String>
<system:String x:Key="ColorSchemeSystem">System Default</system:String>
<system:String x:Key="ColorSchemeLight">Light</system:String>
<system:String x:Key="ColorSchemeDark">Dark</system:String>
<system:String x:Key="SoundEffect">Sound Effect</system:String>
<system:String x:Key="SoundEffectTip">Play a small sound when the search window opens</system:String>
<system:String x:Key="Animation">Animation</system:String>
@ -152,6 +152,7 @@
<system:String x:Key="devtool">DevTools</system:String>
<system:String x:Key="settingfolder">Setting Folder</system:String>
<system:String x:Key="logfolder">Log Folder</system:String>
<system:String x:Key="welcomewindow">Wizard</system:String>
<!-- FileManager Setting Dialog -->
<system:String x:Key="fileManagerWindow">Select File Manager</system:String>
@ -178,7 +179,7 @@
<system:String x:Key="newActionKeywordsHasBeenAssigned">This new Action Keyword is already assigned to another plugin, please choose a different one</system:String>
<system:String x:Key="success">Success</system:String>
<system:String x:Key="completedSuccessfully">Completed successfully</system:String>
<system:String x:Key="actionkeyword_tips">Enter the action keyword you need to start the plug-in. Use * if you don't want to specify an action keyword. In the case, The plug-in works without keywords.</system:String>
<system:String x:Key="actionkeyword_tips">Enter the action keyword you like to use to start the plugin. Use * if you don't want to specify any, and the plugin will be triggered without any action keywords.</system:String>
<!-- Custom Query Hotkey Dialog -->
<system:String x:Key="customeQueryHotkeyTitle">Custom Query Hotkey</system:String>
@ -231,4 +232,40 @@
<system:String x:Key="update_flowlauncher_update_files">Update files</system:String>
<system:String x:Key="update_flowlauncher_update_upadte_description">Update description</system:String>
<!-- Welcome Window -->
<system:String x:Key="Skip">Skip</system:String>
<system:String x:Key="Welcome_Page1_Title">Welcome to Flow Launcher</system:String>
<system:String x:Key="Welcome_Page1_Text01">Hello, this is the first time you are running Flow Launcher!</system:String>
<system:String x:Key="Welcome_Page1_Text02">Before starting, this wizard will assist in setting up Flow Launcher. You can skip this if you wish. Please choose a language</system:String>
<system:String x:Key="Welcome_Page2_Title">Search and run all files and applications on your PC</system:String>
<system:String x:Key="Welcome_Page2_Text01">Search everything from applications, files, bookmarks, YouTube, Twitter and more. All from the comfort of your keyboard without ever touching the mouse.</system:String>
<system:String x:Key="Welcome_Page2_Text02">Flow Launcher starts with the hotkey below, go ahead and try it out now. To change it, click on the input and press the desired hotkey on the keyboard.</system:String>
<system:String x:Key="Welcome_Page3_Title">Hotkeys</system:String>
<system:String x:Key="Welcome_Page4_Title">Action Keyword and Commands</system:String>
<system:String x:Key="Welcome_Page4_Text01">Search the web, launch applications or run various functions through Flow Launcher plugins. Certain functions start with an action keyword, and if necessary, they can be used without action keywords. Try the queries below in Flow Launcher.</system:String>
<system:String x:Key="Welcome_Page5_Title">Let's Start Flow Launcher</system:String>
<system:String x:Key="Welcome_Page5_Text01">Finished. Enjoy Flow Launcher. Don't forget the hotkey to start :)</system:String>
<!-- General Guide & Hotkey -->
<system:String x:Key="HotkeyUpDownDesc">Back / Context Menu</system:String>
<system:String x:Key="HotkeyLeftRightDesc">Item Navigation</system:String>
<system:String x:Key="HotkeyShiftEnterDesc">Open Context Menu</system:String>
<system:String x:Key="HotkeyCtrlEnterDesc">Open Contaning Folder</system:String>
<system:String x:Key="HotkeyCtrlShiftEnterDesc">Run as Admin</system:String>
<system:String x:Key="HotkeyCtrlHDesc">Query History</system:String>
<system:String x:Key="HotkeyESCDesc">Back to Result in Context Menu</system:String>
<system:String x:Key="HotkeyRunDesc">Open / Run Selected Item</system:String>
<system:String x:Key="HotkeyCtrlIDesc">Open Setting Window</system:String>
<system:String x:Key="HotkeyF5Desc">Reload Plugin Data</system:String>
<system:String x:Key="RecommendWeather">Weather</system:String>
<system:String x:Key="RecommendWeatherDesc">Weather in Google Result</system:String>
<system:String x:Key="RecommendShell">&gt; ping 8.8.8.8</system:String>
<system:String x:Key="RecommendShellDesc">Shell Command</system:String>
<system:String x:Key="RecommendBluetooth">Bluetooth</system:String>
<system:String x:Key="RecommendBluetoothDesc">Bluetooth in Windows Setting</system:String>
<system:String x:Key="RecommendAcronyms">sn</system:String>
<system:String x:Key="RecommendAcronymsDesc">Sticky Notes</system:String>
</ResourceDictionary>

View file

@ -3,7 +3,7 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:system="clr-namespace:System;assembly=mscorlib">
<!-- MainWindow -->
<system:String x:Key="registerHotkeyFailed">키 등록 실패: {0}</system:String>
<system:String x:Key="registerHotkeyFailed">단축키 등록 실패: {0}</system:String>
<system:String x:Key="couldnotStartCmd">{0}을 실행할 수 없습니다.</system:String>
<system:String x:Key="invalidFlowLauncherPluginFileFormat">Flow Launcher 플러그인 파일 형식이 유효하지 않습니다.</system:String>
<system:String x:Key="setAsTopMostInThisQuery">이 쿼리의 최상위로 설정</system:String>
@ -16,7 +16,7 @@
<system:String x:Key="iconTrayExit">종료</system:String>
<system:String x:Key="closeWindow">닫기</system:String>
<system:String x:Key="GameMode">게임 모드</system:String>
<system:String x:Key="GameModeToolTip">키 사용을 일시중단합니다.</system:String>
<system:String x:Key="GameModeToolTip">단축키 사용을 일시중단합니다.</system:String>
<!-- Setting General -->
<system:String x:Key="flowlauncher_settings">Flow Launcher 설정</system:String>
@ -34,7 +34,7 @@
<system:String x:Key="LastQuerySelected">직전 쿼리 내용 선택</system:String>
<system:String x:Key="LastQueryEmpty">직전 쿼리 지우기</system:String>
<system:String x:Key="maxShowResults">표시할 결과 수</system:String>
<system:String x:Key="ignoreHotkeysOnFullscreen">전체화면 모드에서는 키 무시</system:String>
<system:String x:Key="ignoreHotkeysOnFullscreen">전체화면 모드에서는 단축키 무시</system:String>
<system:String x:Key="ignoreHotkeysOnFullscreenToolTip">게이머라면 켜는 것을 추천합니다.</system:String>
<system:String x:Key="defaultFileManager">기본 파일관리자</system:String>
<system:String x:Key="defaultFileManagerToolTip">폴더를 열 때 사용할 파일관리자를 선택하세요.</system:String>
@ -87,31 +87,30 @@
<system:String x:Key="theme_load_failure_parse_error">{0} 테마 로드에 실패했습니다. 기본 테마로 변경합니다.</system:String>
<system:String x:Key="ThemeFolder">테마 폴더</system:String>
<system:String x:Key="OpenThemeFolder">테마 폴더 열기</system:String>
<system:String x:Key="DarkMode">다크 모드</system:String>
<system:String x:Key="DarkModeTip">System settings will take effect from the next run</system:String>
<system:String x:Key="DarkModeSystem">시스템 기본</system:String>
<system:String x:Key="DarkModeLight">밝게</system:String>
<system:String x:Key="DarkModeDark">어둡게</system:String>
<system:String x:Key="ColorScheme">앱 색상</system:String>
<system:String x:Key="ColorSchemeSystem">시스템 기본</system:String>
<system:String x:Key="ColorSchemeLight">밝게</system:String>
<system:String x:Key="ColorSchemeDark">어둡게</system:String>
<system:String x:Key="SoundEffect">소리 효과</system:String>
<system:String x:Key="SoundEffectTip">검색창을 열 때 작은 소리를 재생합니다.</system:String>
<system:String x:Key="Animation">애니메이션</system:String>
<system:String x:Key="AnimationTip">일부 UI에 애니메이션을 사용합니다.</system:String>
<!-- Setting Hotkey -->
<system:String x:Key="hotkey">키</system:String>
<system:String x:Key="flowlauncherHotkey">Flow Launcher 키</system:String>
<system:String x:Key="hotkey">단축키</system:String>
<system:String x:Key="flowlauncherHotkey">Flow Launcher 단축키</system:String>
<system:String x:Key="flowlauncherHotkeyToolTip">Flow Launcher를 열 때 사용할 단축키를 입력합니다.</system:String>
<system:String x:Key="openResultModifiers">결과 선택 단축키</system:String>
<system:String x:Key="openResultModifiersToolTip">결과 목록을 선택하는 단축키입니다.</system:String>
<system:String x:Key="showOpenResultHotkey">단축키 표시</system:String>
<system:String x:Key="showOpenResultHotkeyToolTip">결과창에서 결과 선택 단축키를 표시합니다.</system:String>
<system:String x:Key="customQueryHotkey">사용자지정 쿼리 키</system:String>
<system:String x:Key="customQueryHotkey">사용자지정 쿼리 단축키</system:String>
<system:String x:Key="customQuery">쿼리</system:String>
<system:String x:Key="delete">삭제</system:String>
<system:String x:Key="edit">편집</system:String>
<system:String x:Key="add">추가</system:String>
<system:String x:Key="pleaseSelectAnItem">항목을 선택하세요.</system:String>
<system:String x:Key="deleteCustomHotkeyWarning">{0} 플러그인 키를 삭제하시겠습니까?</system:String>
<system:String x:Key="deleteCustomHotkeyWarning">{0} 플러그인 단축키를 삭제하시겠습니까?</system:String>
<system:String x:Key="queryWindowShadowEffect">그림자 효과</system:String>
<system:String x:Key="shadowEffectCPUUsage">그림자 효과는 GPU를 사용합니다. 컴퓨터 퍼포먼스가 제한적인 경우 사용을 추천하지 않습니다.</system:String>
<system:String x:Key="windowWidthSize">창 넓이</system:String>
@ -153,6 +152,7 @@
<system:String x:Key="devtool">개발자도구</system:String>
<system:String x:Key="settingfolder">설정 폴더</system:String>
<system:String x:Key="logfolder">로그 폴더</system:String>
<system:String x:Key="welcomewindow">마법사</system:String>
<!-- FileManager Setting Dialog -->
<system:String x:Key="fileManagerWindow">파일관리자 선택</system:String>
@ -181,15 +181,15 @@
<system:String x:Key="actionkeyword_tips">플러그인을 시작하는데 필요한 액션 키워드를 입력하세요. 액션 키워드를 지정하지 않으려면 *를 사용하세요. 이 경우 키워드를 입력하지 않아도 동작합니다.</system:String>
<!-- Custom Query Hotkey Dialog -->
<system:String x:Key="customeQueryHotkeyTitle">커스텀 플러그인 키</system:String>
<system:String x:Key="customeQueryHotkeyTitle">커스텀 플러그인 단축키</system:String>
<system:String x:Key="customeQueryHotkeyTips">단축키를 지정하여 특정 쿼리를 자동으로 입력할 수 있습니다. 사용하고 싶은 단축키를 눌러 지정한 후, 사용할 쿼리를 입력하세요.</system:String>
<system:String x:Key="preview">미리보기</system:String>
<system:String x:Key="hotkeyIsNotUnavailable">핫키를 사용할 수 없습니다. 다른 핫키를 입력하세요.</system:String>
<system:String x:Key="invalidPluginHotkey">플러그인 키가 유효하지 않습니다.</system:String>
<system:String x:Key="hotkeyIsNotUnavailable">단축키를 사용할 수 없습니다. 다른 단축키를 입력하세요.</system:String>
<system:String x:Key="invalidPluginHotkey">플러그인 단축키가 유효하지 않습니다.</system:String>
<system:String x:Key="update">업데이트</system:String>
<!-- Hotkey Control -->
<system:String x:Key="hotkeyUnavailable">키를 사용할 수 없습니다.</system:String>
<system:String x:Key="hotkeyUnavailable">단축키를 사용할 수 없습니다.</system:String>
<!-- Crash Reporter -->
<system:String x:Key="reportWindow_version">버전</system:String>
@ -230,4 +230,41 @@
<system:String x:Key="update_flowlauncher_update_files">업데이트 파일</system:String>
<system:String x:Key="update_flowlauncher_update_upadte_description">업데이트 설명</system:String>
<!-- Welcome Window -->
<system:String x:Key="Skip">건너뛰기</system:String>
<system:String x:Key="Welcome_Page1_Title">Flow Launcher에 오신 것을 환영합니다</system:String>
<system:String x:Key="Welcome_Page1_Text01">안녕하세요, Flow Launcher를 처음 실행하시네요!</system:String>
<system:String x:Key="Welcome_Page1_Text02">시작하기전에 이 마법사가 간단한 설정을 도와드릴겁니다. 물론 건너 뛰셔도 됩니다. 사용하시는 언어를 선택해주세요.</system:String>
<system:String x:Key="Welcome_Page2_Title">PC에서 모든 파일과 프로그램을 검색하고 실행합니다</system:String>
<system:String x:Key="Welcome_Page2_Text01">프로그램, 파일, 즐겨찾기, YouTube, Twitter 등 모든 것을 검색하세요. 마우스에 손대지 않고 키보드만으로 모든 것을 얻을 수 있습니다.</system:String>
<system:String x:Key="Welcome_Page2_Text02">Flow는 아래의 단축키로 실행합니다. 변경하려면 입력창을 선택하고 키보드에서 원하는 단축키를 누릅니다.</system:String>
<system:String x:Key="Welcome_Page3_Title">단축키</system:String>
<system:String x:Key="Welcome_Page4_Title">액션 키워드와 명령어</system:String>
<system:String x:Key="Welcome_Page4_Text01">Flow Launcher는 플러그인을 통해 웹 검색, 프로그램 실행, 다양한 기능을 실행합니다. 특정 기능은 액션 키워드로 시작하며, 필요한 경우 액션 키워드 없이 사용할 수 있습니다. Flow Launcher에서 아래 쿼리를 사용해 보세요.</system:String>
<system:String x:Key="Welcome_Page5_Title">Flow Launcher를 시작합시다</system:String>
<system:String x:Key="Welcome_Page5_Text01">끝났습니다. Flow Launcher를 즐겨주세요. 시작하는 단축키를 잊지마세요 :)</system:String>
<!-- General Guide & Hotkey -->
<system:String x:Key="HotkeyUpDownDesc">뒤로/ 콘텍스트 메뉴</system:String>
<system:String x:Key="HotkeyLeftRightDesc">아이템 이동</system:String>
<system:String x:Key="HotkeyShiftEnterDesc">콘텍스트 메뉴 열기</system:String>
<system:String x:Key="HotkeyCtrlEnterDesc">포함된 폴더 열기</system:String>
<system:String x:Key="HotkeyCtrlShiftEnterDesc">관리자 권한으로 실행</system:String>
<system:String x:Key="HotkeyCtrlHDesc">검색 기록</system:String>
<system:String x:Key="HotkeyESCDesc">콘텍스트 메뉴에서 뒤로 가기</system:String>
<system:String x:Key="HotkeyRunDesc">선택한 아이템 열기</system:String>
<system:String x:Key="HotkeyCtrlIDesc">설정창 열기</system:String>
<system:String x:Key="HotkeyF5Desc">플러그인 데이터 새로고침</system:String>
<system:String x:Key="RecommendWeather">날씨</system:String>
<system:String x:Key="RecommendWeatherDesc">구글 날씨 검색</system:String>
<system:String x:Key="RecommendShell">&gt; ping 8.8.8.8</system:String>
<system:String x:Key="RecommendShellDesc">쉘 명령어</system:String>
<system:String x:Key="RecommendBluetooth">블루투스</system:String>
<system:String x:Key="RecommendBluetoothDesc">윈도우 블루투스 설정</system:String>
<system:String x:Key="RecommendAcronyms">스메</system:String>
<system:String x:Key="RecommendAcronymsDesc">스티커 메모</system:String>
</ResourceDictionary>

View file

@ -41,10 +41,12 @@
<KeyBinding Key="Escape" Command="{Binding EscCommand}" />
<KeyBinding Key="F1" Command="{Binding StartHelpCommand}" />
<KeyBinding Key="F5" Command="{Binding ReloadPluginDataCommand}" />
<KeyBinding Key="Tab" Command="{Binding SelectNextItemCommand}" />
<KeyBinding
Key="Tab"
Command="{Binding SelectPrevItemCommand}"
Command="{Binding AutocompleteQueryCommand}"/>
<KeyBinding
Key="Tab"
Command="{Binding AutocompleteQueryCommand}"
Modifiers="Shift" />
<KeyBinding
Key="I"
@ -161,8 +163,9 @@
Style="{DynamicResource QuerySuggestionBoxStyle}">
<TextBox.Text>
<MultiBinding Converter="{StaticResource QuerySuggestionBoxConverter}">
<Binding ElementName="QueryTextBox" Path="Text" />
<Binding ElementName="QueryTextBox" Mode="OneTime" />
<Binding ElementName="ResultListBox" Path="SelectedItem" />
<Binding ElementName="QueryTextBox" Path="Text" />
</MultiBinding>
</TextBox.Text>
</TextBox>

View file

@ -65,10 +65,11 @@ namespace Flow.Launcher
private void OnLoaded(object sender, RoutedEventArgs _)
{
CheckFirstLaunch();
HideStartup();
// show notify icon when flowlauncher is hidden
InitializeNotifyIcon();
InitializeDarkMode();
InitializeColorScheme();
WindowsInteropHelper.DisableControlBox(this);
InitProgressbarAnimation();
// since the default main window visibility is visible
@ -232,6 +233,20 @@ namespace Flow.Launcher
};
}
private void CheckFirstLaunch()
{
if (_settings.FirstLaunch)
{
_settings.FirstLaunch = false;
PluginManager.API.SaveAppAllSettings();
OpenWelcomeWindow();
}
}
private void OpenWelcomeWindow()
{
var WelcomeWindow = new WelcomeWindow(_settings);
WelcomeWindow.Show();
}
private void ToggleGameMode()
{
if (_viewModel.GameModeStatus)
@ -259,7 +274,6 @@ namespace Flow.Launcher
_viewModel.ProgressBarVisibility = Visibility.Hidden;
isProgressBarStoryboardPaused = true;
}
public void WindowAnimator()
{
if (_animating)
@ -480,13 +494,13 @@ namespace Flow.Launcher
QueryTextBox.CaretIndex = QueryTextBox.Text.Length;
}
public void InitializeDarkMode()
public void InitializeColorScheme()
{
if (_settings.DarkMode == Constant.Light)
if (_settings.ColorScheme == Constant.Light)
{
ModernWpf.ThemeManager.Current.ApplicationTheme = ModernWpf.ApplicationTheme.Light;
}
else if (_settings.DarkMode == Constant.Dark)
else if (_settings.ColorScheme == Constant.Dark)
{
ModernWpf.ThemeManager.Current.ApplicationTheme = ModernWpf.ApplicationTheme.Dark;
}

View file

@ -114,6 +114,11 @@ namespace Flow.Launcher
var startInfo = ShellCommand.SetProcessStartInfo(filename, arguments: args, createNoWindow: true);
ShellCommand.Execute(startInfo);
}
public void CopyToClipboard(string text)
{
Clipboard.SetDataObject(text);
}
public void StartLoadingBar() => _mainVM.ProgressBarVisibility = Visibility.Visible;
@ -232,4 +237,4 @@ namespace Flow.Launcher
#endregion
}
}
}

View file

@ -0,0 +1,189 @@
<ui:Page
x:Class="Flow.Launcher.Resources.Pages.WelcomePage1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Flow.Launcher.Resources.Pages"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:ui="http://schemas.modernwpf.com/2019"
Title="WelcomePage1"
DataContext="{Binding RelativeSource={RelativeSource Self}}"
mc:Ignorable="d">
<Page.Resources>
<Style x:Key="StyleImageFadeIn" TargetType="{x:Type Image}">
<Style.Triggers>
<!-- Fades-in the image when it becomes visible -->
<Trigger Property="IsVisible" Value="True">
<Trigger.EnterActions>
<BeginStoryboard>
<BeginStoryboard.Storyboard>
<Storyboard x:Name="FadeIn">
<DoubleAnimation
Storyboard.TargetProperty="(Canvas.Top)"
From="105"
To="95"
Duration="0:0:1">
<DoubleAnimation.EasingFunction>
<QuadraticEase EasingMode="EaseOut" />
</DoubleAnimation.EasingFunction>
</DoubleAnimation>
<DoubleAnimation
Storyboard.TargetProperty="Opacity"
From="0"
To="1"
Duration="0:0:1">
<DoubleAnimation.EasingFunction>
<QuadraticEase EasingMode="EaseOut" />
</DoubleAnimation.EasingFunction>
</DoubleAnimation>
</Storyboard>
</BeginStoryboard.Storyboard>
</BeginStoryboard>
</Trigger.EnterActions>
</Trigger>
</Style.Triggers>
</Style>
<Style x:Key="StyleImageFadeInText" TargetType="{x:Type TextBlock}">
<Style.Triggers>
<Trigger Property="IsVisible" Value="True">
<Trigger.EnterActions>
<BeginStoryboard>
<BeginStoryboard.Storyboard>
<Storyboard x:Name="FadeIn">
<DoubleAnimation
Storyboard.TargetProperty="(Canvas.Top)"
From="110"
To="100"
Duration="0:0:1">
<DoubleAnimation.EasingFunction>
<QuadraticEase EasingMode="EaseOut" />
</DoubleAnimation.EasingFunction>
</DoubleAnimation>
<DoubleAnimation
Storyboard.TargetProperty="Opacity"
From="0"
To="1"
Duration="0:0:1">
<DoubleAnimation.EasingFunction>
<QuadraticEase EasingMode="EaseOut" />
</DoubleAnimation.EasingFunction>
</DoubleAnimation>
</Storyboard>
</BeginStoryboard.Storyboard>
</BeginStoryboard>
</Trigger.EnterActions>
</Trigger>
</Style.Triggers>
</Style>
<Style x:Key="WizardMove" TargetType="{x:Type Image}">
<Style.Triggers>
<Trigger Property="IsVisible" Value="True">
<Trigger.EnterActions>
<BeginStoryboard>
<BeginStoryboard.Storyboard>
<Storyboard x:Name="Move">
<DoubleAnimation
Storyboard.TargetProperty="(Canvas.Bottom)"
From="-150"
To="0"
Duration="0:0:2.5">
<DoubleAnimation.EasingFunction>
<QuadraticEase EasingMode="EaseOut" />
</DoubleAnimation.EasingFunction>
</DoubleAnimation>
</Storyboard>
</BeginStoryboard.Storyboard>
</BeginStoryboard>
</Trigger.EnterActions>
</Trigger>
</Style.Triggers>
</Style>
</Page.Resources>
<ScrollViewer>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="250" />
<RowDefinition />
</Grid.RowDefinitions>
<Border Grid.Row="0" HorizontalAlignment="Stretch">
<Border.Background>
<LinearGradientBrush StartPoint="0 0" EndPoint="1 1">
<LinearGradientBrush.GradientStops>
<GradientStop Offset="0.0" Color="#1494df" />
<GradientStop Offset="1.0" Color="#1073bd" />
</LinearGradientBrush.GradientStops>
</LinearGradientBrush>
</Border.Background>
<StackPanel HorizontalAlignment="Center" Orientation="Horizontal">
<Canvas Width="550" Height="250">
<Image
Name="Logo"
Canvas.Left="140"
Width="60"
Height="60"
Source="../../images/app.png"
Style="{DynamicResource StyleImageFadeIn}" />
<TextBlock
Canvas.Left="205"
Margin="12,0,0,0"
VerticalAlignment="Center"
FontSize="30"
Foreground="White"
Opacity="0"
Style="{DynamicResource StyleImageFadeInText}">
Flow Launcher
</TextBlock>
</Canvas>
</StackPanel>
</Border>
<Canvas Grid.Row="1" Height="288">
<Image
Name="wizard"
Canvas.Right="30"
Canvas.Bottom="0"
Width="60"
Height="60"
Source="../../images/wizard.png"
Style="{DynamicResource WizardMove}" />
<StackPanel Width="550" Margin="24,20,24,20">
<StackPanel Margin="0,0,24,0">
<TextBlock
FontSize="20"
FontWeight="SemiBold"
Text="{DynamicResource Welcome_Page1_Title}" />
<TextBlock
Margin="0,10,24,0"
FontSize="14"
Text="{DynamicResource Welcome_Page1_Text01}"
TextWrapping="WrapWithOverflow" />
<TextBlock
Margin="0,10,24,0"
FontSize="14"
Text="{DynamicResource Welcome_Page1_Text02}"
TextWrapping="WrapWithOverflow" />
<TextBlock
Margin="0,30,0,0"
FontSize="14"
FontWeight="SemiBold"
Text="{DynamicResource language}" />
<ComboBox
Width="200"
Margin="0,10,0,0"
DisplayMemberPath="Display"
ItemsSource="{Binding Languages}"
SelectedValue="{Binding CustomLanguage, Mode=TwoWay}"
SelectedValuePath="LanguageCode" />
</StackPanel>
</StackPanel>
</Canvas>
</Grid>
</ScrollViewer>
</ui:Page>

View file

@ -0,0 +1,40 @@
using System;
using System.Collections.Generic;
using System.Windows.Navigation;
using Flow.Launcher.Infrastructure.UserSettings;
using Flow.Launcher.Core.Resource;
namespace Flow.Launcher.Resources.Pages
{
public partial class WelcomePage1
{
protected override void OnNavigatedTo(NavigationEventArgs e)
{
if (e.ExtraData is Settings settings)
Settings = settings;
else
throw new ArgumentException("Unexpected Navigation Parameter for Settings");
InitializeComponent();
}
private Internationalization _translater => InternationalizationManager.Instance;
public List<Language> Languages => _translater.LoadAvailableLanguages();
public Settings Settings { get; set; }
public string CustomLanguage
{
get
{
return Settings.Language;
}
set
{
InternationalizationManager.Instance.ChangeLanguage(value);
if (InternationalizationManager.Instance.PromptShouldUsePinyin(value))
Settings.ShouldUsePinyin = true;
}
}
}
}

View file

@ -0,0 +1,124 @@
<ui:Page
x:Class="Flow.Launcher.Resources.Pages.WelcomePage2"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:converters="clr-namespace:Flow.Launcher.Converters"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:flowlauncher="clr-namespace:Flow.Launcher"
xmlns:local="clr-namespace:Flow.Launcher.Resources.Pages"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:ui="http://schemas.modernwpf.com/2019"
Title="WelcomePage2"
mc:Ignorable="d">
<Page.Resources>
<converters:BorderClipConverter x:Key="BorderClipConverter" />
<Style x:Key="StyleImageFadeIn" TargetType="{x:Type Image}">
<Setter Property="Opacity" Value="0" />
<Style.Triggers>
<!-- Fades-in the image when it becomes visible -->
<Trigger Property="IsVisible" Value="True">
<Trigger.EnterActions>
<BeginStoryboard>
<BeginStoryboard.Storyboard>
<Storyboard x:Name="FadeIn">
<DoubleAnimation
Storyboard.TargetProperty="Opacity"
To="1"
Duration="0:0:2" />
</Storyboard>
</BeginStoryboard.Storyboard>
</BeginStoryboard>
</Trigger.EnterActions>
</Trigger>
</Style.Triggers>
</Style>
</Page.Resources>
<ScrollViewer>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="250" />
<RowDefinition />
</Grid.RowDefinitions>
<Border Grid.Row="0" HorizontalAlignment="Stretch">
<Border.Background>
<LinearGradientBrush StartPoint="1 0" EndPoint="0 1">
<LinearGradientBrush.GradientStops>
<GradientStop Offset="0.0" Color="#6e34a4" />
<GradientStop Offset="1.0" Color="#ab58f8" />
</LinearGradientBrush.GradientStops>
</LinearGradientBrush>
</Border.Background>
<StackPanel
Grid.Row="1"
Margin="0"
Background="{Binding PreviewBackground}">
<StackPanel
Margin="0,80,0,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Orientation="Horizontal">
<Border Width="450" Style="{DynamicResource WindowBorderStyle}">
<Border Style="{DynamicResource WindowRadius}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="54" />
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Border Grid.Row="0">
<TextBox
IsReadOnly="True"
Style="{DynamicResource QueryBoxStyle}"
Text="{DynamicResource hiThere}" />
</Border>
<Canvas Style="{DynamicResource SearchIconPosition}">
<Path
Margin="0"
Data="{DynamicResource SearchIconImg}"
Stretch="Fill"
Style="{DynamicResource SearchIconStyle}" />
</Canvas>
</Grid>
</Border>
</Border>
</StackPanel>
</StackPanel>
</Border>
<StackPanel Grid.Row="1" Margin="24,20,24,20">
<StackPanel>
<TextBlock
FontSize="20"
FontWeight="SemiBold"
Text="{DynamicResource Welcome_Page2_Title}" />
<TextBlock
Margin="0,10,0,0"
FontSize="14"
Text="{DynamicResource Welcome_Page2_Text01}"
TextWrapping="WrapWithOverflow" />
<TextBlock
Margin="0,10,0,0"
FontSize="14"
Text="{DynamicResource Welcome_Page2_Text02}"
TextWrapping="WrapWithOverflow" />
<TextBlock
Margin="0,30,0,0"
FontSize="14"
FontWeight="SemiBold"
Text="{DynamicResource flowlauncherHotkey}" />
<flowlauncher:HotkeyControl
x:Name="HotkeyControl"
Width="300"
Height="35"
Margin="-206,10,0,0"
GotFocus="HotkeyControl_OnGotFocus"
LostFocus="HotkeyControl_OnLostFocus"/>
</StackPanel>
</StackPanel>
</Grid>
</ScrollViewer>
</ui:Page>

View file

@ -0,0 +1,52 @@
using Flow.Launcher.Helper;
using Flow.Launcher.Infrastructure.Hotkey;
using Flow.Launcher.Infrastructure.UserSettings;
using System;
using System.Windows;
using System.Windows.Media;
using System.Windows.Navigation;
namespace Flow.Launcher.Resources.Pages
{
public partial class WelcomePage2
{
private Settings Settings { get; set; }
private Brush tbMsgForegroundColorOriginal;
private string tbMsgTextOriginal;
protected override void OnNavigatedTo(NavigationEventArgs e)
{
if (e.ExtraData is Settings settings)
Settings = settings;
else
throw new ArgumentException("Unexpected Parameter setting.");
InitializeComponent();
tbMsgTextOriginal = HotkeyControl.tbMsg.Text;
tbMsgForegroundColorOriginal = HotkeyControl.tbMsg.Foreground;
HotkeyControl.SetHotkey(new Infrastructure.Hotkey.HotkeyModel(Settings.Hotkey), false);
}
private void HotkeyControl_OnGotFocus(object sender, RoutedEventArgs args)
{
HotKeyMapper.RemoveHotkey(Settings.Hotkey);
}
private void HotkeyControl_OnLostFocus(object sender, RoutedEventArgs args)
{
if (HotkeyControl.CurrentHotkeyAvailable)
{
HotKeyMapper.SetHotkey(HotkeyControl.CurrentHotkey, HotKeyMapper.OnToggleHotkey);
Settings.Hotkey = HotkeyControl.CurrentHotkey.ToString();
}
else
{
HotKeyMapper.SetHotkey(new HotkeyModel(Settings.Hotkey), HotKeyMapper.OnToggleHotkey);
}
HotkeyControl.tbMsg.Text = tbMsgTextOriginal;
HotkeyControl.tbMsg.Foreground = tbMsgForegroundColorOriginal;
}
}
}

View file

@ -0,0 +1,307 @@
<ui:Page
x:Class="Flow.Launcher.Resources.Pages.WelcomePage3"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Flow.Launcher.Resources.Pages"
xmlns:ui="http://schemas.modernwpf.com/2019"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Title="WelcomePage3"
mc:Ignorable="d">
<Page.Resources>
<Style x:Key="KbdLine" TargetType="Border">
<Setter Property="CornerRadius" Value="8" />
<Setter Property="Margin" Value="0,4,0,4" />
<Setter Property="Background" Value="{DynamicResource Color01B}" />
</Style>
<Style x:Key="Kbd" TargetType="Border">
<Setter Property="CornerRadius" Value="4" />
<Setter Property="Padding" Value="12,4,12,4" />
<Setter Property="Background" Value="{DynamicResource Color00B}" />
<Setter Property="BorderBrush" Value="{DynamicResource Color18B}" />
<Setter Property="BorderThickness" Value="1,1,1,2" />
</Style>
<Style x:Key="KbdText" TargetType="TextBlock">
<Setter Property="TextAlignment" Value="Center" />
<Setter Property="FontSize" Value="12" />
<Setter Property="Foreground" Value="{DynamicResource Color05B}" />
</Style>
</Page.Resources>
<ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="0" />
<RowDefinition />
</Grid.RowDefinitions>
<Border Grid.Row="0" HorizontalAlignment="Stretch">
<Border.Background>
<LinearGradientBrush StartPoint="0 0" EndPoint="1 1">
<LinearGradientBrush.GradientStops>
<GradientStop Offset="0.0" Color="#16af7b" />
<GradientStop Offset="1.0" Color="#34c191" />
</LinearGradientBrush.GradientStops>
</LinearGradientBrush>
</Border.Background>
<StackPanel HorizontalAlignment="Center" Orientation="Horizontal">
<Image
Width="300"
Height="100"
Margin="0,0,0,0"
Source="../../images/page_img02.png"
Style="{DynamicResource StyleImageFadeIn}" />
</StackPanel>
</Border>
<ScrollViewer
Grid.Row="1"
HorizontalScrollBarVisibility="Auto"
VerticalScrollBarVisibility="Auto">
<Grid>
<StackPanel Margin="24,20,24,20">
<StackPanel Margin="0,0,0,20">
<TextBlock
FontSize="20"
FontWeight="SemiBold"
Text="{DynamicResource Welcome_Page3_Title}" />
</StackPanel>
<Border Style="{DynamicResource KbdLine}">
<StackPanel Orientation="Horizontal">
<StackPanel
Width="210"
Margin="20,5,4,5"
VerticalAlignment="Center"
Orientation="Horizontal">
<Border Margin="0,0,5,0" Style="{DynamicResource Kbd}">
<TextBlock Style="{DynamicResource KbdText}">←</TextBlock>
</Border>
<TextBlock VerticalAlignment="Center">,</TextBlock>
<Border Margin="5,0,0,0" Style="{DynamicResource Kbd}">
<TextBlock Style="{DynamicResource KbdText}">→</TextBlock>
</Border>
</StackPanel>
<StackPanel VerticalAlignment="Center">
<TextBlock
VerticalAlignment="Center"
FontSize="13"
Text="{DynamicResource HotkeyUpDownDesc}" />
</StackPanel>
</StackPanel>
</Border>
<Border Style="{DynamicResource KbdLine}">
<StackPanel Orientation="Horizontal">
<StackPanel
Width="210"
Margin="20,5,4,5"
VerticalAlignment="Center"
Orientation="Horizontal">
<Border Margin="0,0,5,0" Style="{DynamicResource Kbd}">
<TextBlock Style="{DynamicResource KbdText}">↑</TextBlock>
</Border>
<TextBlock VerticalAlignment="Center">,</TextBlock>
<Border Margin="5,0,0,0" Style="{DynamicResource Kbd}">
<TextBlock Style="{DynamicResource KbdText}">↓</TextBlock>
</Border>
</StackPanel>
<StackPanel VerticalAlignment="Center">
<TextBlock
VerticalAlignment="Center"
FontSize="13"
Text="{DynamicResource HotkeyLeftRightDesc}" />
</StackPanel>
</StackPanel>
</Border>
<Border Style="{DynamicResource KbdLine}">
<StackPanel Orientation="Horizontal">
<StackPanel
Width="210"
Margin="20,5,4,5"
VerticalAlignment="Center"
Orientation="Horizontal">
<Border Margin="0,0,5,0" Style="{DynamicResource Kbd}">
<TextBlock Style="{DynamicResource KbdText}">Enter</TextBlock>
</Border>
</StackPanel>
<StackPanel VerticalAlignment="Center">
<TextBlock
VerticalAlignment="Center"
FontSize="13"
Text="{DynamicResource HotkeyRunDesc}" />
</StackPanel>
</StackPanel>
</Border>
<Border Style="{DynamicResource KbdLine}">
<StackPanel Orientation="Horizontal">
<StackPanel
Width="210"
Margin="20,5,4,5"
VerticalAlignment="Center"
Orientation="Horizontal">
<Border Margin="0,0,5,0" Style="{DynamicResource Kbd}">
<TextBlock Style="{DynamicResource KbdText}" Text="ESC" />
</Border>
</StackPanel>
<StackPanel VerticalAlignment="Center">
<TextBlock
VerticalAlignment="Center"
FontSize="13"
Text="{DynamicResource HotkeyESCDesc}" />
</StackPanel>
</StackPanel>
</Border>
<Border Style="{DynamicResource KbdLine}">
<StackPanel Orientation="Horizontal">
<StackPanel
Width="210"
Margin="20,5,4,5"
VerticalAlignment="Center"
Orientation="Horizontal">
<Border Margin="0,0,5,0" Style="{DynamicResource Kbd}">
<TextBlock Style="{DynamicResource KbdText}" Text="Shift" />
</Border>
<TextBlock VerticalAlignment="Center">+</TextBlock>
<Border Margin="5,0,5,0" Style="{DynamicResource Kbd}">
<TextBlock Style="{DynamicResource KbdText}" Text="ENTER" />
</Border>
</StackPanel>
<StackPanel VerticalAlignment="Center">
<TextBlock
VerticalAlignment="Center"
FontSize="13"
Text="{DynamicResource HotkeyShiftEnterDesc}" />
</StackPanel>
</StackPanel>
</Border>
<Border Style="{DynamicResource KbdLine}">
<StackPanel Orientation="Horizontal">
<StackPanel
Width="210"
Margin="20,5,4,5"
VerticalAlignment="Center"
Orientation="Horizontal">
<Border Margin="0,0,5,0" Style="{DynamicResource Kbd}">
<TextBlock Style="{DynamicResource KbdText}" Text="Ctrl" />
</Border>
<TextBlock VerticalAlignment="Center">+</TextBlock>
<Border Margin="5,0,5,0" Style="{DynamicResource Kbd}">
<TextBlock Style="{DynamicResource KbdText}" Text="ENTER" />
</Border>
</StackPanel>
<StackPanel VerticalAlignment="Center">
<TextBlock
VerticalAlignment="Center"
FontSize="13"
Text="{DynamicResource HotkeyCtrlEnterDesc}" />
</StackPanel>
</StackPanel>
</Border>
<Border Style="{DynamicResource KbdLine}">
<StackPanel Orientation="Horizontal">
<StackPanel
Width="210"
Margin="20,5,4,5"
VerticalAlignment="Center"
Orientation="Horizontal">
<Border Margin="0,0,5,0" Style="{DynamicResource Kbd}">
<TextBlock Style="{DynamicResource KbdText}" Text="Ctrl" />
</Border>
<TextBlock VerticalAlignment="Center">+</TextBlock>
<Border Margin="5,0,5,0" Style="{DynamicResource Kbd}">
<TextBlock Style="{DynamicResource KbdText}" Text="Shift" />
</Border>
<TextBlock VerticalAlignment="Center">+</TextBlock>
<Border Margin="5,0,5,0" Style="{DynamicResource Kbd}">
<TextBlock Style="{DynamicResource KbdText}" Text="ENTER" />
</Border>
</StackPanel>
<StackPanel VerticalAlignment="Center">
<TextBlock
VerticalAlignment="Center"
FontSize="13"
Text="{DynamicResource HotkeyCtrlShiftEnterDesc}" />
</StackPanel>
</StackPanel>
</Border>
<Border Style="{DynamicResource KbdLine}">
<StackPanel Orientation="Horizontal">
<StackPanel
Width="210"
Margin="20,5,4,5"
VerticalAlignment="Center"
Orientation="Horizontal">
<Border Margin="0,0,5,0" Style="{DynamicResource Kbd}">
<TextBlock Style="{DynamicResource KbdText}" Text="Ctrl" />
</Border>
<TextBlock VerticalAlignment="Center">+</TextBlock>
<Border Margin="5,0,5,0" Style="{DynamicResource Kbd}">
<TextBlock Style="{DynamicResource KbdText}" Text="H" />
</Border>
</StackPanel>
<StackPanel VerticalAlignment="Center">
<TextBlock
VerticalAlignment="Center"
FontSize="13"
Text="{DynamicResource HotkeyCtrlHDesc}" />
</StackPanel>
</StackPanel>
</Border>
<Border Style="{DynamicResource KbdLine}">
<StackPanel Orientation="Horizontal">
<StackPanel
Width="210"
Margin="20,5,4,5"
VerticalAlignment="Center"
Orientation="Horizontal">
<Border Margin="0,0,5,0" Style="{DynamicResource Kbd}">
<TextBlock Style="{DynamicResource KbdText}" Text="Ctrl" />
</Border>
<TextBlock VerticalAlignment="Center">+</TextBlock>
<Border Margin="5,0,5,0" Style="{DynamicResource Kbd}">
<TextBlock Style="{DynamicResource KbdText}" Text="I" />
</Border>
</StackPanel>
<StackPanel VerticalAlignment="Center">
<TextBlock
VerticalAlignment="Center"
FontSize="13"
Text="{DynamicResource HotkeyCtrlIDesc}" />
</StackPanel>
</StackPanel>
</Border>
<Border Style="{DynamicResource KbdLine}">
<StackPanel Orientation="Horizontal">
<StackPanel
Width="210"
Margin="20,5,4,5"
VerticalAlignment="Center"
Orientation="Horizontal">
<Border Margin="0,0,5,0" Style="{DynamicResource Kbd}">
<TextBlock Style="{DynamicResource KbdText}" Text="F5" />
</Border>
</StackPanel>
<StackPanel VerticalAlignment="Center">
<TextBlock
VerticalAlignment="Center"
FontSize="13"
Text="{DynamicResource HotkeyF5Desc}" />
</StackPanel>
</StackPanel>
</Border>
</StackPanel>
</Grid>
</ScrollViewer>
</Grid>
</ScrollViewer>
</ui:Page>

View file

@ -0,0 +1,20 @@
using System;
using System.Windows.Navigation;
using Flow.Launcher.Infrastructure.UserSettings;
namespace Flow.Launcher.Resources.Pages
{
public partial class WelcomePage3
{
protected override void OnNavigatedTo(NavigationEventArgs e)
{
if (e.ExtraData is Settings settings)
Settings = settings;
else if(Settings is null)
throw new ArgumentException("Unexpected Navigation Parameter for Settings");
InitializeComponent();
}
public Settings Settings { get; set; }
}
}

View file

@ -0,0 +1,136 @@
<ui:Page
x:Class="Flow.Launcher.Resources.Pages.WelcomePage4"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Flow.Launcher.Resources.Pages"
xmlns:ui="http://schemas.modernwpf.com/2019"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Title="WelcomePage4"
d:DesignHeight="450"
d:DesignWidth="800"
mc:Ignorable="d">
<Page.Resources>
<Style x:Key="StyleImageFadeIn" TargetType="{x:Type Image}">
<Style.Triggers>
<Trigger Property="IsVisible" Value="True">
<Trigger.EnterActions>
<BeginStoryboard>
<BeginStoryboard.Storyboard>
<Storyboard x:Name="Move">
<DoubleAnimation
Storyboard.TargetProperty="(Canvas.Left)"
From="0"
To="100"
Duration="0:0:20">
<DoubleAnimation.EasingFunction>
<QuadraticEase EasingMode="EaseOut" />
</DoubleAnimation.EasingFunction>
</DoubleAnimation>
</Storyboard>
</BeginStoryboard.Storyboard>
</BeginStoryboard>
</Trigger.EnterActions>
</Trigger>
</Style.Triggers>
</Style>
<Style x:Key="RecommendQuery" TargetType="Border">
<Setter Property="CornerRadius" Value="8" />
<Setter Property="Padding" Value="20,7,12,7" />
<Setter Property="Margin" Value="4,4,4,4" />
<Setter Property="Background" Value="{DynamicResource Color01B}" />
</Style>
<Style x:Key="QueryText" TargetType="TextBlock">
<Setter Property="TextAlignment" Value="Left" />
<Setter Property="TextAlignment" Value="Left" />
<Setter Property="FontSize" Value="14" />
<Setter Property="Foreground" Value="{DynamicResource Color05B}" />
</Style>
<Style x:Key="ResultText" TargetType="TextBlock">
<Setter Property="TextAlignment" Value="Left" />
<Setter Property="TextAlignment" Value="Left" />
<Setter Property="FontSize" Value="13" />
<Setter Property="Margin" Value="0,4,0,0" />
<Setter Property="Foreground" Value="{DynamicResource Color04B}" />
</Style>
</Page.Resources>
<ScrollViewer>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="250" />
<RowDefinition />
</Grid.RowDefinitions>
<Border Grid.Row="0" HorizontalAlignment="Stretch">
<Border.Background>
<LinearGradientBrush StartPoint="0 0" EndPoint="1 1">
<LinearGradientBrush.GradientStops>
<GradientStop Offset="0.0" Color="#e8457c" />
<GradientStop Offset="1.0" Color="#bc1948" />
</LinearGradientBrush.GradientStops>
</LinearGradientBrush>
</Border.Background>
<StackPanel HorizontalAlignment="Center" Orientation="Horizontal">
<Canvas
Width="600"
Height="301"
ClipToBounds="True">
<Image
Name="Logo"
Canvas.Left="0"
Width="450"
Height="280"
Margin="0,0,0,0"
Source="../../images/page_img01.png"
Style="{DynamicResource StyleImageFadeIn}" />
</Canvas>
</StackPanel>
</Border>
<StackPanel Grid.Row="1" Margin="24,20,24,20">
<StackPanel>
<TextBlock
FontSize="20"
FontWeight="SemiBold"
Text="{DynamicResource Welcome_Page4_Title}" />
<TextBlock
Margin="0,10,0,10"
FontSize="14"
Text="{DynamicResource Welcome_Page4_Text01}"
TextWrapping="WrapWithOverflow" />
<UniformGrid
Margin="0,14,0,0"
Columns="2"
Rows="2">
<Border Style="{DynamicResource RecommendQuery}">
<StackPanel>
<TextBlock Style="{DynamicResource QueryText}" Text="{DynamicResource RecommendWeather}" />
<TextBlock Style="{DynamicResource ResultText}" Text="{DynamicResource RecommendWeatherDesc}" />
</StackPanel>
</Border>
<Border Style="{DynamicResource RecommendQuery}">
<StackPanel>
<TextBlock Style="{DynamicResource QueryText}" Text="{DynamicResource RecommendShell}" />
<TextBlock Style="{DynamicResource ResultText}" Text="{DynamicResource RecommendShellDesc}" />
</StackPanel>
</Border>
<Border Style="{DynamicResource RecommendQuery}">
<StackPanel>
<TextBlock Style="{DynamicResource QueryText}" Text="{DynamicResource RecommendBluetooth}" />
<TextBlock Style="{DynamicResource ResultText}" Text="{DynamicResource RecommendBluetoothDesc}" />
</StackPanel>
</Border>
<Border Style="{DynamicResource RecommendQuery}">
<StackPanel>
<TextBlock Style="{DynamicResource QueryText}" Text="{DynamicResource RecommendAcronyms}" />
<TextBlock Style="{DynamicResource ResultText}" Text="{DynamicResource RecommendAcronymsDesc}" />
</StackPanel>
</Border>
</UniformGrid>
</StackPanel>
</StackPanel>
</Grid>
</ScrollViewer>
</ui:Page>

View file

@ -0,0 +1,20 @@
using Flow.Launcher.Infrastructure.UserSettings;
using System;
using System.Windows.Navigation;
namespace Flow.Launcher.Resources.Pages
{
public partial class WelcomePage4
{
protected override void OnNavigatedTo(NavigationEventArgs e)
{
if (e.ExtraData is Settings settings)
Settings = settings;
else
throw new ArgumentException("Unexpected Navigation Parameter for Settings");
InitializeComponent();
}
public Settings Settings { get; set; }
}
}

View file

@ -0,0 +1,122 @@
<ui:Page
x:Class="Flow.Launcher.Resources.Pages.WelcomePage5"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Flow.Launcher.Resources.Pages"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:ui="http://schemas.modernwpf.com/2019"
xmlns:userSettings="clr-namespace:Flow.Launcher.Infrastructure.UserSettings;assembly=Flow.Launcher.Infrastructure"
Title="WelcomePage5"
d:DesignHeight="450"
d:DesignWidth="800"
DataContext="{Binding RelativeSource={RelativeSource Self}}"
mc:Ignorable="d">
<Page.Resources>
<Style x:Key="StyleImageFadeIn" TargetType="{x:Type Image}">
<Setter Property="Opacity" Value="0" />
<Style.Triggers>
<!-- Fades-in the image when it becomes visible -->
<Trigger Property="IsVisible" Value="True">
<Trigger.EnterActions>
<BeginStoryboard>
<BeginStoryboard.Storyboard>
<Storyboard x:Name="FadeIn">
<DoubleAnimation
Storyboard.TargetProperty="(Canvas.Top)"
From="110"
To="75"
Duration="0:0:1">
<DoubleAnimation.EasingFunction>
<QuadraticEase EasingMode="EaseOut" />
</DoubleAnimation.EasingFunction>
</DoubleAnimation>
<DoubleAnimation
Storyboard.TargetProperty="Opacity"
From="0"
To="1"
Duration="0:0:1">
<DoubleAnimation.EasingFunction>
<QuadraticEase EasingMode="EaseOut" />
</DoubleAnimation.EasingFunction>
</DoubleAnimation>
</Storyboard>
</BeginStoryboard.Storyboard>
</BeginStoryboard>
</Trigger.EnterActions>
</Trigger>
</Style.Triggers>
</Style>
</Page.Resources>
<ScrollViewer>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="250" />
<RowDefinition />
</Grid.RowDefinitions>
<Border Grid.Row="0" HorizontalAlignment="Stretch">
<Border.Background>
<LinearGradientBrush StartPoint="0 0" EndPoint="1 1">
<LinearGradientBrush.GradientStops>
<GradientStop Offset="0.0" Color="#7b83eb" />
<GradientStop Offset="1.0" Color="#555dc0" />
</LinearGradientBrush.GradientStops>
</LinearGradientBrush>
</Border.Background>
<StackPanel HorizontalAlignment="Center" Orientation="Horizontal">
<Canvas Width="550" Height="250">
<Image
Name="Logo"
Canvas.Left="225"
Width="100"
Height="100"
Source="../../images/app.png"
Style="{DynamicResource StyleImageFadeIn}" />
</Canvas>
</StackPanel>
</Border>
<StackPanel Grid.Row="1" Margin="24,20,24,20">
<StackPanel>
<TextBlock
FontSize="20"
FontWeight="SemiBold"
Text="{DynamicResource Welcome_Page5_Title}" />
<TextBlock
Margin="0,10,0,0"
FontSize="14"
Text="{DynamicResource Welcome_Page5_Text01}"
TextWrapping="WrapWithOverflow" />
<StackPanel Margin="0,30,0,0" Orientation="Horizontal">
<CheckBox
Checked="OnAutoStartupChecked"
Content="{DynamicResource startFlowLauncherOnSystemStartup}"
IsChecked="{Binding Settings.StartFlowLauncherOnSystemStartup}"
Style="{DynamicResource DefaultCheckBoxStyle}"
Unchecked="OnAutoStartupUncheck" />
</StackPanel>
<StackPanel Margin="0,0,0,0" Orientation="Horizontal">
<CheckBox
Checked="OnHideOnStartupChecked"
Content="{DynamicResource hideOnStartup}"
IsChecked="{Binding Settings.HideOnStartup}"
Style="{DynamicResource DefaultCheckBoxStyle}"
Unchecked="OnHideOnStartupUnchecked" />
</StackPanel>
<Button
Width="150"
Height="40"
Margin="0,60,0,0"
HorizontalAlignment="Right"
Click="BtnCancel_OnClick"
Content="{DynamicResource done}"
Style="{DynamicResource AccentButtonStyle}" />
</StackPanel>
</StackPanel>
</Grid>
</ScrollViewer>
</ui:Page>

View file

@ -0,0 +1,63 @@
using System;
using System.Windows;
using System.Windows.Navigation;
using Flow.Launcher.Infrastructure.UserSettings;
using Microsoft.Win32;
using Flow.Launcher.Infrastructure;
namespace Flow.Launcher.Resources.Pages
{
public partial class WelcomePage5
{
private const string StartupPath = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run";
public Settings Settings { get; set; }
public bool HideOnStartup { get; set; }
protected override void OnNavigatedTo(NavigationEventArgs e)
{
if (e.ExtraData is Settings settings)
Settings = settings;
else
throw new ArgumentException("Unexpected Navigation Parameter for Settings");
InitializeComponent();
}
private void OnAutoStartupChecked(object sender, RoutedEventArgs e)
{
SetStartup();
}
private void OnAutoStartupUncheck(object sender, RoutedEventArgs e)
{
RemoveStartup();
}
private void RemoveStartup()
{
using var key = Registry.CurrentUser.OpenSubKey(StartupPath, true);
key?.DeleteValue(Constant.FlowLauncher, false);
Settings.StartFlowLauncherOnSystemStartup = false;
}
private void SetStartup()
{
using var key = Registry.CurrentUser.OpenSubKey(StartupPath, true);
key?.SetValue(Constant.FlowLauncher, Constant.ExecutablePath);
Settings.StartFlowLauncherOnSystemStartup = true;
}
private void OnHideOnStartupChecked(object sender, RoutedEventArgs e)
{
Settings.HideOnStartup = true;
}
private void OnHideOnStartupUnchecked(object sender, RoutedEventArgs e)
{
Settings.HideOnStartup = false;
}
private void BtnCancel_OnClick(object sender, RoutedEventArgs e)
{
var window = Window.GetWindow(this);
window.Close();
}
}
}

View file

@ -22,7 +22,7 @@
Icon="Images\app.ico"
Loaded="OnLoaded"
MouseDown="window_MouseDown"
ResizeMode="CanResizeWithGrip"
ResizeMode="CanResize"
StateChanged="Window_StateChanged"
WindowStartupLocation="CenterScreen"
mc:Ignorable="d">
@ -1919,21 +1919,21 @@
<Border Margin="0,12,0,12" Style="{DynamicResource SettingGroupBox}">
<ItemsControl Style="{StaticResource SettingGrid}">
<StackPanel Style="{StaticResource TextPanel}">
<TextBlock Style="{DynamicResource SettingTitleLabel}" Text="{DynamicResource DarkMode}" />
<TextBlock Style="{DynamicResource SettingTitleLabel}" Text="{DynamicResource ColorScheme}" />
</StackPanel>
<ComboBox
x:Name="DarkModeComboBox"
x:Name="ColorSchemeComboBox"
Grid.Column="2"
Width="180"
Margin="0,0,18,0"
DisplayMemberPath="Display"
FontSize="14"
ItemsSource="{Binding DarkModes}"
SelectedValue="{Binding Settings.DarkMode}"
ItemsSource="{Binding ColorSchemes}"
SelectedValue="{Binding Settings.ColorScheme}"
SelectedValuePath="Value"
SelectionChanged="DarkModeSelectedIndexChanged" />
SelectionChanged="ColorSchemeSelectedIndexChanged" />
<TextBlock Style="{StaticResource Glyph}">
&#xe708;
&#xe793;
</TextBlock>
</ItemsControl>
</Border>
@ -1991,8 +1991,8 @@
<RowDefinition Height="80" />
<RowDefinition Height="146" />
<RowDefinition Height="50" />
<RowDefinition Height="250" />
<RowDefinition Height="70" />
<RowDefinition Height="*" />
<RowDefinition Height="50" />
</Grid.RowDefinitions>
<TextBlock
Grid.Row="0"
@ -2018,8 +2018,9 @@
Margin="0,0,0,0"
HorizontalAlignment="Right"
HorizontalContentAlignment="Right"
HotkeyChanged="OnHotkeyChanged"
Loaded="OnHotkeyControlLoaded" />
GotFocus="OnHotkeyControlFocused"
Loaded="OnHotkeyControlLoaded"
LostFocus="OnHotkeyControlFocusLost" />
<TextBlock Style="{StaticResource Glyph}">
&#xeda7;
@ -2482,6 +2483,10 @@
Margin="0,0,-20,0"
HorizontalAlignment="Right"
Orientation="Horizontal">
<Button
Margin="0,0,12,0"
Click="OpenWelcomeWindow"
Content="{DynamicResource welcomewindow}" />
<Button
Margin="0,0,12,0"
Click="OpenSettingFolder"

View file

@ -3,6 +3,7 @@ using Flow.Launcher.Core.Plugin;
using Flow.Launcher.Core.Resource;
using Flow.Launcher.Helper;
using Flow.Launcher.Infrastructure;
using Flow.Launcher.Infrastructure.Hotkey;
using Flow.Launcher.Infrastructure.UserSettings;
using Flow.Launcher.Plugin;
using Flow.Launcher.Plugin.SharedCommands;
@ -115,8 +116,8 @@ namespace Flow.Launcher
private void OnSelectFileManagerClick(object sender, RoutedEventArgs e)
{
SelectFileManagerWindow fileManagerChangeWindow = new SelectFileManagerWindow(settings);
fileManagerChangeWindow.ShowDialog();
SelectFileManagerWindow fileManagerChangeWindow = new SelectFileManagerWindow(settings);
fileManagerChangeWindow.ShowDialog();
}
#endregion
@ -128,15 +129,23 @@ namespace Flow.Launcher
HotkeyControl.SetHotkey(viewModel.Settings.Hotkey, false);
}
void OnHotkeyChanged(object sender, EventArgs e)
private void OnHotkeyControlFocused(object sender, RoutedEventArgs e)
{
HotKeyMapper.RemoveHotkey(settings.Hotkey);
}
private void OnHotkeyControlFocusLost(object sender, RoutedEventArgs e)
{
if (HotkeyControl.CurrentHotkeyAvailable)
{
HotKeyMapper.SetHotkey(HotkeyControl.CurrentHotkey, HotKeyMapper.OnToggleHotkey);
HotKeyMapper.RemoveHotkey(settings.Hotkey);
settings.Hotkey = HotkeyControl.CurrentHotkey.ToString();
}
else
{
HotKeyMapper.SetHotkey(new HotkeyModel(settings.Hotkey), HotKeyMapper.OnToggleHotkey);
}
}
private void OnDeleteCustomHotkeyClick(object sender, RoutedEventArgs e)
@ -275,6 +284,11 @@ namespace Flow.Launcher
PluginManager.API.OpenDirectory(Path.Combine(DataLocation.DataDirectory(), Constant.Settings));
}
private void OpenWelcomeWindow(object sender, RoutedEventArgs e)
{
var WelcomeWindow = new WelcomeWindow(settings);
WelcomeWindow.Show();
}
private void OpenLogFolder(object sender, RoutedEventArgs e)
{
PluginManager.API.OpenDirectory(Path.Combine(DataLocation.DataDirectory(), Constant.Logs, Constant.Version));
@ -306,13 +320,14 @@ namespace Flow.Launcher
textBox.MoveFocus(tRequest);
}
private void DarkModeSelectedIndexChanged(object sender, EventArgs e) => ThemeManager.Current.ApplicationTheme = settings.DarkMode switch
{
Constant.Light => ApplicationTheme.Light,
Constant.Dark => ApplicationTheme.Dark,
Constant.System => null,
_ => ThemeManager.Current.ApplicationTheme
};
private void ColorSchemeSelectedIndexChanged(object sender, EventArgs e)
=> ThemeManager.Current.ApplicationTheme = settings.ColorScheme switch
{
Constant.Light => ApplicationTheme.Light,
Constant.Dark => ApplicationTheme.Dark,
Constant.System => null,
_ => ThemeManager.Current.ApplicationTheme
};
/* Custom TitleBar */

View file

@ -228,6 +228,32 @@ namespace Flow.Launcher.ViewModel
}
});
AutocompleteQueryCommand = new RelayCommand(_ =>
{
var result = SelectedResults.SelectedItem?.Result;
if (result != null) // SelectedItem returns null if selection is empty.
{
var autoCompleteText = result.Title;
if (!string.IsNullOrEmpty(result.AutoCompleteText))
{
autoCompleteText = result.AutoCompleteText;
}
else if (!string.IsNullOrEmpty(SelectedResults.SelectedItem?.QuerySuggestionText))
{
autoCompleteText = SelectedResults.SelectedItem.QuerySuggestionText;
}
var SpecialKeyState = GlobalHotkey.Instance.CheckModifiers();
if (SpecialKeyState.ShiftPressed)
{
autoCompleteText = result.SubTitle;
}
ChangeQueryText(autoCompleteText);
}
});
LoadContextMenuCommand = new RelayCommand(_ =>
{
if (SelectedIsFromQueryResults())
@ -287,7 +313,6 @@ namespace Flow.Launcher.ViewModel
public bool GameModeStatus { get; set; }
private string _queryText;
public string QueryText
{
get => _queryText;
@ -383,6 +408,7 @@ namespace Flow.Launcher.ViewModel
public ICommand OpenSettingCommand { get; set; }
public ICommand ReloadPluginDataCommand { get; set; }
public ICommand ClearQueryCommand { get; private set; }
public ICommand AutocompleteQueryCommand { get; set; }
public string OpenResultCommandModifiers { get; private set; }

View file

@ -142,6 +142,8 @@ namespace Flow.Launcher.ViewModel
public Result Result { get; }
public string QuerySuggestionText { get; set; }
public override bool Equals(object obj)
{
return obj is ResultViewModel r && Result.Equals(r.Result);

View file

@ -315,22 +315,23 @@ namespace Flow.Launcher.ViewModel
}
}
public class DarkMode
public class ColorScheme
{
public string Display { get; set; }
public Infrastructure.UserSettings.DarkMode Value { get; set; }
public ColorSchemes Value { get; set; }
}
public List<DarkMode> DarkModes
public List<ColorScheme> ColorSchemes
{
get
{
List<DarkMode> modes = new List<DarkMode>();
var enums = (Infrastructure.UserSettings.DarkMode[])Enum.GetValues(typeof(Infrastructure.UserSettings.DarkMode));
List<ColorScheme> modes = new List<ColorScheme>();
var enums = (ColorSchemes[])Enum.GetValues(typeof(ColorSchemes));
foreach (var e in enums)
{
var key = $"DarkMode{e}";
var key = $"ColorScheme{e}";
var display = _translater.GetTranslation(key);
var m = new DarkMode { Display = display, Value = e, };
var m = new ColorScheme { Display = display, Value = e, };
modes.Add(m);
}
return modes;

View file

@ -0,0 +1,157 @@
<Window
x:Class="Flow.Launcher.WelcomeWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Flow.Launcher"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:ui="http://schemas.modernwpf.com/2019"
Name="FlowWelcomeWindow"
Title="Welcome to Flow Launcher"
Activated="OnActivated"
Width="550"
Height="650"
MouseDown="window_MouseDown"
Background="{DynamicResource Color00B}"
Foreground="{DynamicResource PopupTextColor}"
WindowStartupLocation="CenterScreen"
mc:Ignorable="d">
<!--#region TitleBar-->
<WindowChrome.WindowChrome>
<WindowChrome CaptionHeight="32" ResizeBorderThickness="{x:Static SystemParameters.WindowResizeBorderThickness}" />
</WindowChrome.WindowChrome>
<Grid>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition Height="80" />
</Grid.RowDefinitions>
<StackPanel Grid.Row="0">
<StackPanel>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Image
Grid.Column="0"
Width="16"
Height="16"
Margin="10,4,4,4"
RenderOptions.BitmapScalingMode="HighQuality"
Source="/Images/app.png" />
<TextBlock
Grid.Column="1"
Margin="4,0,0,0"
VerticalAlignment="Center"
FontSize="12"
Foreground="{DynamicResource Color05B}"
Text="Welcome to Flow Launcher" />
<Button
Grid.Column="4"
Click="BtnCancel_OnClick"
Style="{StaticResource TitleBarCloseButtonStyle}">
<Path
Width="46"
Height="32"
Data="M 18,11 27,20 M 18,20 27,11"
Stroke="{Binding Path=Foreground, RelativeSource={RelativeSource AncestorType={x:Type Button}}}"
StrokeThickness="1">
<Path.Style>
<Style TargetType="Path">
<Style.Triggers>
<DataTrigger Binding="{Binding Path=IsActive, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}}" Value="False">
<Setter Property="Opacity" Value="0.5" />
</DataTrigger>
</Style.Triggers>
</Style>
</Path.Style>
</Path>
</Button>
</Grid>
</StackPanel>
<!--#endregion-->
<StackPanel Margin="0">
<ui:Frame
x:Name="ContentFrame"
HorizontalAlignment="Stretch"
ScrollViewer.CanContentScroll="True"
ScrollViewer.HorizontalScrollBarVisibility="Visible"
ScrollViewer.VerticalScrollBarVisibility="Visible">
<ui:Frame.ContentTransitions>
<ui:TransitionCollection>
<ui:NavigationThemeTransition />
</ui:TransitionCollection>
</ui:Frame.ContentTransitions>
</ui:Frame>
</StackPanel>
</StackPanel>
<Border
Grid.Row="1"
Background="{DynamicResource Color00B}"
BorderBrush="{DynamicResource PopupButtonAreaBorderColor}"
BorderThickness="0,1,0,0">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="130" />
<ColumnDefinition />
<ColumnDefinition Width="130" />
</Grid.ColumnDefinitions>
<StackPanel
Grid.Column="0"
Grid.ColumnSpan="3"
VerticalAlignment="Center">
<TextBlock
Name="PageNavigation"
Margin="0,2,0,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="14"
Text="{Binding PageDisplay, Mode=OneWay, UpdateSourceTrigger=PropertyChanged, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Window}}"
TextAlignment="Center" />
</StackPanel>
<Button
x:Name="SkipButton"
Grid.Column="0"
Width="100"
Height="40"
Margin="20,5,0,5"
Click="BtnCancel_OnClick"
Content="{DynamicResource Skip}"
DockPanel.Dock="Right"
FontSize="14" />
<DockPanel
Grid.Column="2"
Margin="0,0,20,0"
VerticalAlignment="Stretch">
<Button
x:Name="NextButton"
Width="40"
Height="40"
Margin="8,5,0,5"
Click="ForwardButton_Click"
Content="&#xe76c;"
DockPanel.Dock="Right"
FontFamily="/Resources/#Segoe Fluent Icons"
FontSize="18" />
<Button
x:Name="BackButton"
Width="40"
Height="40"
Click="BackwardButton_Click"
Content="&#xe76b;"
DockPanel.Dock="Right"
FontFamily="/Resources/#Segoe Fluent Icons"
FontSize="18" />
<StackPanel />
</DockPanel>
</Grid>
</Border>
</Grid>
</Window>

View file

@ -0,0 +1,110 @@
using System;
using System.Windows;
using System.Windows.Input;
using System.Windows.Controls;
using Flow.Launcher.Infrastructure.UserSettings;
using Flow.Launcher.Resources.Pages;
using ModernWpf.Media.Animation;
namespace Flow.Launcher
{
public partial class WelcomeWindow : Window
{
private readonly Settings settings;
public WelcomeWindow(Settings settings)
{
InitializeComponent();
BackButton.IsEnabled = false;
this.settings = settings;
ContentFrame.Navigate(PageTypeSelector(1), settings);
}
private NavigationTransitionInfo _transitionInfo = new SlideNavigationTransitionInfo()
{
Effect = SlideNavigationTransitionEffect.FromRight
};
private NavigationTransitionInfo _backTransitionInfo = new SlideNavigationTransitionInfo()
{
Effect = SlideNavigationTransitionEffect.FromLeft
};
private int pageNum = 1;
private int MaxPage = 5;
public string PageDisplay => $"{pageNum}/5";
private void UpdateView()
{
PageNavigation.Text = PageDisplay;
if (pageNum == 1)
{
BackButton.IsEnabled = false;
NextButton.IsEnabled = true;
}
else if (pageNum == MaxPage)
{
BackButton.IsEnabled = true;
NextButton.IsEnabled = false;
}
else
{
BackButton.IsEnabled = true;
NextButton.IsEnabled = true;
}
}
private void ForwardButton_Click(object sender, RoutedEventArgs e)
{
pageNum++;
UpdateView();
ContentFrame.Navigate(PageTypeSelector(pageNum), settings, _transitionInfo);
}
private void BackwardButton_Click(object sender, RoutedEventArgs e)
{
if (pageNum > 1)
{
pageNum--;
UpdateView();
ContentFrame.Navigate(PageTypeSelector(pageNum), settings, _backTransitionInfo);
}
else
{
BackButton.IsEnabled = false;
}
}
private void BtnCancel_OnClick(object sender, RoutedEventArgs e)
{
Close();
}
private static Type PageTypeSelector(int pageNumber)
{
return pageNumber switch
{
1 => typeof(WelcomePage1),
2 => typeof(WelcomePage2),
3 => typeof(WelcomePage3),
4 => typeof(WelcomePage4),
5 => typeof(WelcomePage5),
_ => throw new ArgumentOutOfRangeException(nameof(pageNumber), pageNumber, "Unexpected Page Number")
};
}
private void window_MouseDown(object sender, MouseButtonEventArgs e) /* for close hotkey popup */
{
if (Keyboard.FocusedElement is not TextBox textBox)
{
return;
}
var tRequest = new TraversalRequest(FocusNavigationDirection.Next);
textBox.MoveFocus(tRequest);
}
private void OnActivated(object sender, EventArgs e)
{
Keyboard.ClearFocus();
}
}
}

View file

@ -1,25 +0,0 @@
using System.Diagnostics;
using System.Drawing;
namespace Flow.Launcher.Plugin.ControlPanel
{
//from:https://raw.githubusercontent.com/CoenraadS/Windows-Control-Panel-Items
public class ControlPanelItem
{
public string LocalizedString { get; private set; }
public string InfoTip { get; private set; }
public string GUID { get; private set; }
public ProcessStartInfo ExecutablePath { get; private set; }
public Icon Icon { get; private set; }
public int Score { get; set; }
public ControlPanelItem(string newLocalizedString, string newInfoTip, string newGUID, ProcessStartInfo newExecutablePath, Icon newIcon)
{
LocalizedString = newLocalizedString;
InfoTip = newInfoTip;
ExecutablePath = newExecutablePath;
Icon = newIcon;
GUID = newGUID;
}
}
}

View file

@ -1,339 +0,0 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.Runtime.InteropServices;
using System.Text;
using Microsoft.Win32;
namespace Flow.Launcher.Plugin.ControlPanel
{
//from:https://raw.githubusercontent.com/CoenraadS/Windows-Control-Panel-Items
public static class ControlPanelList
{
private const uint GROUP_ICON = 14;
private const uint LOAD_LIBRARY_AS_DATAFILE = 0x00000002;
private const string CONTROL = @"%SystemRoot%\System32\control.exe";
private delegate bool EnumResNameDelegate(
IntPtr hModule,
IntPtr lpszType,
IntPtr lpszName,
IntPtr lParam);
[DllImport("kernel32.dll", EntryPoint = "EnumResourceNamesW", CharSet = CharSet.Unicode, SetLastError = true)]
static extern bool EnumResourceNamesWithID(IntPtr hModule, uint lpszType, EnumResNameDelegate lpEnumFunc, IntPtr lParam);
[DllImport("kernel32.dll", SetLastError = true)]
static extern IntPtr LoadLibraryEx(string lpFileName, IntPtr hFile, uint dwFlags);
[DllImport("kernel32.dll", SetLastError = true)]
static extern bool FreeLibrary(IntPtr hModule);
[DllImport("user32.dll", CharSet = CharSet.Auto)]
static extern int LoadString(IntPtr hInstance, uint uID, StringBuilder lpBuffer, int nBufferMax);
[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]
static extern IntPtr LoadImage(IntPtr hinst, IntPtr lpszName, uint uType,
int cxDesired, int cyDesired, uint fuLoad);
[DllImport("user32.dll", CharSet = CharSet.Auto)]
static extern bool DestroyIcon(IntPtr handle);
[DllImport("kernel32.dll")]
static extern IntPtr FindResource(IntPtr hModule, IntPtr lpName, IntPtr lpType);
static IntPtr defaultIconPtr;
static RegistryKey nameSpace = Registry.LocalMachine.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\ControlPanel\\NameSpace");
static RegistryKey clsid = Registry.ClassesRoot.OpenSubKey("CLSID");
public static List<ControlPanelItem> Create(uint iconSize)
{
int size = (int)iconSize;
RegistryKey currentKey;
ProcessStartInfo executablePath;
List<ControlPanelItem> controlPanelItems = new List<ControlPanelItem>();
string localizedString;
string infoTip;
Icon myIcon;
foreach (string key in nameSpace.GetSubKeyNames())
{
currentKey = clsid.OpenSubKey(key);
if (currentKey != null)
{
executablePath = getExecutablePath(currentKey);
if (!(executablePath == null)) //Cannot have item without executable path
{
localizedString = getLocalizedString(currentKey);
if (!string.IsNullOrEmpty(localizedString))//Cannot have item without Title
{
infoTip = getInfoTip(currentKey);
myIcon = getIcon(currentKey, size);
controlPanelItems.Add(new ControlPanelItem(localizedString, infoTip, key, executablePath, myIcon));
}
}
}
}
return controlPanelItems;
}
private static ProcessStartInfo getExecutablePath(RegistryKey currentKey)
{
ProcessStartInfo executablePath = new ProcessStartInfo();
string applicationName;
if (currentKey.GetValue("System.ApplicationName") != null)
{
//CPL Files (usually native MS items)
applicationName = currentKey.GetValue("System.ApplicationName").ToString();
executablePath.FileName = Environment.ExpandEnvironmentVariables(CONTROL);
executablePath.Arguments = "-name " + applicationName;
}
else if (currentKey.OpenSubKey("Shell\\Open\\Command") != null && currentKey.OpenSubKey("Shell\\Open\\Command").GetValue(null) != null)
{
//Other files (usually third party items)
string input = "\"" + Environment.ExpandEnvironmentVariables(currentKey.OpenSubKey("Shell\\Open\\Command").GetValue(null).ToString()) + "\"";
executablePath.FileName = "cmd.exe";
executablePath.Arguments = "/C " + input;
executablePath.WindowStyle = ProcessWindowStyle.Hidden;
}
else
{
return null;
}
return executablePath;
}
private static string getLocalizedString(RegistryKey currentKey)
{
IntPtr dataFilePointer;
string[] localizedStringRaw;
uint stringTableIndex;
StringBuilder resource;
string localizedString;
if (currentKey.GetValue("LocalizedString") != null)
{
localizedStringRaw = currentKey.GetValue("LocalizedString").ToString().Split(new[] { ",-" }, StringSplitOptions.None);
if (localizedStringRaw.Length > 1)
{
if (localizedStringRaw[0][0] == '@')
{
localizedStringRaw[0] = localizedStringRaw[0].Substring(1);
}
localizedStringRaw[0] = Environment.ExpandEnvironmentVariables(localizedStringRaw[0]);
dataFilePointer = LoadLibraryEx(localizedStringRaw[0], IntPtr.Zero, LOAD_LIBRARY_AS_DATAFILE); //Load file with strings
stringTableIndex = sanitizeUint(localizedStringRaw[1]);
resource = new StringBuilder(255);
LoadString(dataFilePointer, stringTableIndex, resource, resource.Capacity + 1); //Extract needed string
FreeLibrary(dataFilePointer);
localizedString = resource.ToString();
//Some apps don't return a string, although they do have a stringIndex. Use Default value.
if (String.IsNullOrEmpty(localizedString))
{
if (currentKey.GetValue(null) != null)
{
localizedString = currentKey.GetValue(null).ToString();
}
else
{
return null; //Cannot have item without title.
}
}
}
else
{
localizedString = localizedStringRaw[0];
}
}
else if (currentKey.GetValue(null) != null)
{
localizedString = currentKey.GetValue(null).ToString();
}
else
{
return null; //Cannot have item without title.
}
return localizedString;
}
private static string getInfoTip(RegistryKey currentKey)
{
IntPtr dataFilePointer;
string[] infoTipRaw;
uint stringTableIndex;
StringBuilder resource;
string infoTip = "";
if (currentKey.GetValue("InfoTip") != null)
{
infoTipRaw = currentKey.GetValue("InfoTip").ToString().Split(new[] { ",-" }, StringSplitOptions.None);
if (infoTipRaw.Length == 2)
{
if (infoTipRaw[0][0] == '@')
{
infoTipRaw[0] = infoTipRaw[0].Substring(1);
}
infoTipRaw[0] = Environment.ExpandEnvironmentVariables(infoTipRaw[0]);
dataFilePointer = LoadLibraryEx(infoTipRaw[0], IntPtr.Zero, LOAD_LIBRARY_AS_DATAFILE); //Load file with strings
stringTableIndex = sanitizeUint(infoTipRaw[1]);
resource = new StringBuilder(255);
LoadString(dataFilePointer, stringTableIndex, resource, resource.Capacity + 1); //Extract needed string
FreeLibrary(dataFilePointer);
infoTip = resource.ToString();
}
else
{
infoTip = currentKey.GetValue("InfoTip").ToString();
}
}
else
{
infoTip = "";
}
return infoTip;
}
private static Icon getIcon(RegistryKey currentKey, int iconSize)
{
IntPtr iconPtr = IntPtr.Zero;
List<string> iconString;
IntPtr dataFilePointer;
IntPtr iconIndex;
Icon myIcon = null;
if (currentKey.OpenSubKey("DefaultIcon") != null)
{
if (currentKey.OpenSubKey("DefaultIcon").GetValue(null) != null)
{
iconString = new List<string>(currentKey.OpenSubKey("DefaultIcon").GetValue(null).ToString().Split(new[] { ',' }, 2));
if (string.IsNullOrEmpty(iconString[0]))
{
// fallback to default icon
return null;
}
if (iconString[0][0] == '@')
{
iconString[0] = iconString[0].Substring(1);
}
dataFilePointer = LoadLibraryEx(iconString[0], IntPtr.Zero, LOAD_LIBRARY_AS_DATAFILE);
if (iconString.Count == 2)
{
iconIndex = (IntPtr)sanitizeUint(iconString[1]);
iconPtr = LoadImage(dataFilePointer, iconIndex, 1, iconSize, iconSize, 0);
}
if (iconPtr == IntPtr.Zero)
{
defaultIconPtr = IntPtr.Zero;
EnumResourceNamesWithID(dataFilePointer, GROUP_ICON, EnumRes, IntPtr.Zero); //Iterate through resources.
iconPtr = LoadImage(dataFilePointer, defaultIconPtr, 1, iconSize, iconSize, 0);
}
FreeLibrary(dataFilePointer);
if (iconPtr != IntPtr.Zero)
{
try
{
myIcon = Icon.FromHandle(iconPtr);
myIcon = (Icon)myIcon.Clone(); //Remove pointer dependancy.
}
catch
{
//Silently fail for now.
}
}
}
}
if (iconPtr != IntPtr.Zero)
{
DestroyIcon(iconPtr);
}
return myIcon;
}
private static uint sanitizeUint(string args) //Remove all chars before and after first set of digits.
{
int x = 0;
while (x < args.Length && !Char.IsDigit(args[x]))
{
args = args.Substring(1);
}
x = 0;
while (x < args.Length && Char.IsDigit(args[x]))
{
x++;
}
if (x < args.Length)
{
args = args.Remove(x);
}
/*If the logic is correct, this should never through an exception.
* If there is an exception, then need to analyze what the input is.
* Returning the wrong number will cause more errors */
return Convert.ToUInt32(args);
}
private static bool IS_INTRESOURCE(IntPtr value)
{
if (((uint)value) > ushort.MaxValue)
return false;
return true;
}
private static uint GET_RESOURCE_ID(IntPtr value)
{
if (IS_INTRESOURCE(value))
return (uint)value;
throw new NotSupportedException("value is not an ID!");
}
private static string GET_RESOURCE_NAME(IntPtr value)
{
if (IS_INTRESOURCE(value))
return value.ToString();
return Marshal.PtrToStringUni(value);
}
private static bool EnumRes(IntPtr hModule, IntPtr lpszType, IntPtr lpszName, IntPtr lParam)
{
defaultIconPtr = lpszName;
return false;
}
}
}

View file

@ -1,58 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Library</OutputType>
<TargetFramework>net5.0-windows</TargetFramework>
<ProjectGuid>{1EE20B48-82FB-48A2-8086-675D6DDAB4F0}</ProjectGuid>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Flow.Launcher.Plugin.ControlPanel</RootNamespace>
<AssemblyName>Flow.Launcher.Plugin.ControlPanel</AssemblyName>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>portable</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\..\Output\Debug\Plugins\Flow.Launcher.Plugin.ControlPanel\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\..\Output\Release\Plugins\Flow.Launcher.Plugin.ControlPanel\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<None Include="plugin.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Flow.Launcher.Infrastructure\Flow.Launcher.Infrastructure.csproj" />
<ProjectReference Include="..\..\Flow.Launcher.Plugin\Flow.Launcher.Plugin.csproj" />
</ItemGroup>
<ItemGroup>
<Content Include="Images\*.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Languages\*.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
</Project>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

View file

@ -1,8 +0,0 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:system="clr-namespace:System;assembly=mscorlib">
<system:String x:Key="flowlauncher_plugin_controlpanel_plugin_name">Systemsteuerung</system:String>
<system:String x:Key="flowlauncher_plugin_controlpanel_plugin_description">Suche in der Systemsteuerung</system:String>
</ResourceDictionary>

View file

@ -1,8 +0,0 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:system="clr-namespace:System;assembly=mscorlib">
<system:String x:Key="flowlauncher_plugin_controlpanel_plugin_name">Control Panel</system:String>
<system:String x:Key="flowlauncher_plugin_controlpanel_plugin_description">Search within the Control Panel</system:String>
</ResourceDictionary>

View file

@ -1,8 +0,0 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:system="clr-namespace:System;assembly=mscorlib">
<system:String x:Key="flowlauncher_plugin_controlpanel_plugin_name">Panel sterowania</system:String>
<system:String x:Key="flowlauncher_plugin_controlpanel_plugin_description">Szybie wyszukiwanie ustawień w panelu sterowania</system:String>
</ResourceDictionary>

View file

@ -1,8 +0,0 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:system="clr-namespace:System;assembly=mscorlib">
<system:String x:Key="flowlauncher_plugin_controlpanel_plugin_name">Ovládací panel</system:String>
<system:String x:Key="flowlauncher_plugin_controlpanel_plugin_description">Vyhľadáva položky Ovládacieho panela</system:String>
</ResourceDictionary>

View file

@ -1,8 +0,0 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:system="clr-namespace:System;assembly=mscorlib">
<system:String x:Key="flowlauncher_plugin_controlpanel_plugin_name">Denetim Masası</system:String>
<system:String x:Key="flowlauncher_plugin_controlpanel_plugin_description">Denetim Masası'nda arama yapın.</system:String>
</ResourceDictionary>

View file

@ -1,8 +0,0 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:system="clr-namespace:System;assembly=mscorlib">
<system:String x:Key="flowlauncher_plugin_controlpanel_plugin_name">控制面板</system:String>
<system:String x:Key="flowlauncher_plugin_controlpanel_plugin_description">搜索控制面板</system:String>
</ResourceDictionary>

View file

@ -1,8 +0,0 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:system="clr-namespace:System;assembly=mscorlib">
<system:String x:Key="flowlauncher_plugin_controlpanel_plugin_name">控制台</system:String>
<system:String x:Key="flowlauncher_plugin_controlpanel_plugin_description">搜尋控制台</system:String>
</ResourceDictionary>

View file

@ -1,99 +0,0 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Flow.Launcher.Infrastructure;
namespace Flow.Launcher.Plugin.ControlPanel
{
public class Main : IPlugin, IPluginI18n
{
private PluginInitContext context;
private List<ControlPanelItem> controlPanelItems = new List<ControlPanelItem>();
private string iconFolder;
private string fileType;
public void Init(PluginInitContext context)
{
this.context = context;
controlPanelItems = ControlPanelList.Create(48);
iconFolder = Path.Combine(context.CurrentPluginMetadata.PluginDirectory, @"Images\ControlPanelIcons\");
fileType = ".bmp";
if (!Directory.Exists(iconFolder))
{
Directory.CreateDirectory(iconFolder);
}
foreach (ControlPanelItem item in controlPanelItems)
{
if (!File.Exists(iconFolder + item.GUID + fileType) && item.Icon != null)
{
item.Icon.ToBitmap().Save(iconFolder + item.GUID + fileType);
}
}
}
public List<Result> Query(Query query)
{
List<Result> results = new List<Result>();
foreach (var item in controlPanelItems)
{
var titleMatch = StringMatcher.FuzzySearch(query.Search, item.LocalizedString);
var subTitleMatch = StringMatcher.FuzzySearch(query.Search, item.InfoTip);
item.Score = Math.Max(titleMatch.Score, subTitleMatch.Score);
if (item.Score > 0)
{
var result = new Result
{
Title = item.LocalizedString,
SubTitle = item.InfoTip,
Score = item.Score,
IcoPath = Path.Combine(context.CurrentPluginMetadata.PluginDirectory,
@"Images\\ControlPanelIcons\\" + item.GUID + fileType),
Action = e =>
{
try
{
Process.Start(item.ExecutablePath);
}
catch (Exception)
{
//Silently Fail for now.. todo
}
return true;
}
};
if (item.Score == titleMatch.Score)
{
result.TitleHighlightData = titleMatch.MatchData;
}
else
{
result.SubTitleHighlightData = subTitleMatch.MatchData;
}
results.Add(result);
}
}
List<Result> panelItems = results.OrderByDescending(o => o.Score).Take(5).ToList();
return panelItems;
}
public string GetTranslatedPluginTitle()
{
return context.API.GetTranslation("flowlauncher_plugin_controlpanel_plugin_name");
}
public string GetTranslatedPluginDescription()
{
return context.API.GetTranslation("flowlauncher_plugin_controlpanel_plugin_description");
}
}
}

View file

@ -1,12 +0,0 @@
{
"ID": "209621585B9B4D81813913C507C058C6",
"ActionKeyword": "*",
"Name": "Control Panel",
"Description": "Search within the Control Panel.",
"Author": "CoenraadS",
"Version": "1.1.2",
"Language": "csharp",
"Website": "https://github.com/Flow-Launcher/Flow.Launcher",
"ExecuteFileName": "Flow.Launcher.Plugin.ControlPanel.dll",
"IcoPath": "Images\\ControlPanel.png"
}

View file

@ -1,22 +1,132 @@
<Window x:Class="Flow.Launcher.Plugin.Program.AddProgramSource"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d"
Width="400"
Height="130"
WindowStartupLocation="CenterScreen">
<Window
x:Class="Flow.Launcher.Plugin.Program.AddProgramSource"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Title="{DynamicResource flowlauncher_plugin_program_directory}"
Width="400"
Background="{DynamicResource PopuBGColor}"
Foreground="{DynamicResource PopupTextColor}"
SizeToContent="Height"
WindowStartupLocation="CenterScreen"
mc:Ignorable="d">
<WindowChrome.WindowChrome>
<WindowChrome CaptionHeight="32" ResizeBorderThickness="{x:Static SystemParameters.WindowResizeBorderThickness}" />
</WindowChrome.WindowChrome>
<Grid>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition Height="80" />
</Grid.RowDefinitions>
<StackPanel Grid.Row="0">
<StackPanel>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Button
Grid.Column="4"
Click="BtnCancel_OnClick"
Style="{StaticResource TitleBarCloseButtonStyle}">
<Path
Width="46"
Height="32"
Data="M 18,11 27,20 M 18,20 27,11"
Stroke="{Binding Path=Foreground, RelativeSource={RelativeSource AncestorType={x:Type Button}}}"
StrokeThickness="1">
<Path.Style>
<Style TargetType="Path">
<Style.Triggers>
<DataTrigger Binding="{Binding Path=IsActive, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}}" Value="False">
<Setter Property="Opacity" Value="0.5" />
</DataTrigger>
</Style.Triggers>
</Style>
</Path.Style>
</Path>
</Button>
</Grid>
</StackPanel>
<StackPanel Margin="26,12,26,0">
<StackPanel Margin="0,0,0,12">
<TextBlock
Grid.Column="0"
Margin="0,0,0,0"
FontFamily="Segoe UI"
FontSize="20"
FontWeight="SemiBold"
Text="{DynamicResource flowlauncher_plugin_program_directory}"
TextAlignment="Left" />
</StackPanel>
<StackPanel Margin="0,0,0,10" Orientation="Horizontal">
<TextBox
Name="Directory"
Width="268"
Margin="0,7"
VerticalAlignment="Center" />
<Button
Width="70"
Margin="10"
HorizontalAlignment="Right"
Click="BrowseButton_Click"
Content="{DynamicResource flowlauncher_plugin_program_browse}" />
</StackPanel>
</StackPanel>
</StackPanel>
<Border
Grid.Row="1"
Background="{DynamicResource PopupButtonAreaBGColor}"
BorderBrush="{DynamicResource PopupButtonAreaBorderColor}"
BorderThickness="0,1,0,0">
<StackPanel HorizontalAlignment="Center" Orientation="Horizontal">
<Button
x:Name="btnCancel"
Width="100"
Margin="0,0,5,0"
Click="BtnCancel_OnClick"
Content="{DynamicResource cancel}" />
<Button
Width="100"
Margin="5,0,0,0"
HorizontalAlignment="Right"
Click="ButtonAdd_OnClick"
Content="{DynamicResource flowlauncher_plugin_program_update}" />
</StackPanel>
</Border>
</Grid>
<!--
<StackPanel Orientation="Vertical">
<StackPanel Orientation="Horizontal">
<Label Content="{DynamicResource flowlauncher_plugin_program_directory}" Margin="15,10"/>
<TextBox Name="Directory" VerticalAlignment="Center" Width="278" Margin="10,7" />
<Label Margin="15,10" Content="{DynamicResource flowlauncher_plugin_program_directory}" />
<TextBox
Name="Directory"
Width="278"
Margin="10,7"
VerticalAlignment="Center" />
</StackPanel>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
<Button Click="BrowseButton_Click" Content="{DynamicResource flowlauncher_plugin_program_browse}"
HorizontalAlignment="Right" Margin="10" Height="31" Width="70" />
<Button Click="ButtonAdd_OnClick" Content="{DynamicResource flowlauncher_plugin_program_update}"
HorizontalAlignment="Right" Margin="10" Height="31" Width="70" />
<StackPanel HorizontalAlignment="Right" Orientation="Horizontal">
<Button
Width="70"
Height="31"
Margin="10"
HorizontalAlignment="Right"
Click="BrowseButton_Click"
Content="{DynamicResource flowlauncher_plugin_program_browse}" />
<Button
Width="70"
Height="31"
Margin="10"
HorizontalAlignment="Right"
Click="ButtonAdd_OnClick"
Content="{DynamicResource flowlauncher_plugin_program_update}" />
</StackPanel>
</StackPanel>
-->
</Window>

View file

@ -42,6 +42,11 @@ namespace Flow.Launcher.Plugin.Program
}
}
private void BtnCancel_OnClick(object sender, RoutedEventArgs e)
{
Close();
}
private void ButtonAdd_OnClick(object sender, RoutedEventArgs e)
{
string s = Directory.Text;

View file

@ -1,8 +1,9 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:system="clr-namespace:System;assembly=mscorlib">
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:system="clr-namespace:System;assembly=mscorlib">
<!--Program setting-->
<!-- Program setting -->
<system:String x:Key="flowlauncher_plugin_program_delete">Delete</system:String>
<system:String x:Key="flowlauncher_plugin_program_edit">Edit</system:String>
<system:String x:Key="flowlauncher_plugin_program_add">Add</system:String>
@ -16,12 +17,14 @@
<system:String x:Key="flowlauncher_plugin_program_index_start_tooltip">When enabled, Flow will load programs from the start menu</system:String>
<system:String x:Key="flowlauncher_plugin_program_index_registry">Index Registry</system:String>
<system:String x:Key="flowlauncher_plugin_program_index_registry_tooltip">When enabled, Flow will load programs from the registry</system:String>
<system:String x:Key="flowlauncher_plugin_program_enable_description">Enable Program Description</system:String>
<system:String x:Key="flowlauncher_plugin_program_enable_hidelnkpath">Hide app path</system:String>
<system:String x:Key="flowlauncher_plugin_program_enable_hidelnkpath_tooltip">For executable files such as UWP or lnk, hide the file path from being visible</system:String>
<system:String x:Key="flowlauncher_plugin_program_enable_description">Search in Program Description</system:String>
<system:String x:Key="flowlauncher_plugin_program_enable_description_tooltip">Disabling this will also stop Flow from searching via the program desciption</system:String>
<system:String x:Key="flowlauncher_plugin_program_suffixes_header">Suffixes</system:String>
<system:String x:Key="flowlauncher_plugin_program_max_depth_header">Max Depth</system:String>
<system:String x:Key="flowlauncher_plugin_program_directory">Directory:</system:String>
<system:String x:Key="flowlauncher_plugin_program_directory">Directory</system:String>
<system:String x:Key="flowlauncher_plugin_program_browse">Browse</system:String>
<system:String x:Key="flowlauncher_plugin_program_file_suffixes">File Suffixes:</system:String>
<system:String x:Key="flowlauncher_plugin_program_max_search_depth">Maximum Search Depth (-1 is unlimited):</system:String>
@ -30,8 +33,7 @@
<system:String x:Key="flowlauncher_plugin_program_delete_program_source">Are you sure you want to delete the selected program sources?</system:String>
<system:String x:Key="flowlauncher_plugin_program_update">OK</system:String>
<system:String x:Key="flowlauncher_plugin_program_only_index_tip">Flow Launcher will only index files that end with the following suffixes:</system:String>
<system:String x:Key="flowlauncher_plugin_program_split_by_tip">(Each suffix should split by ';' )</system:String>
<system:String x:Key="flowlauncher_plugin_program_only_index_tip">Flow Launcher will only index files that end with the following suffixes. (Each suffix should split by ';' )</system:String>
<system:String x:Key="flowlauncher_plugin_program_update_file_suffixes">Successfully updated file suffixes</system:String>
<system:String x:Key="flowlauncher_plugin_program_suffixes_cannot_empty">File suffixes can't be empty</system:String>
@ -50,7 +52,7 @@
<system:String x:Key="flowlauncher_plugin_program_tooltip_customizedexplorer">You can customized the explorer used for opening the container folder by inputing the Environmental Variable of the explorer you want to use. It will be useful to use CMD to test whether the Environmental Variable is avaliable.</system:String>
<system:String x:Key="flowlauncher_plugin_program_tooltip_args">Enter the customized args you want to add for your customized explorer. %s for parent directory, %f for full path (which only works for win32). Check the explorer's website for details.</system:String>
<!--Dialogs-->
<!-- Dialogs -->
<system:String x:Key="flowlauncher_plugin_program_disable_dlgtitle_success">Success</system:String>
<system:String x:Key="flowlauncher_plugin_program_disable_dlgtitle_success_message">Successfully disabled this program from displaying in your query</system:String>
<system:String x:Key="flowlauncher_plugin_program_run_as_administrator_not_supported_message">This app is not intended to be run as administrator</system:String>

View file

@ -147,10 +147,15 @@ namespace Flow.Launcher.Plugin.Program
var t1 = Task.Run(IndexWin32Programs);
var t2 = Task.Run(IndexUwpPrograms);
await Task.WhenAll(t1, t2).ConfigureAwait(false);
ResetCache();
_settings.LastIndexTime = DateTime.Today;
}
internal static void ResetCache()
{
var oldCache = cache;
cache = new MemoryCache(cacheOptions);
oldCache.Dispose();
_settings.LastIndexTime = DateTime.Today;
}
public Control CreateSettingPanel()

View file

@ -1,19 +1,101 @@
<Window x:Class="Flow.Launcher.Plugin.Program.ProgramSuffixes"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d"
Width="400"
Height="180"
WindowStartupLocation="CenterScreen"
d:DesignHeight="400" d:DesignWidth="300">
<StackPanel>
<TextBlock Margin="10 10 0 0" Foreground="Gray" Text="{DynamicResource flowlauncher_plugin_program_only_index_tip}" />
<TextBlock Margin="10 10 0 0" Foreground="Gray" Text="{DynamicResource flowlauncher_plugin_program_split_by_tip}" />
<TextBox x:Name="tbSuffixes" Margin="10"/>
<Button HorizontalAlignment="Right" Height="30" Width="80" Click="ButtonBase_OnClick" Margin="0 0 10 0" Content="{DynamicResource flowlauncher_plugin_program_update}" />
</StackPanel>
<Window
x:Class="Flow.Launcher.Plugin.Program.ProgramSuffixes"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Title="{DynamicResource flowlauncher_plugin_program_suffixes}"
Width="400"
Background="{DynamicResource PopuBGColor}"
Foreground="{DynamicResource PopupTextColor}"
ResizeMode="NoResize"
SizeToContent="Height"
WindowStartupLocation="CenterScreen"
mc:Ignorable="d">
<WindowChrome.WindowChrome>
<WindowChrome CaptionHeight="32" ResizeBorderThickness="{x:Static SystemParameters.WindowResizeBorderThickness}" />
</WindowChrome.WindowChrome>
<Grid>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition Height="80" />
</Grid.RowDefinitions>
<StackPanel Grid.Row="0">
<StackPanel>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Button
Grid.Column="4"
Click="BtnCancel_OnClick"
Style="{StaticResource TitleBarCloseButtonStyle}">
<Path
Width="46"
Height="32"
Data="M 18,11 27,20 M 18,20 27,11"
Stroke="{Binding Path=Foreground, RelativeSource={RelativeSource AncestorType={x:Type Button}}}"
StrokeThickness="1">
<Path.Style>
<Style TargetType="Path">
<Style.Triggers>
<DataTrigger Binding="{Binding Path=IsActive, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}}" Value="False">
<Setter Property="Opacity" Value="0.5" />
</DataTrigger>
</Style.Triggers>
</Style>
</Path.Style>
</Path>
</Button>
</Grid>
</StackPanel>
<StackPanel Margin="26,12,26,0">
<StackPanel Margin="0,0,0,12">
<TextBlock
Grid.Column="0"
Margin="0,0,0,0"
FontFamily="Segoe UI"
FontSize="20"
FontWeight="SemiBold"
Text="{DynamicResource flowlauncher_plugin_program_suffixes}"
TextAlignment="Left" />
</StackPanel>
<TextBlock
FontSize="14"
Text="{DynamicResource flowlauncher_plugin_program_only_index_tip}"
TextWrapping="Wrap" />
<TextBox x:Name="tbSuffixes" Margin="0,20,0,20" />
</StackPanel>
</StackPanel>
<Border
Grid.Row="1"
Background="{DynamicResource PopupButtonAreaBGColor}"
BorderBrush="{DynamicResource PopupButtonAreaBorderColor}"
BorderThickness="0,1,0,0">
<StackPanel HorizontalAlignment="Center" Orientation="Horizontal">
<Button
x:Name="btnCancel"
Width="100"
Height="30"
Margin="0,0,5,0"
Click="BtnCancel_OnClick"
Content="{DynamicResource cancel}" />
<Button
Width="100"
Height="30"
Margin="5,0,0,0"
HorizontalAlignment="Right"
Click="ButtonBase_OnClick"
Content="{DynamicResource flowlauncher_plugin_program_update}" />
</StackPanel>
</Border>
</Grid>
</Window>

View file

@ -18,7 +18,10 @@ namespace Flow.Launcher.Plugin.Program
_settings = settings;
tbSuffixes.Text = string.Join(Settings.SuffixSeperator.ToString(), _settings.ProgramSuffixes);
}
private void BtnCancel_OnClick(object sender, RoutedEventArgs e)
{
Close();
}
private void ButtonBase_OnClick(object sender, RoutedEventArgs e)
{
var suffixes = tbSuffixes.Text.Split(Settings.SuffixSeperator, StringSplitOptions.RemoveEmptyEntries);

View file

@ -314,7 +314,7 @@ namespace Flow.Launcher.Plugin.Program.Programs
var result = new Result
{
Title = title,
SubTitle = Package.Location,
SubTitle = Main._settings.HideAppsPath ? string.Empty : Package.Location,
Icon = Logo,
Score = matchResult.Score,
TitleHighlightData = matchResult.MatchData,

View file

@ -97,7 +97,7 @@ namespace Flow.Launcher.Plugin.Program.Programs
var result = new Result
{
Title = title,
SubTitle = LnkResolvedPath ?? FullPath,
SubTitle = Main._settings.HideAppsPath ? string.Empty : LnkResolvedPath ?? FullPath,
IcoPath = IcoPath,
Score = matchResult.Score,
TitleHighlightData = matchResult.MatchData,

View file

@ -13,7 +13,8 @@ namespace Flow.Launcher.Plugin.Program
public bool EnableStartMenuSource { get; set; } = true;
public bool EnableDescription { get; set; } = true;
public bool EnableDescription { get; set; } = false;
public bool HideAppsPath { get; set; } = true;
public bool EnableRegistrySource { get; set; } = true;
public string CustomizedExplorer { get; set; } = Explorer;
public string CustomizedArgs { get; set; } = ExplorerArgs;

View file

@ -5,75 +5,110 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:program="clr-namespace:Flow.Launcher.Plugin.Program"
Height="450"
d:DesignHeight="404.508"
d:DesignWidth="600"
Height="520"
DataContext="{Binding RelativeSource={RelativeSource Self}}"
mc:Ignorable="d">
<Grid Margin="20">
<Grid Margin="0">
<Grid.RowDefinitions>
<RowDefinition Height="120" />
<RowDefinition Height="170" />
<RowDefinition Height="*" />
<RowDefinition Height="50" />
<RowDefinition Height="60" />
</Grid.RowDefinitions>
<StackPanel
Grid.Row="0"
HorizontalAlignment="Stretch"
Orientation="Horizontal">
Orientation="Vertical">
<StackPanel Width="Auto" Orientation="Vertical">
<CheckBox
Name="StartMenuEnabled"
Margin="5"
Content="{DynamicResource flowlauncher_plugin_program_index_start}"
IsChecked="{Binding EnableStartMenuSource}"
ToolTip="{DynamicResource flowlauncher_plugin_program_index_start_tooltip}" />
<CheckBox
Name="RegistryEnabled"
Margin="5"
Content="{DynamicResource flowlauncher_plugin_program_index_registry}"
IsChecked="{Binding EnableRegistrySource}"
ToolTip="{DynamicResource flowlauncher_plugin_program_index_registry_tooltip}" />
<CheckBox
Name="DescriptionEnabled"
Margin="5"
Content="{DynamicResource flowlauncher_plugin_program_enable_description}"
IsChecked="{Binding EnableDescription}"
ToolTip="{DynamicResource flowlauncher_plugin_program_enable_description_tooltip}" />
<StackPanel Width="Auto" Orientation="Horizontal">
<CheckBox
Name="StartMenuEnabled"
Width="200"
Margin="70,8,10,8"
Content="{DynamicResource flowlauncher_plugin_program_index_start}"
IsChecked="{Binding EnableStartMenuSource}"
ToolTip="{DynamicResource flowlauncher_plugin_program_index_start_tooltip}" />
<CheckBox
Name="RegistryEnabled"
Margin="70,8,10,8"
Content="{DynamicResource flowlauncher_plugin_program_index_registry}"
IsChecked="{Binding EnableRegistrySource}"
ToolTip="{DynamicResource flowlauncher_plugin_program_index_registry_tooltip}" />
</StackPanel>
<Separator
Height="1"
BorderBrush="{DynamicResource Color03B}"
BorderThickness="1" />
<StackPanel Width="Auto" Orientation="Horizontal">
<CheckBox
Name="HideLnkEnabled"
Width="200"
Margin="70,8,10,8"
Content="{DynamicResource flowlauncher_plugin_program_enable_hidelnkpath}"
IsChecked="{Binding HideAppsPath}"
ToolTip="{DynamicResource flowlauncher_plugin_program_enable_hidelnkpath_tooltip}" />
<CheckBox
Name="DescriptionEnabled"
Margin="70,8,10,8"
Content="{DynamicResource flowlauncher_plugin_program_enable_description}"
IsChecked="{Binding EnableDescription}"
ToolTip="{DynamicResource flowlauncher_plugin_program_enable_description_tooltip}" />
</StackPanel>
<Separator
Height="1"
BorderBrush="{DynamicResource Color03B}"
BorderThickness="1" />
</StackPanel>
<StackPanel
Width="Auto"
HorizontalAlignment="Right"
Margin="10,6,0,0"
HorizontalAlignment="Left"
Orientation="Horizontal">
<Button
x:Name="btnLoadAllProgramSource"
Width="100"
Height="31"
Margin="10"
Width="120"
Margin="10,10,5,10"
HorizontalAlignment="Right"
Click="btnLoadAllProgramSource_OnClick"
Content="{DynamicResource flowlauncher_plugin_program_all_programs}" />
<Button
x:Name="btnProgramSuffixes"
Width="100"
Height="31"
Margin="10"
Width="120"
Margin="5,10,5,10"
HorizontalAlignment="Right"
Click="BtnProgramSuffixes_OnClick"
Content="{DynamicResource flowlauncher_plugin_program_suffixes}" />
<Button
x:Name="btnReindex"
Width="100"
Height="31"
Margin="10"
Width="120"
Margin="5,10,5,10"
HorizontalAlignment="Right"
Click="btnReindex_Click"
Content="{DynamicResource flowlauncher_plugin_program_reindex}" />
<StackPanel
x:Name="indexingPanel"
HorizontalAlignment="Left"
Orientation="Horizontal"
Visibility="Hidden">
<ProgressBar
x:Name="progressBarIndexing"
Width="80"
Height="20"
IsIndeterminate="True"
Maximum="100"
Minimum="0" />
<TextBlock
Height="20"
Margin="10,0,0,0"
HorizontalAlignment="Center"
Text="{DynamicResource flowlauncher_plugin_program_indexing}" />
</StackPanel>
</StackPanel>
</StackPanel>
<ListView
x:Name="programSourceView"
Grid.Row="1"
Margin="0,13,0,10"
Margin="20,0,20,0"
AllowDrop="True"
BorderBrush="DarkGray"
BorderThickness="1"
@ -81,14 +116,7 @@
Drop="programSourceView_Drop"
GridViewColumnHeader.Click="GridViewColumnHeaderClickedHandler"
PreviewMouseRightButtonUp="ProgramSourceView_PreviewMouseRightButtonUp"
SelectionMode="Extended"
Style="{StaticResource {x:Static GridView.GridViewStyleKey}}">
<ListView.ItemContainerStyle>
<Style TargetType="ListViewItem">
<EventSetter Event="PreviewMouseUp" Handler="Row_OnClick" />
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
</Style>
</ListView.ItemContainerStyle>
SelectionMode="Extended">
<ListView.View>
<GridView>
<GridViewColumn Width="150" Header="Name">
@ -121,25 +149,7 @@
<DockPanel
Grid.Row="2"
Grid.RowSpan="1"
Margin="0,0,0,0">
<StackPanel
x:Name="indexingPanel"
HorizontalAlignment="Left"
Orientation="Horizontal"
Visibility="Hidden">
<ProgressBar
x:Name="progressBarIndexing"
Width="80"
Height="20"
IsIndeterminate="True"
Maximum="100"
Minimum="0" />
<TextBlock
Height="20"
Margin="10,0,0,0"
HorizontalAlignment="Center"
Text="{DynamicResource flowlauncher_plugin_program_indexing}" />
</StackPanel>
Margin="0,0,20,10">
<StackPanel HorizontalAlignment="Right" Orientation="Horizontal">
<Button
x:Name="btnProgramSourceStatus"

View file

@ -30,7 +30,20 @@ namespace Flow.Launcher.Plugin.Program.Views
public bool EnableDescription
{
get => _settings.EnableDescription;
set => _settings.EnableDescription = value;
set
{
Main.ResetCache();
_settings.EnableDescription = value;
}
}
public bool HideAppsPath
{
get => _settings.HideAppsPath;
set
{
Main.ResetCache();
_settings.HideAppsPath = value;
}
}
public bool EnableRegistrySource
@ -105,7 +118,6 @@ namespace Flow.Launcher.Plugin.Program.Views
private async void ReIndexing()
{
ViewRefresh();
indexingPanel.Visibility = Visibility.Visible;
await Main.IndexPrograms();
indexingPanel.Visibility = Visibility.Hidden;

View file

@ -4,7 +4,7 @@
"Name": "Program",
"Description": "Search programs in Flow.Launcher",
"Author": "qianlifeng",
"Version": "1.7.0",
"Version": "1.8.0",
"Language": "csharp",
"Website": "https://github.com/Flow-Launcher/Flow.Launcher",
"ExecuteFileName": "Flow.Launcher.Plugin.Program.dll",

View file

@ -0,0 +1,78 @@
using System.Collections.Generic;
namespace Flow.Launcher.Plugin.WindowsSettings.Classes
{
/// <summary>
/// A windows setting
/// </summary>
internal record WindowsSetting
{
/// <summary>
/// Initializes a new instance of the <see cref="WindowsSetting"/> class.
/// </summary>
public WindowsSetting()
{
Name = string.Empty;
Area = string.Empty;
Command = string.Empty;
Type = string.Empty;
}
/// <summary>
/// Gets or sets the name of this setting.
/// </summary>
public string Name { get; set; }
/// <summary>
/// Gets or sets the area of this setting.
/// </summary>
public string Area { get; set; }
/// <summary>
/// Gets or sets the command of this setting.
/// </summary>
public string Command { get; set; }
private string type = string.Empty;
/// <summary>
/// Gets or sets the type of the windows setting.
/// </summary>
public string Type { get; set; }
/// <summary>
/// Gets or sets the type display name of this setting.
/// </summary>
public string? DisplayType { get; set; }
/// <summary>
/// Gets or sets the alternative names of this setting.
/// </summary>
public IEnumerable<string>? AltNames { get; set; }
/// <summary>
/// Gets or sets the Keywords names of this task link.
/// </summary>
public IEnumerable<IEnumerable<string>>? Keywords { get; set; }
/// <summary>
/// Gets or sets the Glyph of this setting
/// </summary>
public string? glyph { get; set; }
/// <summary>
/// Gets or sets a additional note of this settings.
/// <para>(e.g. why is not supported on your system)</para>
/// </summary>
public string? Note { get; set; }
/// <summary>
/// Gets or sets the minimum need Windows build for this setting.
/// </summary>
public uint? IntroducedInBuild { get; set; }
/// <summary>
/// Gets or sets the Windows build since this settings is not longer present.
/// </summary>
public uint? DeprecatedInBuild { get; set; }
}
}

View file

@ -0,0 +1,76 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Library</OutputType>
<TargetFramework>net5.0-windows</TargetFramework>
<UseWindowsForms>true</UseWindowsForms>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<AppDesignerFolder>Properties</AppDesignerFolder>
<ErrorReport>prompt</ErrorReport>
<NeutralLanguage>en-US</NeutralLanguage>
<Nullable>enable</Nullable>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<OutputPath>..\..\Output\Debug\Plugins\Flow.Launcher.Plugin.WindowsSettings</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<Optimize>false</Optimize>
<DebugType>portable</DebugType>
<DebugSymbols>true</DebugSymbols>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<WarningLevel>4</WarningLevel>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<OutputPath>..\..\Output\Release\Plugins\Flow.Launcher.Plugin.WindowsSettings</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>portable</DebugType>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<WarningLevel>4</WarningLevel>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
<ItemGroup>
<None Remove="WindowsSettings.json" />
</ItemGroup>
<ItemGroup>
<None Include="plugin.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="WindowsSettings.json">
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<Compile Update="Properties\Resources.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Update="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<Content Include="Images\*.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Flow.Launcher.Plugin\Flow.Launcher.Plugin.csproj" />
</ItemGroup>
</Project>

View file

@ -0,0 +1,61 @@
using System;
using System.Collections.Generic;
using System.Windows;
using Flow.Launcher.Plugin;
using Flow.Launcher.Plugin.WindowsSettings.Classes;
using Flow.Launcher.Plugin.WindowsSettings.Properties;
namespace Flow.Launcher.Plugin.WindowsSettings.Helper
{
/// <summary>
/// Helper class to easier work with context menu entries
/// </summary>
internal static class ContextMenuHelper
{
/// <summary>
/// Return a list with all context menu entries for the given <see cref="Result"/>
/// <para>Symbols taken from <see href="https://docs.microsoft.com/en-us/windows/uwp/design/style/segoe-ui-symbol-font"/></para>
/// </summary>
/// <param name="result">The result for the context menu entires</param>
/// <param name="assemblyName">The name of the this assembly</param>
/// <returns>A list with context menu entries</returns>
internal static List<Result> GetContextMenu(in Result result, in string assemblyName)
{
if (result?.ContextData is not WindowsSetting entry)
{
return new List<Result>(0);
}
var list = new List<Result>(1)
{
new()
{
Action = _ => TryToCopyToClipBoard(entry.Command),
Title = $"{Resources.CopyCommand} (Ctrl+C)",
},
};
return list;
}
/// <summary>
/// Copy the given text to the clipboard
/// </summary>
/// <param name="text">The text to copy to the clipboard</param>
/// <returns><see langword="true"/>The text successful copy to the clipboard, otherwise <see langword="false"/></returns>
private static bool TryToCopyToClipBoard(in string text)
{
try
{
Clipboard.Clear();
Clipboard.SetText(text);
return true;
}
catch (Exception exception)
{
Log.Exception("Can't copy to clipboard", exception, typeof(Main));
return false;
}
}
}
}

View file

@ -0,0 +1,58 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text.Json;
using System.Text.Json.Serialization;
using Flow.Launcher.Plugin.WindowsSettings.Classes;
namespace Flow.Launcher.Plugin.WindowsSettings.Helper
{
/// <summary>
/// Helper class to easier work with the JSON file that contains all Windows settings
/// </summary>
internal static class JsonSettingsListHelper
{
/// <summary>
/// The name of the file that contains all settings for the query
/// </summary>
private const string _settingsFile = "WindowsSettings.json";
/// <summary>
/// Read all possible Windows settings.
/// </summary>
/// <returns>A list with all possible windows settings.</returns>
internal static IEnumerable<WindowsSetting> ReadAllPossibleSettings()
{
var assembly = Assembly.GetExecutingAssembly();
var type = assembly.GetTypes().FirstOrDefault(x => x.Name == nameof(Main));
IEnumerable<WindowsSetting>? settingsList = null;
try
{
var resourceName = $"{type?.Namespace}.{_settingsFile}";
using var stream = assembly.GetManifestResourceStream(resourceName);
if (stream is null)
{
throw new Exception("stream is null");
}
var options = new JsonSerializerOptions();
options.Converters.Add(new JsonStringEnumConverter());
using var reader = new StreamReader(stream);
var text = reader.ReadToEnd();
settingsList = JsonSerializer.Deserialize<IEnumerable<WindowsSetting>>(text, options);
}
catch (Exception exception)
{
Log.Exception("Error loading settings JSON file", exception, typeof(Main));
}
return settingsList ?? Enumerable.Empty<WindowsSetting>();
}
}
}

View file

@ -0,0 +1,189 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using Flow.Launcher.Plugin;
using Flow.Launcher.Plugin.WindowsSettings.Classes;
using Flow.Launcher.Plugin.WindowsSettings.Properties;
namespace Flow.Launcher.Plugin.WindowsSettings.Helper
{
/// <summary>
/// Helper class to easier work with results
/// </summary>
internal static class ResultHelper
{
private static IPublicAPI? _api;
public static void Init(IPublicAPI api) => _api = api;
/// <summary>
/// Return a list with <see cref="Result"/>s, based on the given list.
/// </summary>
/// <param name="list">The original result list to convert.</param>
/// <param name="query">Query for specific result List</param>
/// <param name="windowsSettingIconPath">The path to the icon of each entry.</param>
/// <returns>A list with <see cref="Result"/>.</returns>
internal static List<Result> GetResultList(
in IEnumerable<WindowsSetting> list,
Query query,
string windowsSettingIconPath,
string controlPanelIconPath)
{
var resultList = new List<Result>();
foreach (var entry in list)
{
const int highScore = 20;
const int midScore = 10;
Result? result;
Debug.Assert(_api != null, nameof(_api) + " != null");
var nameMatch = _api.FuzzySearch(query.Search, entry.Name);
if (nameMatch.IsSearchPrecisionScoreMet())
{
var settingResult = NewSettingResult(nameMatch.Score + highScore, entry.Type);
settingResult.TitleHighlightData = nameMatch.MatchData;
result = settingResult;
}
else
{
var areaMatch = _api.FuzzySearch(query.Search, entry.Area);
if (areaMatch.IsSearchPrecisionScoreMet())
{
var settingResult = NewSettingResult(areaMatch.Score + midScore, entry.Type);
settingResult.SubTitleHighlightData = areaMatch.MatchData.Select(x => x + 6).ToList();
result = settingResult;
}
else
{
result = entry.AltNames?
.Select(altName => _api.FuzzySearch(query.Search, altName))
.Where(match => match.IsSearchPrecisionScoreMet())
.Select(altNameMatch => NewSettingResult(altNameMatch.Score + midScore, entry.Type))
.FirstOrDefault();
}
if (result is null && entry.Keywords is not null)
{
string[] searchKeywords = query.SearchTerms;
if (searchKeywords
.All(x => entry
.Keywords
.SelectMany(x => x)
.Contains(x, StringComparer.CurrentCultureIgnoreCase))
)
result = NewSettingResult(midScore, entry.Type);
}
}
if (result is null)
continue;
AddOptionalToolTip(entry, result);
resultList.Add(result);
Result NewSettingResult(int score, string type) => new()
{
Action = _ => DoOpenSettingsAction(entry),
IcoPath = type == "AppSettingsApp" ? windowsSettingIconPath : controlPanelIconPath,
SubTitle = GetSubtitle(entry.Area, type),
Title = entry.Name + entry.glyph,
ContextData = entry,
Score = score
};
}
return resultList;
}
private static string GetSubtitle(string section, string entryType)
{
var settingType = entryType == "AppSettingsApp" ? "System settings" : "Control Panel";
return $"{settingType} > {section}";
}
/// <summary>
/// Add a tool-tip to the given <see cref="Result"/>, based o the given <see cref="IWindowsSetting"/>.
/// </summary>
/// <param name="entry">The <see cref="WindowsSetting"/> that contain informations for the tool-tip.</param>
/// <param name="result">The <see cref="Result"/> that need a tool-tip.</param>
private static void AddOptionalToolTip(WindowsSetting entry, Result result)
{
var toolTipText = new StringBuilder();
var settingType = entry.Type == "AppSettingsApp" ? "System settings" : "Control Panel";
toolTipText.AppendLine($"{Resources.Application}: {settingType}");
toolTipText.AppendLine($"{Resources.Area}: {entry.Area}");
if (entry.AltNames != null && entry.AltNames.Any())
{
var altList = entry.AltNames.Aggregate((current, next) => $"{current}, {next}");
toolTipText.AppendLine($"{Resources.AlternativeName}: {altList}");
}
toolTipText.Append($"{Resources.Command}: {entry.Command}");
if (!string.IsNullOrEmpty(entry.Note))
{
toolTipText.AppendLine(string.Empty);
toolTipText.AppendLine(string.Empty);
toolTipText.Append($"{Resources.Note}: {entry.Note}");
}
result.TitleToolTip = toolTipText.ToString();
result.SubTitleToolTip = result.TitleToolTip;
}
/// <summary>
/// Open the settings page of the given <see cref="IWindowsSetting"/>.
/// </summary>
/// <param name="entry">The <see cref="WindowsSetting"/> that contain the information to open the setting on command level.</param>
/// <returns><see langword="true"/> if the settings could be opened, otherwise <see langword="false"/>.</returns>
private static bool DoOpenSettingsAction(WindowsSetting entry)
{
ProcessStartInfo processStartInfo;
var command = entry.Command;
command = Environment.ExpandEnvironmentVariables(command);
if (command.Contains(' '))
{
var commandSplit = command.Split(' ');
var file = commandSplit.First();
var arguments = command[file.Length..].TrimStart();
processStartInfo = new ProcessStartInfo(file, arguments)
{
UseShellExecute = false,
};
}
else
{
processStartInfo = new ProcessStartInfo(command)
{
UseShellExecute = true,
};
}
try
{
Process.Start(processStartInfo);
return true;
}
catch (Exception exception)
{
Log.Exception("can't open settings", exception, typeof(ResultHelper));
return false;
}
}
}
}

View file

@ -0,0 +1,92 @@
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using Flow.Launcher.Plugin.WindowsSettings.Classes;
using Flow.Launcher.Plugin.WindowsSettings.Properties;
namespace Flow.Launcher.Plugin.WindowsSettings.Helper
{
/// <summary>
/// Helper class to easier work with translations.
/// </summary>
internal static class TranslationHelper
{
/// <summary>
/// Translate all settings of the given list with <see cref="WindowsSetting"/>.
/// </summary>
/// <param name="settingsList">The list that contains <see cref="WindowsSetting"/> to translate.</param>
internal static IEnumerable<WindowsSetting> TranslateAllSettings(in IEnumerable<WindowsSetting>? settingsList)
{
var translatedSettings = new List<WindowsSetting>();
if (settingsList is null)
return new List<WindowsSetting>();
foreach (var settings in settingsList)
{
var area = Resources.ResourceManager.GetString($"Area{settings.Area}");
var name = Resources.ResourceManager.GetString(settings.Name);
var type = Resources.ResourceManager.GetString(settings.Type);
if (string.IsNullOrEmpty(area))
{
Log.Warn($"Resource string for [Area{settings.Area}] not found", typeof(Main));
}
if (string.IsNullOrEmpty(name))
{
Log.Warn($"Resource string for [{settings.Name}] not found", typeof(Main));
}
if (string.IsNullOrEmpty(type))
{
Log.Warn($"Resource string for [{settings.Name}] not found", typeof(Main));
}
if (!string.IsNullOrEmpty(settings.Note))
{
var note = Resources.ResourceManager.GetString(settings.Note);
if (string.IsNullOrEmpty(note))
{
Log.Warn($"Resource string for [{settings.Note}] not found", typeof(Main));
}
settings.Note = note ?? settings.Note ?? string.Empty;
}
List<string>? translatedAltNames = null;
if (settings.AltNames is not null && settings.AltNames.Any())
{
translatedAltNames = new List<string>();
foreach (var altName in settings.AltNames)
{
if (string.IsNullOrWhiteSpace(altName))
{
continue;
}
var translatedAltName = Resources.ResourceManager.GetString(altName);
if (string.IsNullOrEmpty(translatedAltName))
{
Log.Warn($"Resource string for [{altName}] not found", typeof(Main));
}
translatedAltNames.Add(translatedAltName ?? altName);
}
}
var translatedSetting = settings with
{
Area = area ?? settings.Area,
Name = name ?? settings.Name,
DisplayType = type ?? settings.Type,
AltNames = translatedAltNames
};
translatedSettings.Add(translatedSetting);
}
return translatedSettings;
}
}
}

View file

@ -0,0 +1,85 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Flow.Launcher.Plugin.WindowsSettings.Classes;
namespace Flow.Launcher.Plugin.WindowsSettings.Helper
{
/// <summary>
/// Helper class to easier work with the version of the Windows OS
/// </summary>
internal static class UnsupportedSettingsHelper
{
private const string _keyPath = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion";
private const string _keyNameBuild = "CurrentBuild";
private const string _keyNameBuildNumber = "CurrentBuildNumber";
/// <summary>
/// Remove all <see cref="WindowsSetting"/> of the given list that are not present on the current used Windows build.
/// </summary>
/// <param name="settingsList">The list with <see cref="WindowsSetting"/> to filter.</param>
/// <returns>A new list with <see cref="WindowsSetting"/> that only contain present Windows settings for this OS.</returns>
internal static IEnumerable<WindowsSetting> FilterByBuild(in IEnumerable<WindowsSetting>? settingsList)
{
if (settingsList is null)
{
return Enumerable.Empty<WindowsSetting>();
}
var currentBuild = GetNumericRegistryValue(_keyPath, _keyNameBuild);
var currentBuildNumber = GetNumericRegistryValue(_keyPath, _keyNameBuildNumber);
if (currentBuild != currentBuildNumber)
{
var usedValueName = currentBuild != uint.MinValue ? _keyNameBuild : _keyNameBuildNumber;
var warningMessage =
$"Detecting the Windows version in registry ({_keyPath}) leads to an inconclusive"
+ $" result ({_keyNameBuild}={currentBuild}, {_keyNameBuildNumber}={currentBuildNumber})!"
+ $" For resolving the conflict we use the value of '{usedValueName}'.";
Log.Warn(warningMessage, typeof(UnsupportedSettingsHelper));
}
var currentWindowsBuild = currentBuild != uint.MinValue
? currentBuild
: currentBuildNumber;
var filteredSettingsList = settingsList.Where(found
=> (found.DeprecatedInBuild == null || currentWindowsBuild < found.DeprecatedInBuild)
&& (found.IntroducedInBuild == null || currentWindowsBuild >= found.IntroducedInBuild));
filteredSettingsList = filteredSettingsList.OrderBy(found => found.Name);
return filteredSettingsList;
}
/// <summary>
/// Return a unsigned numeric value from given registry value name inside the given registry key.
/// </summary>
/// <param name="registryKey">The registry key.</param>
/// <param name="valueName">The name of the registry value.</param>
/// <returns>A registry value or <see cref="uint.MinValue"/> on error.</returns>
private static uint GetNumericRegistryValue(in string registryKey, in string valueName)
{
object? registryValueData;
try
{
registryValueData = Microsoft.Win32.Registry.GetValue(registryKey, valueName, uint.MinValue);
}
catch (Exception exception)
{
Log.Exception(
$"Can't get registry value for '{valueName}'",
exception,
typeof(UnsupportedSettingsHelper));
return uint.MinValue;
}
return uint.TryParse(registryValueData as string, out var buildNumber)
? buildNumber
: uint.MinValue;
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

View file

@ -0,0 +1,24 @@
using System;
using System.Runtime.CompilerServices;
using Flow.Launcher.Plugin;
namespace Flow.Launcher.Plugin.WindowsSettings
{
public static class Log
{
private static IPublicAPI? _api;
public static void Init(IPublicAPI api)
{
_api = api;
}
public static void Exception(string message, Exception exception, Type type, [CallerMemberName] string methodName = "")
{
_api?.LogException(type.FullName, message, exception, methodName);
}
public static void Warn(string message, Type type, [CallerMemberName] string methodName = "")
{
_api?.LogWarn(type.FullName, message, methodName);
}
}
}

View file

@ -0,0 +1,150 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Reflection;
using Flow.Launcher.Plugin;
using Flow.Launcher.Plugin.WindowsSettings.Classes;
using Flow.Launcher.Plugin.WindowsSettings.Helper;
using Flow.Launcher.Plugin.WindowsSettings.Properties;
namespace Flow.Launcher.Plugin.WindowsSettings
{
/// <summary>
/// Main class of this plugin that implement all used interfaces.
/// </summary>
public sealed class Main : IPlugin, IContextMenu, IPluginI18n, IDisposable
{
/// <summary>
/// The name of this assembly.
/// </summary>
private readonly string _assemblyName;
/// <summary>
/// The initial context for this plugin (contains API and meta-data).
/// </summary>
private PluginInitContext? _context;
/// <summary>
/// The path to the icon for windows setting result.
/// </summary>
private const string windowSettingsIconPath = "Images/WindowsSettings.light.png";
/// <summary>
/// The path to the icon for control panel result.
/// </summary>
private const string controlPanelIconPath = "Images/ControlPanel_Small.png";
/// <summary>
/// Indicate that the plugin is disposed.
/// </summary>
private bool _disposed;
/// <summary>
/// List that contain all settings.
/// </summary>
private IEnumerable<WindowsSetting>? _settingsList;
/// <summary>
/// List that contains translated string
/// </summary>
private IEnumerable<WindowsSetting> _translatedSettingList = new List<WindowsSetting>();
/// <summary>
/// Initializes a new instance of the <see cref="Main"/> class.
/// </summary>
public Main()
{
_assemblyName = Assembly.GetExecutingAssembly().GetName().Name ?? Name;
}
/// <summary>
/// Gets the localized name.
/// </summary>
public string Name => Resources.PluginTitle;
/// <summary>
/// Gets the localized description.
/// </summary>
public string Description => Resources.PluginDescription;
/// <summary>
/// Initialize the plugin with the given <see cref="PluginInitContext"/>.
/// </summary>
/// <param name="context">The <see cref="PluginInitContext"/> for this plugin.</param>
public void Init(PluginInitContext context)
{
_context = context ?? throw new ArgumentNullException(nameof(context));
_settingsList = JsonSettingsListHelper.ReadAllPossibleSettings();
_settingsList = UnsupportedSettingsHelper.FilterByBuild(_settingsList);
Log.Init(_context.API);
ResultHelper.Init(_context.API);
_translatedSettingList = TranslationHelper.TranslateAllSettings(_settingsList);
}
/// <summary>
/// Return a filtered list, based on the given query.
/// </summary>
/// <param name="query">The query to filter the list.</param>
/// <returns>A filtered list, can be empty when nothing was found.</returns>
public List<Result> Query(Query query)
{
var newList = ResultHelper.GetResultList(_translatedSettingList, query, windowSettingsIconPath, controlPanelIconPath);
return newList;
}
public void OnCultureInfoChanged(CultureInfo newCulture)
{
_translatedSettingList = TranslationHelper.TranslateAllSettings(_settingsList);
}
/// <summary>
/// Return a list context menu entries for a given <see cref="Result"/> (shown at the right side of the result).
/// </summary>
/// <param name="selectedResult">The <see cref="Result"/> for the list with context menu entries.</param>
/// <returns>A list context menu entries.</returns>
public List<Result> LoadContextMenus(Result selectedResult)
{
return ContextMenuHelper.GetContextMenu(selectedResult, _assemblyName);
}
/// <inheritdoc/>
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
/// <summary>
/// Wrapper method for <see cref="Dispose"/> that dispose additional objects and events form the plugin itself.
/// </summary>
/// <param name="disposing">Indicate that the plugin is disposed.</param>
private void Dispose(bool disposing)
{
if (_disposed || !disposing)
{
return;
}
_disposed = true;
}
/// <summary>
/// Gets the localized name.
/// </summary>
public string GetTranslatedPluginTitle()
{
return Name;
}
/// <summary>
/// Gets the localized description.
/// </summary>
public string GetTranslatedPluginDescription()
{
return Description;
}
}
}

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,2 @@
# Flow.Launcher.Plugin.WindowsSettings
Ported from PowerToys WindowsSettings plugin

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,12 @@
{
"ID": "5043CETYU6A748679OPA02D27D99677A",
"ActionKeyword": "*",
"Description": "Search settings inside Control Panel and Settings App",
"Name": "Windows Settings",
"Author": "TobiasSekan",
"Version": "2.0.0",
"Language": "csharp",
"Website": "https://github.com/Flow-Launcher/Flow.Launcher",
"ExecuteFileName": "Flow.Launcher.Plugin.WindowsSettings.dll",
"IcoPath": "Images\\WindowsSettings.light.png"
}