mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Merge remote-tracking branch 'upstream/dev' into LazyLoadPreview
This commit is contained in:
commit
24349d5072
7 changed files with 60 additions and 74 deletions
|
|
@ -64,7 +64,6 @@
|
|||
<TextBlock
|
||||
Grid.Column="0"
|
||||
Margin="0,0,0,0"
|
||||
FontFamily="Segoe UI"
|
||||
FontSize="20"
|
||||
FontWeight="SemiBold"
|
||||
Text="{DynamicResource customQueryShortcut}"
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using Flow.Launcher.Infrastructure.Hotkey;
|
||||
using Flow.Launcher.Infrastructure.Hotkey;
|
||||
using Flow.Launcher.Infrastructure.UserSettings;
|
||||
using System;
|
||||
using NHotkey;
|
||||
|
|
@ -25,7 +25,7 @@ namespace Flow.Launcher.Helper
|
|||
|
||||
internal static void OnToggleHotkey(object sender, HotkeyEventArgs args)
|
||||
{
|
||||
if (!mainViewModel.ShouldIgnoreHotkeys() && !mainViewModel.GameModeStatus)
|
||||
if (!mainViewModel.ShouldIgnoreHotkeys())
|
||||
mainViewModel.ToggleFlowLauncher();
|
||||
}
|
||||
|
||||
|
|
@ -74,7 +74,7 @@ namespace Flow.Launcher.Helper
|
|||
{
|
||||
SetHotkey(hotkey.Hotkey, (s, e) =>
|
||||
{
|
||||
if (mainViewModel.ShouldIgnoreHotkeys() || mainViewModel.GameModeStatus)
|
||||
if (mainViewModel.ShouldIgnoreHotkeys())
|
||||
return;
|
||||
|
||||
mainViewModel.Show();
|
||||
|
|
|
|||
|
|
@ -85,14 +85,10 @@
|
|||
Key="O"
|
||||
Command="{Binding LoadContextMenuCommand}"
|
||||
Modifiers="Ctrl" />
|
||||
<KeyBinding Key="Right" Command="{Binding LoadContextMenuCommand}" />
|
||||
<KeyBinding Key="Left" Command="{Binding EscCommand}" />
|
||||
<KeyBinding
|
||||
Key="H"
|
||||
Command="{Binding LoadHistoryCommand}"
|
||||
Modifiers="Ctrl" />
|
||||
<KeyBinding Key="Right" Command="{Binding LoadContextMenuCommand}" />
|
||||
<KeyBinding Key="Left" Command="{Binding EscCommand}" />
|
||||
<KeyBinding
|
||||
Key="OemCloseBrackets"
|
||||
Command="{Binding IncreaseWidthCommand}"
|
||||
|
|
@ -180,6 +176,10 @@
|
|||
Command="{Binding OpenResultCommand}"
|
||||
CommandParameter="9"
|
||||
Modifiers="{Binding OpenResultCommandModifiers}" />
|
||||
<KeyBinding
|
||||
Key="F12"
|
||||
Command="{Binding ToggleGameModeCommand}"
|
||||
Modifiers="Ctrl"/>
|
||||
<KeyBinding
|
||||
Key="{Binding TogglePreviewHotkey}"
|
||||
Command="{Binding TogglePreviewCommand}"/>
|
||||
|
|
|
|||
|
|
@ -70,6 +70,7 @@ namespace Flow.Launcher
|
|||
_viewModel.ResultCopy(QueryTextBox.SelectedText);
|
||||
}
|
||||
}
|
||||
|
||||
private async void OnClosing(object sender, CancelEventArgs e)
|
||||
{
|
||||
_settings.WindowTop = Top;
|
||||
|
|
@ -100,6 +101,7 @@ namespace Flow.Launcher
|
|||
// since the default main window visibility is visible
|
||||
// so we need set focus during startup
|
||||
QueryTextBox.Focus();
|
||||
|
||||
_viewModel.PropertyChanged += (o, e) =>
|
||||
{
|
||||
switch (e.PropertyName)
|
||||
|
|
@ -168,9 +170,12 @@ namespace Flow.Launcher
|
|||
_viewModel.QueryTextCursorMovedToEnd = false;
|
||||
}
|
||||
break;
|
||||
|
||||
case nameof(MainViewModel.GameModeStatus):
|
||||
_notifyIcon.Icon = _viewModel.GameModeStatus ? Properties.Resources.gamemode : Properties.Resources.app;
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
_settings.PropertyChanged += (o, e) =>
|
||||
{
|
||||
switch (e.PropertyName)
|
||||
|
|
@ -285,7 +290,7 @@ namespace Flow.Launcher
|
|||
};
|
||||
|
||||
open.Click += (o, e) => _viewModel.ToggleFlowLauncher();
|
||||
gamemode.Click += (o, e) => ToggleGameMode();
|
||||
gamemode.Click += (o, e) => _viewModel.ToggleGameMode();
|
||||
positionreset.Click += (o, e) => PositionReset();
|
||||
settings.Click += (o, e) => App.API.OpenSettingDialog();
|
||||
exit.Click += (o, e) => Close();
|
||||
|
|
@ -324,24 +329,13 @@ namespace Flow.Launcher
|
|||
OpenWelcomeWindow();
|
||||
}
|
||||
}
|
||||
|
||||
private void OpenWelcomeWindow()
|
||||
{
|
||||
var WelcomeWindow = new WelcomeWindow(_settings);
|
||||
WelcomeWindow.Show();
|
||||
}
|
||||
private void ToggleGameMode()
|
||||
{
|
||||
if (_viewModel.GameModeStatus)
|
||||
{
|
||||
_notifyIcon.Icon = Properties.Resources.app;
|
||||
_viewModel.GameModeStatus = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
_notifyIcon.Icon = Properties.Resources.gamemode;
|
||||
_viewModel.GameModeStatus = true;
|
||||
}
|
||||
}
|
||||
|
||||
private async void PositionReset()
|
||||
{
|
||||
_viewModel.Show();
|
||||
|
|
@ -349,6 +343,7 @@ namespace Flow.Launcher
|
|||
Left = HorizonCenter();
|
||||
Top = VerticalCenter();
|
||||
}
|
||||
|
||||
private void InitProgressbarAnimation()
|
||||
{
|
||||
var da = new DoubleAnimation(ProgressBar.X2, ActualWidth + 100, new Duration(new TimeSpan(0, 0, 0, 0, 1600)));
|
||||
|
|
@ -361,6 +356,7 @@ namespace Flow.Launcher
|
|||
_viewModel.ProgressBarVisibility = Visibility.Hidden;
|
||||
isProgressBarStoryboardPaused = true;
|
||||
}
|
||||
|
||||
public void WindowAnimator()
|
||||
{
|
||||
if (_animating)
|
||||
|
|
@ -475,7 +471,6 @@ namespace Flow.Launcher
|
|||
App.API.OpenSettingDialog();
|
||||
}
|
||||
|
||||
|
||||
private async void OnDeactivated(object sender, EventArgs e)
|
||||
{
|
||||
_settings.WindowLeft = Left;
|
||||
|
|
@ -596,12 +591,6 @@ namespace Flow.Launcher
|
|||
e.Handled = true;
|
||||
}
|
||||
break;
|
||||
case Key.F12:
|
||||
if (specialKeyState.CtrlPressed)
|
||||
{
|
||||
ToggleGameMode();
|
||||
}
|
||||
break;
|
||||
case Key.Back:
|
||||
if (specialKeyState.CtrlPressed)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ using System.Linq;
|
|||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
using Flow.Launcher.Core.Plugin;
|
||||
using Flow.Launcher.Core.Resource;
|
||||
using Flow.Launcher.Helper;
|
||||
|
|
@ -24,7 +23,6 @@ using System.IO;
|
|||
using System.Collections.Specialized;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using System.Globalization;
|
||||
using System.Windows.Threading;
|
||||
|
||||
namespace Flow.Launcher.ViewModel
|
||||
{
|
||||
|
|
@ -32,8 +30,6 @@ namespace Flow.Launcher.ViewModel
|
|||
{
|
||||
#region Private Fields
|
||||
|
||||
private const string DefaultOpenResultModifiers = "Alt";
|
||||
|
||||
private bool _isQueryRunning;
|
||||
private Query _lastQuery;
|
||||
private string _queryTextBeforeLeaveResults;
|
||||
|
|
@ -74,6 +70,9 @@ namespace Flow.Launcher.ViewModel
|
|||
case nameof(Settings.AlwaysStartEn):
|
||||
OnPropertyChanged(nameof(StartWithEnglishMode));
|
||||
break;
|
||||
case nameof(Settings.OpenResultModifiers):
|
||||
OnPropertyChanged(nameof(OpenResultCommandModifiers));
|
||||
break;
|
||||
case nameof(Settings.PreviewHotkey):
|
||||
OnPropertyChanged(nameof(TogglePreviewHotkey));
|
||||
break;
|
||||
|
|
@ -114,9 +113,7 @@ namespace Flow.Launcher.ViewModel
|
|||
|
||||
RegisterViewUpdate();
|
||||
RegisterResultsUpdatedEvent();
|
||||
RegisterClockAndDateUpdateAsync();
|
||||
|
||||
SetOpenResultModifiers(); // TODO?
|
||||
_ = RegisterClockAndDateUpdateAsync();
|
||||
}
|
||||
|
||||
private void RegisterViewUpdate()
|
||||
|
|
@ -148,8 +145,6 @@ namespace Flow.Launcher.ViewModel
|
|||
Log.Error("MainViewModel", "Unexpected ResultViewUpdate ends");
|
||||
}
|
||||
|
||||
;
|
||||
|
||||
void continueAction(Task t)
|
||||
{
|
||||
#if DEBUG
|
||||
|
|
@ -193,6 +188,7 @@ namespace Flow.Launcher.ViewModel
|
|||
await PluginManager.ReloadDataAsync().ConfigureAwait(false);
|
||||
Notification.Show(InternationalizationManager.Instance.GetTranslation("success"), InternationalizationManager.Instance.GetTranslation("completedSuccessfully"));
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
private void LoadHistory()
|
||||
{
|
||||
|
|
@ -206,6 +202,7 @@ namespace Flow.Launcher.ViewModel
|
|||
SelectedResults = Results;
|
||||
}
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
private void LoadContextMenu()
|
||||
{
|
||||
|
|
@ -221,6 +218,7 @@ namespace Flow.Launcher.ViewModel
|
|||
SelectedResults = Results;
|
||||
}
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
private void Backspace(object index)
|
||||
{
|
||||
|
|
@ -233,6 +231,7 @@ namespace Flow.Launcher.ViewModel
|
|||
|
||||
ChangeQueryText($"{actionKeyword}{path}");
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
private void AutocompleteQuery()
|
||||
{
|
||||
|
|
@ -259,6 +258,7 @@ namespace Flow.Launcher.ViewModel
|
|||
ChangeQueryText(autoCompleteText);
|
||||
}
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
private async Task OpenResultAsync(string index)
|
||||
{
|
||||
|
|
@ -293,6 +293,7 @@ namespace Flow.Launcher.ViewModel
|
|||
SelectedResults = Results;
|
||||
}
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
private void OpenSetting()
|
||||
{
|
||||
|
|
@ -310,6 +311,7 @@ namespace Flow.Launcher.ViewModel
|
|||
{
|
||||
SelectedResults.SelectFirstResult();
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
private void SelectPrevPage()
|
||||
{
|
||||
|
|
@ -321,11 +323,13 @@ namespace Flow.Launcher.ViewModel
|
|||
{
|
||||
SelectedResults.SelectNextPage();
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
private void SelectPrevItem()
|
||||
{
|
||||
SelectedResults.SelectPrevResult();
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
private void SelectNextItem()
|
||||
{
|
||||
|
|
@ -345,6 +349,12 @@ namespace Flow.Launcher.ViewModel
|
|||
}
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
public void ToggleGameMode()
|
||||
{
|
||||
GameModeStatus = !GameModeStatus;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ViewModel Properties
|
||||
|
|
@ -373,7 +383,7 @@ namespace Flow.Launcher.ViewModel
|
|||
|
||||
public ResultsViewModel History { get; private set; }
|
||||
|
||||
public bool GameModeStatus { get; set; }
|
||||
public bool GameModeStatus { get; set; } = false;
|
||||
|
||||
private string _queryText;
|
||||
public string QueryText
|
||||
|
|
@ -387,7 +397,6 @@ namespace Flow.Launcher.ViewModel
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
[RelayCommand]
|
||||
private void IncreaseWidth()
|
||||
{
|
||||
|
|
@ -571,7 +580,7 @@ namespace Flow.Launcher.ViewModel
|
|||
|
||||
public string PluginIconPath { get; set; } = null;
|
||||
|
||||
public string OpenResultCommandModifiers { get; private set; }
|
||||
public string OpenResultCommandModifiers => Settings.OpenResultModifiers;
|
||||
|
||||
public string TogglePreviewHotkey => Settings.PreviewHotkey; // TODO: is hotkey combo possible?
|
||||
|
||||
|
|
@ -585,6 +594,8 @@ namespace Flow.Launcher.ViewModel
|
|||
|
||||
#endregion
|
||||
|
||||
#region Query
|
||||
|
||||
public void Query()
|
||||
{
|
||||
if (SelectedIsFromQueryResults())
|
||||
|
|
@ -938,12 +949,9 @@ namespace Flow.Launcher.ViewModel
|
|||
return selected;
|
||||
}
|
||||
|
||||
#region Hotkey
|
||||
#endregion
|
||||
|
||||
private void SetOpenResultModifiers()
|
||||
{
|
||||
OpenResultCommandModifiers = Settings.OpenResultModifiers ?? DefaultOpenResultModifiers;
|
||||
}
|
||||
#region Hotkey
|
||||
|
||||
public void ToggleFlowLauncher()
|
||||
{
|
||||
|
|
@ -998,18 +1006,15 @@ namespace Flow.Launcher.ViewModel
|
|||
MainWindowVisibility = Visibility.Collapsed;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Checks if Flow Launcher should ignore any hotkeys
|
||||
/// </summary>
|
||||
public bool ShouldIgnoreHotkeys()
|
||||
{
|
||||
return Settings.IgnoreHotkeysOnFullscreen && WindowsInteropHelper.IsWindowFullscreen();
|
||||
return Settings.IgnoreHotkeysOnFullscreen && WindowsInteropHelper.IsWindowFullscreen() || GameModeStatus;
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public Methods
|
||||
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@
|
|||
|
||||
<!-- Context menu items -->
|
||||
<system:String x:Key="plugin_explorer_copypath">Copy path</system:String>
|
||||
<system:String x:Key="plugin_explorer_copypath_subtitle">Copy path of current result to clipboard</system:String>
|
||||
<system:String x:Key="plugin_explorer_copypath_subtitle">Copy path of current item to clipboard</system:String>
|
||||
<system:String x:Key="plugin_explorer_copyfilefolder">Copy</system:String>
|
||||
<system:String x:Key="plugin_explorer_copyfile_subtitle">Copy current file to clipboard</system:String>
|
||||
<system:String x:Key="plugin_explorer_copyfolder_subtitle">Copy current folder to clipboard</system:String>
|
||||
|
|
@ -78,7 +78,7 @@
|
|||
<system:String x:Key="plugin_explorer_runasdifferentuser">Run as different user</system:String>
|
||||
<system:String x:Key="plugin_explorer_runasdifferentuser_subtitle">Run the selected using a different user account</system:String>
|
||||
<system:String x:Key="plugin_explorer_opencontainingfolder">Open containing folder</system:String>
|
||||
<system:String x:Key="plugin_explorer_opencontainingfolder_subtitle">Opens the location that contains the item</system:String>
|
||||
<system:String x:Key="plugin_explorer_opencontainingfolder_subtitle">Opens the location that contains current item</system:String>
|
||||
<system:String x:Key="plugin_explorer_openwitheditor">Open With Editor:</system:String>
|
||||
<system:String x:Key="plugin_explorer_openwitheditor_error">Failed to open file at {0} with Editor {1} at {2}</system:String>
|
||||
<system:String x:Key="plugin_explorer_openwithshell">Open With Shell:</system:String>
|
||||
|
|
@ -89,7 +89,7 @@
|
|||
<system:String x:Key="plugin_explorer_openindexingoptions_subtitle">Manage indexed files and folders</system:String>
|
||||
<system:String x:Key="plugin_explorer_openindexingoptions_errormsg">Failed to open Windows Indexing Options</system:String>
|
||||
<system:String x:Key="plugin_explorer_add_to_quickaccess_title">Add to Quick Access</system:String>
|
||||
<system:String x:Key="plugin_explorer_add_to_quickaccess_subtitle">Add current result to Quick Access</system:String>
|
||||
<system:String x:Key="plugin_explorer_add_to_quickaccess_subtitle">Add current item to Quick Access</system:String>
|
||||
<system:String x:Key="plugin_explorer_addfilefoldersuccess">Successfully Added</system:String>
|
||||
<system:String x:Key="plugin_explorer_addfilefoldersuccess_detail">Successfully added to Quick Access</system:String>
|
||||
<system:String x:Key="plugin_explorer_removefilefoldersuccess">Successfully Removed</system:String>
|
||||
|
|
@ -97,8 +97,13 @@
|
|||
<system:String x:Key="plugin_explorer_contextmenu_titletooltip">Add to Quick Access so it can be opened with Explorer's Search Activation action keyword</system:String>
|
||||
<system:String x:Key="plugin_explorer_contextmenu_remove_titletooltip">Remove from Quick Access</system:String>
|
||||
<system:String x:Key="plugin_explorer_remove_from_quickaccess_title">Remove from Quick Access</system:String>
|
||||
<system:String x:Key="plugin_explorer_remove_from_quickaccess_subtitle">Remove current result from Quick Access</system:String>
|
||||
<system:String x:Key="plugin_explorer_remove_from_quickaccess_subtitle">Remove current item from Quick Access</system:String>
|
||||
<system:String x:Key="plugin_explorer_show_contextmenu_title">Show Windows Context Menu</system:String>
|
||||
|
||||
<!-- Special Results-->
|
||||
<system:String x:Key="plugin_explorer_diskfreespace">{0} free of {1}</system:String>
|
||||
<system:String x:Key="plugin_explorer_openresultfolder">Open in Default File Manager</system:String>
|
||||
<system:String x:Key="plugin_explorer_openresultfolder_subtitle">Use '>' to search in this directory, '*' to search for file extensions or '>*' to combine both searches.</system:String>
|
||||
|
||||
<!-- Everything -->
|
||||
<system:String x:Key="flowlauncher_plugin_everything_sdk_issue">Failed to load Everything SDK</system:String>
|
||||
|
|
@ -130,6 +135,6 @@
|
|||
<system:String x:Key="flowlauncher_plugin_everything_run_service">Click here to start it</system:String>
|
||||
<system:String x:Key="flowlauncher_plugin_everything_installing_select">Unable to find an Everything installation, would you like to manually select a location?{0}{0}Click no and Everything will be automatically installed for you</system:String>
|
||||
<system:String x:Key="flowlauncher_plugin_everything_enable_content_search">Do you want to enable content search for Everything?</system:String>
|
||||
<system:String x:Key="flowlauncher_plugin_everything_enable_content_search_tips">"It can be very slow without index (which is only supported in Everything v1.5+)"</system:String>
|
||||
<system:String x:Key="flowlauncher_plugin_everything_enable_content_search_tips">It can be very slow without index (which is only supported in Everything v1.5+)</system:String>
|
||||
|
||||
</ResourceDictionary>
|
||||
|
|
|
|||
|
|
@ -96,7 +96,9 @@ namespace Flow.Launcher.Plugin.Explorer.Search
|
|||
var driveLetter = path[..1].ToUpper();
|
||||
var driveName = driveLetter + ":\\";
|
||||
DriveInfo drv = new DriveInfo(driveLetter);
|
||||
var subtitle = ToReadableSize(drv.AvailableFreeSpace, 2) + " free of " + ToReadableSize(drv.TotalSize, 2);
|
||||
var freespace = ToReadableSize(drv.AvailableFreeSpace, 2);
|
||||
var totalspace = ToReadableSize(drv.TotalSize, 2);
|
||||
var subtitle = string.Format(Context.API.GetTranslation("plugin_explorer_diskfreespace"), freespace, totalspace);
|
||||
double usingSize = (Convert.ToDouble(drv.TotalSize) - Convert.ToDouble(drv.AvailableFreeSpace)) / Convert.ToDouble(drv.TotalSize) * 100;
|
||||
|
||||
int? progressValue = Convert.ToInt32(usingSize);
|
||||
|
|
@ -170,25 +172,11 @@ namespace Flow.Launcher.Plugin.Explorer.Search
|
|||
// Path passed from PathSearchAsync ends with Constants.DirectorySeperator ('\'), need to remove the seperator
|
||||
// so it's consistent with folder results returned by index search which does not end with one
|
||||
var folderPath = path.TrimEnd(Constants.DirectorySeperator);
|
||||
|
||||
var folderName = folderPath.TrimEnd(Constants.DirectorySeperator).Split(new[]
|
||||
{
|
||||
Path.DirectorySeparatorChar
|
||||
}, StringSplitOptions.None).Last();
|
||||
|
||||
var title = $"Open {folderName}";
|
||||
|
||||
var subtitleFolderName = folderName;
|
||||
|
||||
// ie. max characters can be displayed without subtitle cutting off: "Program Files (x86)"
|
||||
if (folderName.Length > 19)
|
||||
subtitleFolderName = "the directory";
|
||||
|
||||
return new Result
|
||||
{
|
||||
Title = title,
|
||||
SubTitle = $"Use > to search within {subtitleFolderName}, " +
|
||||
$"* to search for file extensions or >* to combine both searches.",
|
||||
Title = Context.API.GetTranslation("plugin_explorer_openresultfolder"),
|
||||
SubTitle = Context.API.GetTranslation("plugin_explorer_openresultfolder_subtitle"),
|
||||
AutoCompleteText = GetPathWithActionKeyword(folderPath, ResultType.Folder, actionKeyword),
|
||||
IcoPath = folderPath,
|
||||
Score = 500,
|
||||
|
|
|
|||
Loading…
Reference in a new issue