Skip to content

Commit 406c29f

Browse files
authored
Merge branch 'dev' into plugin_store_item_vm_null
2 parents 383c0ae + 43227d8 commit 406c29f

File tree

70 files changed

+897
-226
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+897
-226
lines changed

Flow.Launcher.Infrastructure/NativeMethods.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,7 @@ LOCALE_TRANSIENT_KEYBOARD1
5757
LOCALE_TRANSIENT_KEYBOARD2
5858
LOCALE_TRANSIENT_KEYBOARD3
5959
LOCALE_TRANSIENT_KEYBOARD4
60+
61+
SHParseDisplayName
62+
SHOpenFolderAndSelectItems
63+
CoTaskMemFree

Flow.Launcher.Infrastructure/UserSettings/Settings.cs

Lines changed: 31 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ public void Save()
5050
public string SelectPrevPageHotkey { get; set; } = $"PageDown";
5151
public string OpenContextMenuHotkey { get; set; } = $"Ctrl+O";
5252
public string SettingWindowHotkey { get; set; } = $"Ctrl+I";
53+
public string OpenHistoryHotkey { get; set; } = $"Ctrl+H";
5354
public string CycleHistoryUpHotkey { get; set; } = $"{KeyConstant.Alt} + Up";
5455
public string CycleHistoryDownHotkey { get; set; } = $"{KeyConstant.Alt} + Down";
5556

@@ -173,7 +174,20 @@ public bool ShowHomePage
173174
}
174175
}
175176

176-
public bool ShowHistoryResultsForHomePage { get; set; } = false;
177+
private bool _showHistoryResultsForHomePage = false;
178+
public bool ShowHistoryResultsForHomePage
179+
{
180+
get => _showHistoryResultsForHomePage;
181+
set
182+
{
183+
if (_showHistoryResultsForHomePage != value)
184+
{
185+
_showHistoryResultsForHomePage = value;
186+
OnPropertyChanged();
187+
}
188+
}
189+
}
190+
177191
public int MaxHistoryResultsToShowForHomePage { get; set; } = 5;
178192

179193
public bool AutoRestartAfterChanging { get; set; } = false;
@@ -215,8 +229,8 @@ public CustomExplorerViewModel CustomExplorer
215229
new()
216230
{
217231
Name = "Files",
218-
Path = "Files",
219-
DirectoryArgument = "-select \"%d\"",
232+
Path = "Files-Stable",
233+
DirectoryArgument = "\"%d\"",
220234
FileArgument = "-select \"%f\""
221235
}
222236
};
@@ -397,29 +411,31 @@ public List<RegisteredHotkeyData> RegisteredHotkeys
397411
var list = FixedHotkeys();
398412

399413
// Customizeable hotkeys
400-
if(!string.IsNullOrEmpty(Hotkey))
414+
if (!string.IsNullOrEmpty(Hotkey))
401415
list.Add(new(Hotkey, "flowlauncherHotkey", () => Hotkey = ""));
402-
if(!string.IsNullOrEmpty(PreviewHotkey))
416+
if (!string.IsNullOrEmpty(PreviewHotkey))
403417
list.Add(new(PreviewHotkey, "previewHotkey", () => PreviewHotkey = ""));
404-
if(!string.IsNullOrEmpty(AutoCompleteHotkey))
418+
if (!string.IsNullOrEmpty(AutoCompleteHotkey))
405419
list.Add(new(AutoCompleteHotkey, "autoCompleteHotkey", () => AutoCompleteHotkey = ""));
406-
if(!string.IsNullOrEmpty(AutoCompleteHotkey2))
420+
if (!string.IsNullOrEmpty(AutoCompleteHotkey2))
407421
list.Add(new(AutoCompleteHotkey2, "autoCompleteHotkey", () => AutoCompleteHotkey2 = ""));
408-
if(!string.IsNullOrEmpty(SelectNextItemHotkey))
422+
if (!string.IsNullOrEmpty(SelectNextItemHotkey))
409423
list.Add(new(SelectNextItemHotkey, "SelectNextItemHotkey", () => SelectNextItemHotkey = ""));
410-
if(!string.IsNullOrEmpty(SelectNextItemHotkey2))
424+
if (!string.IsNullOrEmpty(SelectNextItemHotkey2))
411425
list.Add(new(SelectNextItemHotkey2, "SelectNextItemHotkey", () => SelectNextItemHotkey2 = ""));
412-
if(!string.IsNullOrEmpty(SelectPrevItemHotkey))
426+
if (!string.IsNullOrEmpty(SelectPrevItemHotkey))
413427
list.Add(new(SelectPrevItemHotkey, "SelectPrevItemHotkey", () => SelectPrevItemHotkey = ""));
414-
if(!string.IsNullOrEmpty(SelectPrevItemHotkey2))
428+
if (!string.IsNullOrEmpty(SelectPrevItemHotkey2))
415429
list.Add(new(SelectPrevItemHotkey2, "SelectPrevItemHotkey", () => SelectPrevItemHotkey2 = ""));
416-
if(!string.IsNullOrEmpty(SettingWindowHotkey))
430+
if (!string.IsNullOrEmpty(SettingWindowHotkey))
417431
list.Add(new(SettingWindowHotkey, "SettingWindowHotkey", () => SettingWindowHotkey = ""));
418-
if(!string.IsNullOrEmpty(OpenContextMenuHotkey))
432+
if (!string.IsNullOrEmpty(OpenHistoryHotkey))
433+
list.Add(new(OpenHistoryHotkey, "OpenHistoryHotkey", () => OpenHistoryHotkey = ""));
434+
if (!string.IsNullOrEmpty(OpenContextMenuHotkey))
419435
list.Add(new(OpenContextMenuHotkey, "OpenContextMenuHotkey", () => OpenContextMenuHotkey = ""));
420-
if(!string.IsNullOrEmpty(SelectNextPageHotkey))
436+
if (!string.IsNullOrEmpty(SelectNextPageHotkey))
421437
list.Add(new(SelectNextPageHotkey, "SelectNextPageHotkey", () => SelectNextPageHotkey = ""));
422-
if(!string.IsNullOrEmpty(SelectPrevPageHotkey))
438+
if (!string.IsNullOrEmpty(SelectPrevPageHotkey))
423439
list.Add(new(SelectPrevPageHotkey, "SelectPrevPageHotkey", () => SelectPrevPageHotkey = ""));
424440
if (!string.IsNullOrEmpty(CycleHistoryUpHotkey))
425441
list.Add(new(CycleHistoryUpHotkey, "CycleHistoryUpHotkey", () => CycleHistoryUpHotkey = ""));
@@ -450,7 +466,6 @@ private List<RegisteredHotkeyData> FixedHotkeys()
450466
new("Alt+Home", "HotkeySelectFirstResult"),
451467
new("Alt+End", "HotkeySelectLastResult"),
452468
new("Ctrl+R", "HotkeyRequery"),
453-
new("Ctrl+H", "ToggleHistoryHotkey"),
454469
new("Ctrl+OemCloseBrackets", "QuickWidthHotkey"),
455470
new("Ctrl+OemOpenBrackets", "QuickWidthHotkey"),
456471
new("Ctrl+OemPlus", "QuickHeightHotkey"),

Flow.Launcher.Infrastructure/Win32Helper.cs

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using System.ComponentModel;
44
using System.Diagnostics;
55
using System.Globalization;
6+
using System.IO;
67
using System.Linq;
78
using System.Runtime.InteropServices;
89
using System.Threading;
@@ -17,6 +18,7 @@
1718
using Windows.Win32.Foundation;
1819
using Windows.Win32.Graphics.Dwm;
1920
using Windows.Win32.UI.Input.KeyboardAndMouse;
21+
using Windows.Win32.UI.Shell.Common;
2022
using Windows.Win32.UI.WindowsAndMessaging;
2123
using Point = System.Windows.Point;
2224
using SystemFonts = System.Windows.SystemFonts;
@@ -753,5 +755,36 @@ private static bool TryGetNotoFont(string langKey, out string notoFont)
753755
}
754756

755757
#endregion
758+
759+
#region Explorer
760+
761+
// https://learn.microsoft.com/en-us/windows/win32/api/shlobj_core/nf-shlobj_core-shopenfolderandselectitems
762+
763+
public static unsafe void OpenFolderAndSelectFile(string filePath)
764+
{
765+
ITEMIDLIST* pidlFolder = null;
766+
ITEMIDLIST* pidlFile = null;
767+
768+
var folderPath = Path.GetDirectoryName(filePath);
769+
770+
try
771+
{
772+
var hrFolder = PInvoke.SHParseDisplayName(folderPath, null, out pidlFolder, 0, null);
773+
if (hrFolder.Failed) throw new COMException("Failed to parse folder path", hrFolder);
774+
775+
var hrFile = PInvoke.SHParseDisplayName(filePath, null, out pidlFile, 0, null);
776+
if (hrFile.Failed) throw new COMException("Failed to parse file path", hrFile);
777+
778+
var hrSelect = PInvoke.SHOpenFolderAndSelectItems(pidlFolder, 1, &pidlFile, 0);
779+
if (hrSelect.Failed) throw new COMException("Failed to open folder and select item", hrSelect);
780+
}
781+
finally
782+
{
783+
if (pidlFile != null) PInvoke.CoTaskMemFree(pidlFile);
784+
if (pidlFolder != null) PInvoke.CoTaskMemFree(pidlFolder);
785+
}
786+
}
787+
788+
#endregion
756789
}
757790
}

Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,11 @@ public interface IPublicAPI
8888
/// Show the MainWindow when hiding
8989
/// </summary>
9090
void ShowMainWindow();
91+
92+
/// <summary>
93+
/// Focus the query text box in the main window
94+
/// </summary>
95+
void FocusQueryTextBox();
9196

9297
/// <summary>
9398
/// Hide MainWindow

Flow.Launcher/App.xaml.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public partial class App : IDisposable, ISingleInstanceApp
3232
#region Public Properties
3333

3434
public static IPublicAPI API { get; private set; }
35-
public static bool Exiting => _mainWindow.CanClose;
35+
public static bool LoadingOrExiting => _mainWindow == null || _mainWindow.CanClose;
3636

3737
#endregion
3838

@@ -98,6 +98,10 @@ public App()
9898
.AddTransient<SettingsPanePluginStoreViewModel>()
9999
.AddTransient<SettingsPaneProxyViewModel>()
100100
.AddTransient<SettingsPaneThemeViewModel>()
101+
// Use transient instance for dialog view models because
102+
// settings will change and we need to recreate them
103+
.AddTransient<SelectBrowserViewModel>()
104+
.AddTransient<SelectFileManagerViewModel>()
101105
).Build();
102106
Ioc.Default.ConfigureServices(host.Services);
103107
}

Flow.Launcher/HotkeyControl.xaml.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ public enum HotkeyType
100100
PreviewHotkey,
101101
OpenContextMenuHotkey,
102102
SettingWindowHotkey,
103+
OpenHistoryHotkey,
103104
CycleHistoryUpHotkey,
104105
CycleHistoryDownHotkey,
105106
SelectPrevPageHotkey,
@@ -130,6 +131,7 @@ public string Hotkey
130131
HotkeyType.PreviewHotkey => _settings.PreviewHotkey,
131132
HotkeyType.OpenContextMenuHotkey => _settings.OpenContextMenuHotkey,
132133
HotkeyType.SettingWindowHotkey => _settings.SettingWindowHotkey,
134+
HotkeyType.OpenHistoryHotkey => _settings.OpenHistoryHotkey,
133135
HotkeyType.CycleHistoryUpHotkey => _settings.CycleHistoryUpHotkey,
134136
HotkeyType.CycleHistoryDownHotkey => _settings.CycleHistoryDownHotkey,
135137
HotkeyType.SelectPrevPageHotkey => _settings.SelectPrevPageHotkey,
@@ -166,6 +168,9 @@ public string Hotkey
166168
case HotkeyType.SettingWindowHotkey:
167169
_settings.SettingWindowHotkey = value;
168170
break;
171+
case HotkeyType.OpenHistoryHotkey:
172+
_settings.OpenHistoryHotkey = value;
173+
break;
169174
case HotkeyType.CycleHistoryUpHotkey:
170175
_settings.CycleHistoryUpHotkey = value;
171176
break;

Flow.Launcher/Languages/ar.xaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,13 +371,16 @@
371371

372372
<!-- FileManager Setting Dialog -->
373373
<system:String x:Key="fileManagerWindow">اختر مدير الملفات</system:String>
374+
<system:String x:Key="fileManager_learnMore">Learn more</system:String>
374375
<system:String x:Key="fileManager_tips">يرجى تحديد موقع ملف مدير الملفات الذي تستخدمه وإضافة الحجج حسب الحاجة. يمثل &quot;%d&quot; مسار الدليل المفتوح، ويستخدمه الحقل &quot;الحجة للمجلد&quot; للأوامر التي تفتح أدلة محددة. يمثل &quot;%f&quot; مسار الملف المفتوح، ويستخدمه الحقل &quot;الحجة للملف&quot; للأوامر التي تفتح ملفات محددة.</system:String>
375376
<system:String x:Key="fileManager_tips2">على سبيل المثال، إذا كان مدير الملفات يستخدم أمرًا مثل &quot;totalcmd.exe /A c:\windows&quot; لفتح دليل c:\windows، فإن مسار مدير الملفات سيكون totalcmd.exe، وحجة المجلد ستكون /A &quot;%d&quot;. قد تحتاج بعض مديري الملفات مثل QTTabBar فقط إلى توفير مسار، في هذه الحالة استخدم &quot;%d&quot; كمسار مدير الملفات واترك باقي الحقول فارغة.</system:String>
376377
<system:String x:Key="fileManager_name">مدير الملفات</system:String>
377378
<system:String x:Key="fileManager_profile_name">اسم الملف الشخصي</system:String>
378379
<system:String x:Key="fileManager_path">مسار مدير الملفات</system:String>
379380
<system:String x:Key="fileManager_directory_arg">حجة للمجلد</system:String>
380381
<system:String x:Key="fileManager_file_arg">حجة للملف</system:String>
382+
<system:String x:Key="fileManagerPathNotFound">The file manager '{0}' could not be located at '{1}'. Would you like to continue?</system:String>
383+
<system:String x:Key="fileManagerPathError">File Manager Path Error</system:String>
381384

382385
<!-- DefaultBrowser Setting Dialog -->
383386
<system:String x:Key="defaultBrowserTitle">متصفح الويب الافتراضي</system:String>
@@ -469,6 +472,14 @@
469472
<system:String x:Key="reportWindow_upload_log">1. Upload log file: {0}</system:String>
470473
<system:String x:Key="reportWindow_copy_below">2. Copy below exception message</system:String>
471474

475+
<!-- File Open Error -->
476+
<system:String x:Key="fileManagerNotFoundTitle">File Manager Error</system:String>
477+
<system:String x:Key="fileManagerNotFound">
478+
The specified file manager could not be found. Please check the Custom File Manager setting under Settings &gt; General.
479+
</system:String>
480+
<system:String x:Key="errorTitle">خطأ</system:String>
481+
<system:String x:Key="folderOpenError">An error occurred while opening the folder. {0}</system:String>
482+
472483
<!-- General Notice -->
473484
<system:String x:Key="pleaseWait">يرجى الانتظار...</system:String>
474485

Flow.Launcher/Languages/cs.xaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,13 +371,16 @@
371371

372372
<!-- FileManager Setting Dialog -->
373373
<system:String x:Key="fileManagerWindow">Vybrat správce souborů</system:String>
374+
<system:String x:Key="fileManager_learnMore">Learn more</system:String>
374375
<system:String x:Key="fileManager_tips">Please specify the file location of the file manager you using and add arguments as required. The &quot;%d&quot; represents the directory path to open for, used by the Arg for Folder field and for commands opening specific directories. The &quot;%f&quot; represents the file path to open for, used by the Arg for File field and for commands opening specific files.</system:String>
375376
<system:String x:Key="fileManager_tips2">For example, if the file manager uses a command such as &quot;totalcmd.exe /A c:\windows&quot; to open the c:\windows directory, the File Manager Path will be totalcmd.exe, and the Arg For Folder will be /A &quot;%d&quot;. Certain file managers like QTTabBar may just require a path to be supplied, in this instance use &quot;%d&quot; as the File Manager Path and leave the rest of the fileds blank.</system:String>
376377
<system:String x:Key="fileManager_name">Správce souborů</system:String>
377378
<system:String x:Key="fileManager_profile_name">Jméno profilu</system:String>
378379
<system:String x:Key="fileManager_path">Cesta k správci souborů</system:String>
379380
<system:String x:Key="fileManager_directory_arg">Argumenty pro složku</system:String>
380381
<system:String x:Key="fileManager_file_arg">Argumenty pro Soubor</system:String>
382+
<system:String x:Key="fileManagerPathNotFound">The file manager '{0}' could not be located at '{1}'. Would you like to continue?</system:String>
383+
<system:String x:Key="fileManagerPathError">File Manager Path Error</system:String>
381384

382385
<!-- DefaultBrowser Setting Dialog -->
383386
<system:String x:Key="defaultBrowserTitle">Výchozí prohlížeč</system:String>
@@ -469,6 +472,14 @@ Pokud před zkratku při zadávání přidáte znak &quot;@&quot;, bude odpovíd
469472
<system:String x:Key="reportWindow_upload_log">1. Upload log file: {0}</system:String>
470473
<system:String x:Key="reportWindow_copy_below">2. Copy below exception message</system:String>
471474

475+
<!-- File Open Error -->
476+
<system:String x:Key="fileManagerNotFoundTitle">File Manager Error</system:String>
477+
<system:String x:Key="fileManagerNotFound">
478+
The specified file manager could not be found. Please check the Custom File Manager setting under Settings &gt; General.
479+
</system:String>
480+
<system:String x:Key="errorTitle">Chyba</system:String>
481+
<system:String x:Key="folderOpenError">An error occurred while opening the folder. {0}</system:String>
482+
472483
<!-- General Notice -->
473484
<system:String x:Key="pleaseWait">Počkejte prosím...</system:String>
474485

Flow.Launcher/Languages/da.xaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,13 +371,16 @@
371371

372372
<!-- FileManager Setting Dialog -->
373373
<system:String x:Key="fileManagerWindow">Select File Manager</system:String>
374+
<system:String x:Key="fileManager_learnMore">Learn more</system:String>
374375
<system:String x:Key="fileManager_tips">Please specify the file location of the file manager you using and add arguments as required. The &quot;%d&quot; represents the directory path to open for, used by the Arg for Folder field and for commands opening specific directories. The &quot;%f&quot; represents the file path to open for, used by the Arg for File field and for commands opening specific files.</system:String>
375376
<system:String x:Key="fileManager_tips2">For example, if the file manager uses a command such as &quot;totalcmd.exe /A c:\windows&quot; to open the c:\windows directory, the File Manager Path will be totalcmd.exe, and the Arg For Folder will be /A &quot;%d&quot;. Certain file managers like QTTabBar may just require a path to be supplied, in this instance use &quot;%d&quot; as the File Manager Path and leave the rest of the fileds blank.</system:String>
376377
<system:String x:Key="fileManager_name">Filhåndtering</system:String>
377378
<system:String x:Key="fileManager_profile_name">Profilnavn</system:String>
378379
<system:String x:Key="fileManager_path">Sti til filhåndtering</system:String>
379380
<system:String x:Key="fileManager_directory_arg">Arg for mappe</system:String>
380381
<system:String x:Key="fileManager_file_arg">Arg for fil</system:String>
382+
<system:String x:Key="fileManagerPathNotFound">The file manager '{0}' could not be located at '{1}'. Would you like to continue?</system:String>
383+
<system:String x:Key="fileManagerPathError">File Manager Path Error</system:String>
381384

382385
<!-- DefaultBrowser Setting Dialog -->
383386
<system:String x:Key="defaultBrowserTitle">Default Web Browser</system:String>
@@ -469,6 +472,14 @@ If you add an '@' prefix while inputting a shortcut, it matches any position in
469472
<system:String x:Key="reportWindow_upload_log">1. Upload log file: {0}</system:String>
470473
<system:String x:Key="reportWindow_copy_below">2. Copy below exception message</system:String>
471474

475+
<!-- File Open Error -->
476+
<system:String x:Key="fileManagerNotFoundTitle">File Manager Error</system:String>
477+
<system:String x:Key="fileManagerNotFound">
478+
The specified file manager could not be found. Please check the Custom File Manager setting under Settings &gt; General.
479+
</system:String>
480+
<system:String x:Key="errorTitle">Error</system:String>
481+
<system:String x:Key="folderOpenError">An error occurred while opening the folder. {0}</system:String>
482+
472483
<!-- General Notice -->
473484
<system:String x:Key="pleaseWait">Please wait...</system:String>
474485

0 commit comments

Comments
 (0)