Skip to content

Commit 8ef3a8f

Browse files
authored
Merge branch 'dev' into late_clear
2 parents 9d972e6 + 43227d8 commit 8ef3a8f

File tree

10 files changed

+40
-24
lines changed

10 files changed

+40
-24
lines changed

Flow.Launcher.Infrastructure/UserSettings/Settings.cs

Lines changed: 3 additions & 1 deletion
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

@@ -426,6 +427,8 @@ public List<RegisteredHotkeyData> RegisteredHotkeys
426427
list.Add(new(SelectPrevItemHotkey2, "SelectPrevItemHotkey", () => SelectPrevItemHotkey2 = ""));
427428
if (!string.IsNullOrEmpty(SettingWindowHotkey))
428429
list.Add(new(SettingWindowHotkey, "SettingWindowHotkey", () => SettingWindowHotkey = ""));
430+
if (!string.IsNullOrEmpty(OpenHistoryHotkey))
431+
list.Add(new(OpenHistoryHotkey, "OpenHistoryHotkey", () => OpenHistoryHotkey = ""));
429432
if (!string.IsNullOrEmpty(OpenContextMenuHotkey))
430433
list.Add(new(OpenContextMenuHotkey, "OpenContextMenuHotkey", () => OpenContextMenuHotkey = ""));
431434
if (!string.IsNullOrEmpty(SelectNextPageHotkey))
@@ -461,7 +464,6 @@ private List<RegisteredHotkeyData> FixedHotkeys()
461464
new("Alt+Home", "HotkeySelectFirstResult"),
462465
new("Alt+End", "HotkeySelectLastResult"),
463466
new("Ctrl+R", "HotkeyRequery"),
464-
new("Ctrl+H", "ToggleHistoryHotkey"),
465467
new("Ctrl+OemCloseBrackets", "QuickWidthHotkey"),
466468
new("Ctrl+OemOpenBrackets", "QuickWidthHotkey"),
467469
new("Ctrl+OemPlus", "QuickHeightHotkey"),

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/MainWindow.xaml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,6 @@
6464
Key="R"
6565
Command="{Binding ReQueryCommand}"
6666
Modifiers="Ctrl" />
67-
<KeyBinding
68-
Key="H"
69-
Command="{Binding LoadHistoryCommand}"
70-
Modifiers="Ctrl" />
7167
<KeyBinding
7268
Key="OemCloseBrackets"
7369
Command="{Binding IncreaseWidthCommand}"
@@ -191,6 +187,10 @@
191187
Key="{Binding SettingWindowHotkey, Converter={StaticResource StringToKeyBindingConverter}, ConverterParameter='key'}"
192188
Command="{Binding OpenSettingCommand}"
193189
Modifiers="{Binding SettingWindowHotkey, Converter={StaticResource StringToKeyBindingConverter}, ConverterParameter='modifiers'}" />
190+
<KeyBinding
191+
Key="{Binding OpenHistoryHotkey, Converter={StaticResource StringToKeyBindingConverter}, ConverterParameter='key'}"
192+
Command="{Binding LoadHistoryCommand}"
193+
Modifiers="{Binding OpenHistoryHotkey, Converter={StaticResource StringToKeyBindingConverter}, ConverterParameter='modifiers'}" />
194194
<KeyBinding
195195
Key="{Binding OpenContextMenuHotkey, Converter={StaticResource StringToKeyBindingConverter}, ConverterParameter='key'}"
196196
Command="{Binding LoadContextMenuCommand}"
@@ -359,7 +359,7 @@
359359
<MultiDataTrigger>
360360
<MultiDataTrigger.Conditions>
361361
<Condition Binding="{Binding ElementName=ResultListBox, Path=Items.Count}" Value="0" />
362-
<Condition Binding="{Binding ElementName=ContextMenu, Path=Visibility}" Value="Collapsed" />
362+
<Condition Binding="{Binding ElementName=ResultContextMenu, Path=Visibility}" Value="Collapsed" />
363363
<Condition Binding="{Binding ElementName=History, Path=Visibility}" Value="Collapsed" />
364364
</MultiDataTrigger.Conditions>
365365
<MultiDataTrigger.Setters>
@@ -373,7 +373,7 @@
373373
<DataTrigger Binding="{Binding ElementName=ResultListBox, Path=Visibility}" Value="Visible">
374374
<Setter Property="Visibility" Value="Visible" />
375375
</DataTrigger>
376-
<DataTrigger Binding="{Binding ElementName=ContextMenu, Path=Visibility}" Value="Visible">
376+
<DataTrigger Binding="{Binding ElementName=ResultContextMenu, Path=Visibility}" Value="Visible">
377377
<Setter Property="Visibility" Value="Visible" />
378378
</DataTrigger>
379379
<DataTrigger Binding="{Binding ElementName=History, Path=Visibility}" Value="Visible">
@@ -419,7 +419,7 @@
419419
</ContentControl>
420420
<ContentControl>
421421
<flowlauncher:ResultListBox
422-
x:Name="ContextMenu"
422+
x:Name="ResultContextMenu"
423423
DataContext="{Binding ContextMenu}"
424424
LeftClickResultCommand="{Binding LeftClickResultCommand}"
425425
RightClickResultCommand="{Binding RightClickResultCommand}" />

Flow.Launcher/MainWindow.xaml.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -295,14 +295,14 @@ private void OnLoaded(object sender, RoutedEventArgs _)
295295
// QueryTextBox.Text change detection (modified to only work when character count is 1 or higher)
296296
QueryTextBox.TextChanged += (s, e) => UpdateClockPanelVisibility();
297297

298-
// Detecting ContextMenu.Visibility changes
298+
// Detecting ResultContextMenu.Visibility changes
299299
DependencyPropertyDescriptor
300-
.FromProperty(VisibilityProperty, typeof(ContextMenu))
301-
.AddValueChanged(ContextMenu, (s, e) => UpdateClockPanelVisibility());
300+
.FromProperty(VisibilityProperty, typeof(ResultListBox))
301+
.AddValueChanged(ResultContextMenu, (s, e) => UpdateClockPanelVisibility());
302302

303303
// Detect History.Visibility changes
304304
DependencyPropertyDescriptor
305-
.FromProperty(VisibilityProperty, typeof(StackPanel))
305+
.FromProperty(VisibilityProperty, typeof(ResultListBox))
306306
.AddValueChanged(History, (s, e) => UpdateClockPanelVisibility());
307307

308308
// Initialize query state
@@ -1016,7 +1016,7 @@ private void WindowAnimation()
10161016

10171017
private void UpdateClockPanelVisibility()
10181018
{
1019-
if (QueryTextBox == null || ContextMenu == null || History == null || ClockPanel == null)
1019+
if (QueryTextBox == null || ResultContextMenu == null || History == null || ClockPanel == null)
10201020
{
10211021
return;
10221022
}
@@ -1031,20 +1031,20 @@ private void UpdateClockPanelVisibility()
10311031
};
10321032
var animationDuration = TimeSpan.FromMilliseconds(animationLength * 2 / 3);
10331033

1034-
// ✅ Conditions for showing ClockPanel (No query input & ContextMenu, History are closed)
1034+
// ✅ Conditions for showing ClockPanel (No query input / ResultContextMenu & History are closed)
10351035
var shouldShowClock = QueryTextBox.Text.Length == 0 &&
1036-
ContextMenu.Visibility != Visibility.Visible &&
1036+
ResultContextMenu.Visibility != Visibility.Visible &&
10371037
History.Visibility != Visibility.Visible;
10381038

1039-
// ✅ 1. When ContextMenu opens, immediately set Visibility.Hidden (force hide without animation)
1040-
if (ContextMenu.Visibility == Visibility.Visible)
1039+
// ✅ 1. When ResultContextMenu opens, immediately set Visibility.Hidden (force hide without animation)
1040+
if (ResultContextMenu.Visibility == Visibility.Visible)
10411041
{
10421042
_viewModel.ClockPanelVisibility = Visibility.Hidden;
10431043
_viewModel.ClockPanelOpacity = 0.0; // Set to 0 in case Opacity animation affects it
10441044
return;
10451045
}
10461046

1047-
// ✅ 2. When ContextMenu is closed, keep it Hidden if there's text in the query (remember previous state)
1047+
// ✅ 2. When ResultContextMenu is closed, keep it Hidden if there's text in the query (remember previous state)
10481048
else if (QueryTextBox.Text.Length > 0)
10491049
{
10501050
_viewModel.ClockPanelVisibility = Visibility.Hidden;

Flow.Launcher/MessageBoxEx.xaml.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ private async Task SetImageAsync(string imageName)
160160
private void KeyEsc_OnPress(object sender, ExecutedRoutedEventArgs e)
161161
{
162162
if (_button == MessageBoxButton.YesNo)
163+
// Follow System.Windows.MessageBox behavior
163164
return;
164165
else if (_button == MessageBoxButton.OK)
165166
_result = MessageBoxResult.OK;
@@ -188,6 +189,7 @@ private void Button_Click(object sender, RoutedEventArgs e)
188189
private void Button_Cancel(object sender, RoutedEventArgs e)
189190
{
190191
if (_button == MessageBoxButton.YesNo)
192+
// Follow System.Windows.MessageBox behavior
191193
return;
192194
else if (_button == MessageBoxButton.OK)
193195
_result = MessageBoxResult.OK;

Flow.Launcher/SettingPages/Views/SettingsPaneHotkey.xaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,10 @@
8989
Title="{DynamicResource ToggleHistoryHotkey}"
9090
Icon="&#xf738;"
9191
Type="Inside">
92-
<cc:HotkeyDisplay Keys="Ctrl+H" />
92+
<flowlauncher:HotkeyControl
93+
DefaultHotkey="Ctrl+H"
94+
Type="OpenHistoryHotkey"
95+
ValidateKeyGesture="False" />
9396
</cc:Card>
9497
<cc:Card
9598
Title="{DynamicResource CopyFilePathHotkey}"

Flow.Launcher/SettingPages/Views/SettingsPaneTheme.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@
374374
IsHitTestVisible="False"
375375
Visibility="Visible" />
376376
</ContentControl>
377-
<Border x:Name="ContextMenu" Visibility="Collapsed" />
377+
<Border x:Name="ResultContextMenu" Visibility="Collapsed" />
378378
<Border x:Name="History" Visibility="Collapsed" />
379379
</Grid>
380380
</Border>

Flow.Launcher/Themes/Base.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,7 @@
479479
<MultiDataTrigger.Conditions>
480480
<!--
481481
<Condition Binding="{Binding ElementName=ResultListBox, Path=Visibility}" Value="Collapsed" />
482-
<Condition Binding="{Binding ElementName=ContextMenu, Path=Visibility}" Value="Collapsed" />-->
482+
<Condition Binding="{Binding ElementName=ResultContextMenu, Path=Visibility}" Value="Collapsed" />-->
483483
<Condition Binding="{Binding ElementName=History, Path=Visibility}" Value="Collapsed" />
484484
<Condition Binding="{Binding ElementName=ResultListBox, Path=Items.Count}" Value="0" />
485485
</MultiDataTrigger.Conditions>

Flow.Launcher/ViewModel/MainViewModel.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,9 @@ public MainViewModel()
137137
case nameof(Settings.SettingWindowHotkey):
138138
OnPropertyChanged(nameof(SettingWindowHotkey));
139139
break;
140+
case nameof(Settings.OpenHistoryHotkey):
141+
OnPropertyChanged(nameof(OpenHistoryHotkey));
142+
break;
140143
}
141144
};
142145

@@ -907,6 +910,7 @@ private static string VerifyOrSetDefaultHotkey(string hotkey, string defaultHotk
907910
public string SelectPrevPageHotkey => VerifyOrSetDefaultHotkey(Settings.SelectPrevPageHotkey, "");
908911
public string OpenContextMenuHotkey => VerifyOrSetDefaultHotkey(Settings.OpenContextMenuHotkey, "Ctrl+O");
909912
public string SettingWindowHotkey => VerifyOrSetDefaultHotkey(Settings.SettingWindowHotkey, "Ctrl+I");
913+
public string OpenHistoryHotkey => VerifyOrSetDefaultHotkey(Settings.OpenHistoryHotkey, "Ctrl+H");
910914
public string CycleHistoryUpHotkey => VerifyOrSetDefaultHotkey(Settings.CycleHistoryUpHotkey, "Alt+Up");
911915
public string CycleHistoryDownHotkey => VerifyOrSetDefaultHotkey(Settings.CycleHistoryDownHotkey, "Alt+Down");
912916

Plugins/Flow.Launcher.Plugin.Explorer/ContextMenu.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -199,10 +199,10 @@ public List<Result> LoadContextMenus(Result selectedResult)
199199
{
200200
if (Context.API.ShowMsgBox(
201201
string.Format(Context.API.GetTranslation("plugin_explorer_delete_folder_link"), record.FullPath),
202-
string.Empty,
203-
MessageBoxButton.YesNo,
202+
Context.API.GetTranslation("plugin_explorer_deletefilefolder"),
203+
MessageBoxButton.OKCancel,
204204
MessageBoxImage.Warning)
205-
== MessageBoxResult.No)
205+
== MessageBoxResult.Cancel)
206206
return false;
207207

208208
if (isFile)

0 commit comments

Comments
 (0)