From 8343bc761de07757aefeb0ba7944bf493fca8978 Mon Sep 17 00:00:00 2001 From: DB p Date: Sun, 28 Nov 2021 05:05:25 +0900 Subject: [PATCH 01/11] Add hide uwp/lnk path setting --- .../Flow.Launcher.Plugin.Program/Languages/en.xaml | 13 ++++++++----- .../Flow.Launcher.Plugin.Program/Programs/UWP.cs | 14 +++++++++++++- .../Flow.Launcher.Plugin.Program/Programs/Win32.cs | 14 +++++++++++++- Plugins/Flow.Launcher.Plugin.Program/Settings.cs | 3 ++- .../Views/ProgramSetting.xaml | 8 +++++++- .../Views/ProgramSetting.xaml.cs | 5 +++++ 6 files changed, 48 insertions(+), 9 deletions(-) diff --git a/Plugins/Flow.Launcher.Plugin.Program/Languages/en.xaml b/Plugins/Flow.Launcher.Plugin.Program/Languages/en.xaml index 770bb69ccd8..1ea8ecb4b69 100644 --- a/Plugins/Flow.Launcher.Plugin.Program/Languages/en.xaml +++ b/Plugins/Flow.Launcher.Plugin.Program/Languages/en.xaml @@ -1,8 +1,9 @@ - + - + Delete Edit Add @@ -16,6 +17,8 @@ When enabled, Flow will load programs from the start menu Index Registry When enabled, Flow will load programs from the registry + Hide Apps path + For executable files such as UWP or lnk, hide the file path from being visible Enable Program Description Disabling this will also stop Flow from searching via the program desciption Suffixes @@ -50,7 +53,7 @@ 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. 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. - + Success Successfully disabled this program from displaying in your query This app is not intended to be run as administrator diff --git a/Plugins/Flow.Launcher.Plugin.Program/Programs/UWP.cs b/Plugins/Flow.Launcher.Plugin.Program/Programs/UWP.cs index e96a8b85aa4..f280278e203 100644 --- a/Plugins/Flow.Launcher.Plugin.Program/Programs/UWP.cs +++ b/Plugins/Flow.Launcher.Plugin.Program/Programs/UWP.cs @@ -314,7 +314,7 @@ public Result Result(string query, IPublicAPI api) var result = new Result { Title = title, - SubTitle = Package.Location, + SubTitle = HideLnkPath(), Icon = Logo, Score = matchResult.Score, TitleHighlightData = matchResult.MatchData, @@ -351,6 +351,18 @@ public Result Result(string query, IPublicAPI api) return result; } + public string HideLnkPath() + { + bool lnkSetting = Main._settings.EnableHideLnkPath; + if (lnkSetting) + { + return ""; + } + else + { + return Package.Location; + } + } public List ContextMenus(IPublicAPI api) { diff --git a/Plugins/Flow.Launcher.Plugin.Program/Programs/Win32.cs b/Plugins/Flow.Launcher.Plugin.Program/Programs/Win32.cs index 21314766055..809d0a60588 100644 --- a/Plugins/Flow.Launcher.Plugin.Program/Programs/Win32.cs +++ b/Plugins/Flow.Launcher.Plugin.Program/Programs/Win32.cs @@ -97,7 +97,7 @@ public Result Result(string query, IPublicAPI api) var result = new Result { Title = title, - SubTitle = LnkResolvedPath ?? FullPath, + SubTitle = HideLnkPath(), IcoPath = IcoPath, Score = matchResult.Score, TitleHighlightData = matchResult.MatchData, @@ -545,5 +545,17 @@ public bool Equals([AllowNull] Win32 other) return UniqueIdentifier == other.UniqueIdentifier; } + + public string HideLnkPath() + { + bool lnkSetting = Main._settings.EnableHideLnkPath; + if (lnkSetting) { + return ""; + } + else + { + return LnkResolvedPath ?? FullPath; + } + } } } \ No newline at end of file diff --git a/Plugins/Flow.Launcher.Plugin.Program/Settings.cs b/Plugins/Flow.Launcher.Plugin.Program/Settings.cs index 70e5bd4f53d..031bbcd1f6b 100644 --- a/Plugins/Flow.Launcher.Plugin.Program/Settings.cs +++ b/Plugins/Flow.Launcher.Plugin.Program/Settings.cs @@ -13,7 +13,8 @@ public class Settings public bool EnableStartMenuSource { get; set; } = true; - public bool EnableDescription { get; set; } = true; + public bool EnableDescription { get; set; } = false; + public bool EnableHideLnkPath { get; set; } = true; public bool EnableRegistrySource { get; set; } = true; public string CustomizedExplorer { get; set; } = Explorer; public string CustomizedArgs { get; set; } = ExplorerArgs; diff --git a/Plugins/Flow.Launcher.Plugin.Program/Views/ProgramSetting.xaml b/Plugins/Flow.Launcher.Plugin.Program/Views/ProgramSetting.xaml index d4cf96e8616..f7b2602a103 100644 --- a/Plugins/Flow.Launcher.Plugin.Program/Views/ProgramSetting.xaml +++ b/Plugins/Flow.Launcher.Plugin.Program/Views/ProgramSetting.xaml @@ -12,7 +12,7 @@ mc:Ignorable="d"> - + @@ -33,6 +33,12 @@ Content="{DynamicResource flowlauncher_plugin_program_index_registry}" IsChecked="{Binding EnableRegistrySource}" ToolTip="{DynamicResource flowlauncher_plugin_program_index_registry_tooltip}" /> + _settings.EnableDescription; set => _settings.EnableDescription = value; } + public bool EnableHideLnkPath + { + get => _settings.EnableHideLnkPath; + set => _settings.EnableHideLnkPath = value; + } public bool EnableRegistrySource { From 113f15487a682fef61cfcdc44f34536579629a1c Mon Sep 17 00:00:00 2001 From: DB p Date: Sun, 28 Nov 2021 06:09:36 +0900 Subject: [PATCH 02/11] Adjust SettingPanel Layout --- .../Views/ProgramSetting.xaml | 34 +++++++++---------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/Plugins/Flow.Launcher.Plugin.Program/Views/ProgramSetting.xaml b/Plugins/Flow.Launcher.Plugin.Program/Views/ProgramSetting.xaml index f7b2602a103..4979bf66afb 100644 --- a/Plugins/Flow.Launcher.Plugin.Program/Views/ProgramSetting.xaml +++ b/Plugins/Flow.Launcher.Plugin.Program/Views/ProgramSetting.xaml @@ -5,55 +5,57 @@ 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="550" DataContext="{Binding RelativeSource={RelativeSource Self}}" mc:Ignorable="d"> - + - + - + + Orientation="Vertical"> + + + + + + + + + + + + + + + + + + + + + + + + + +