Skip to content

Commit ac255ba

Browse files
committed
Add support in HotKey page
1 parent 2d25fef commit ac255ba

File tree

4 files changed

+35
-1
lines changed

4 files changed

+35
-1
lines changed

Flow.Launcher/HotkeyControl.xaml.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,8 @@ public enum HotkeyType
109109
SelectPrevItemHotkey,
110110
SelectPrevItemHotkey2,
111111
SelectNextItemHotkey,
112-
SelectNextItemHotkey2
112+
SelectNextItemHotkey2,
113+
QuickSwitchHotkey,
113114
}
114115

115116
// We can initialize settings in static field because it has been constructed in App constuctor
@@ -140,6 +141,7 @@ public string Hotkey
140141
HotkeyType.SelectPrevItemHotkey2 => _settings.SelectPrevItemHotkey2,
141142
HotkeyType.SelectNextItemHotkey => _settings.SelectNextItemHotkey,
142143
HotkeyType.SelectNextItemHotkey2 => _settings.SelectNextItemHotkey2,
144+
HotkeyType.QuickSwitchHotkey => _settings.QuickSwitchHotkey,
143145
_ => throw new System.NotImplementedException("Hotkey type not set")
144146
};
145147
}
@@ -196,6 +198,9 @@ public string Hotkey
196198
case HotkeyType.SelectNextItemHotkey2:
197199
_settings.SelectNextItemHotkey2 = value;
198200
break;
201+
case HotkeyType.QuickSwitchHotkey:
202+
_settings.QuickSwitchHotkey = value;
203+
break;
199204
default:
200205
throw new System.NotImplementedException("Hotkey type not set");
201206
}

Flow.Launcher/Languages/en.xaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,10 @@
298298
<system:String x:Key="useGlyphUI">Use Segoe Fluent Icons</system:String>
299299
<system:String x:Key="useGlyphUIEffect">Use Segoe Fluent Icons for query results where supported</system:String>
300300
<system:String x:Key="flowlauncherPressHotkey">Press Key</system:String>
301+
<system:String x:Key="quickSwitchHotkey">Quick Switch</system:String>
302+
<system:String x:Key="quickSwitchHotkeyToolTip">Enter shortcut to quickly navigate dialog path as current Explorer.</system:String>
303+
<system:String x:Key="autoQuickSwitch">Quick Switch Automatically</system:String>
304+
<system:String x:Key="autoQuickSwitchToolTip">Quick switch automatically when a navigate dialog is opened.</system:String>
301305

302306
<!-- Setting Proxy -->
303307
<system:String x:Key="proxy">HTTP Proxy</system:String>

Flow.Launcher/SettingPages/ViewModels/SettingsPaneHotkeyViewModel.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using Flow.Launcher.Helper;
55
using Flow.Launcher.Infrastructure;
66
using Flow.Launcher.Infrastructure.Hotkey;
7+
using Flow.Launcher.Infrastructure.QuickSwitch;
78
using Flow.Launcher.Infrastructure.UserSettings;
89
using Flow.Launcher.Plugin;
910

@@ -34,6 +35,12 @@ private void SetTogglingHotkey(HotkeyModel hotkey)
3435
HotKeyMapper.SetHotkey(hotkey, HotKeyMapper.OnToggleHotkey);
3536
}
3637

38+
[RelayCommand]
39+
private void SetQuickSwitchHotkey(HotkeyModel hotkey)
40+
{
41+
HotKeyMapper.SetHotkey(hotkey, QuickSwitch.OnToggleHotkey);
42+
}
43+
3744
[RelayCommand]
3845
private void CustomHotkeyDelete()
3946
{

Flow.Launcher/SettingPages/Views/SettingsPaneHotkey.xaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,24 @@
6767
</cc:Card>
6868
</cc:CardGroup>
6969

70+
<cc:CardGroup Margin="0 12 0 0">
71+
<cc:Card Title="{DynamicResource quickSwitchHotkey}" Sub="{DynamicResource quickSwitchHotkeyToolTip}">
72+
<flowlauncher:HotkeyControl
73+
ChangeHotkey="{Binding SetQuickSwitchHotkeyCommand}"
74+
DefaultHotkey="Alt+G"
75+
Type="QuickSwitchHotkey"
76+
ValidateKeyGesture="False"
77+
WindowTitle="{DynamicResource quickSwitchHotkey}" />
78+
</cc:Card>
79+
80+
<cc:Card Title="{DynamicResource autoQuickSwitch}" Sub="{DynamicResource autoQuickSwitchToolTip}">
81+
<ui:ToggleSwitch
82+
IsOn="{Binding Settings.AutoQuickSwitch}"
83+
OffContent="{DynamicResource disable}"
84+
OnContent="{DynamicResource enable}" />
85+
</cc:Card>
86+
</cc:CardGroup>
87+
7088
<cc:ExCard
7189
Title="{DynamicResource hotkeyPresets}"
7290
Margin="0 14 0 0"

0 commit comments

Comments
 (0)