Skip to content

Commit 5426be0

Browse files
committed
Add more options for quick switch
1 parent 0e7c80a commit 5426be0

File tree

4 files changed

+104
-32
lines changed

4 files changed

+104
-32
lines changed

Flow.Launcher.Infrastructure/UserSettings/Settings.cs

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -238,11 +238,14 @@ public CustomBrowserViewModel CustomBrowser
238238

239239
public bool ShowQuickSwitchWindow { get; set; } = true;
240240

241-
public QuickSwitchResultMethods OpenQuickSwitchResultMethod { get; set; } = QuickSwitchResultMethods.LeftClick;
241+
[JsonConverter(typeof(JsonStringEnumConverter))]
242+
public QuickSwitchWindowPositions QuickSwitchWindowPosition { get; set; } = QuickSwitchWindowPositions.UnderDialog;
242243

243-
public QuickSwitchFileResultMethods OpenQuickSwitchFileResultMethod { get; set; } = QuickSwitchFileResultMethods.FullPath;
244+
[JsonConverter(typeof(JsonStringEnumConverter))]
245+
public QuickSwitchResultBehaviours QuickSwitchResultBehaviour { get; set; } = QuickSwitchResultBehaviours.LeftClick;
244246

245-
public QuickSwitchWindowPositions QuickSwitchWindowPosition { get; set; } = QuickSwitchWindowPositions.UnderDialog;
247+
[JsonConverter(typeof(JsonStringEnumConverter))]
248+
public QuickSwitchFileResultBehaviours QuickSwitchFileResultBehaviour { get; set; } = QuickSwitchFileResultBehaviours.FullPath;
246249

247250
[JsonConverter(typeof(JsonStringEnumConverter))]
248251
public LOGLEVEL LogLevel { get; set; } = LOGLEVEL.INFO;
@@ -501,22 +504,22 @@ public enum BackdropTypes
501504
MicaAlt
502505
}
503506

504-
public enum QuickSwitchResultMethods
507+
public enum QuickSwitchWindowPositions
508+
{
509+
UnderDialog,
510+
FollowDefault
511+
}
512+
513+
public enum QuickSwitchResultBehaviours
505514
{
506515
LeftClick,
507516
RightClick
508517
}
509518

510-
public enum QuickSwitchFileResultMethods
519+
public enum QuickSwitchFileResultBehaviours
511520
{
512521
FullPath,
513522
Directory,
514523
DirectoryAndFileName
515524
}
516-
517-
public enum QuickSwitchWindowPositions
518-
{
519-
UnderDialog,
520-
CenterScreen
521-
}
522525
}

Flow.Launcher/Languages/en.xaml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,20 @@
313313
<system:String x:Key="autoQuickSwitch">Quick Switch Automatically</system:String>
314314
<system:String x:Key="autoQuickSwitchToolTip">Quick switch automatically navigate to the path of the current Explorer when a file dialog is opened.</system:String>
315315
<system:String x:Key="showQuickSwitchWindow">Show Quick Switch Window</system:String>
316-
<system:String x:Key="showQuickSwitchWindowToolTip">Show query window in the center-bottom of a file dialog to navigate its path.</system:String>
316+
<system:String x:Key="showQuickSwitchWindowToolTip">Show quick switch search window when file dialogs are open to navigate its path.</system:String>
317+
<system:String x:Key="quickSwitchWindowPosition">Quick Switch Window Position</system:String>
318+
<system:String x:Key="quickSwitchWindowPositionToolTip">Select position for quick switch window</system:String>
319+
<system:String x:Key="QuickSwitchWindowPositionUnderDialog">Fixed in center-bottom of dialogs</system:String>
320+
<system:String x:Key="QuickSwitchWindowPositionFollowDefault">Shown and hidden as search window</system:String>
321+
<system:String x:Key="quickSwitchResultBehaviour">Quick Switch Result Navigation Behaviour</system:String>
322+
<system:String x:Key="quickSwitchResultBehaviourToolTip">Behaviour to navigate file dialogs to paths of the results</system:String>
323+
<system:String x:Key="QuickSwitchResultBehaviourLeftClick">Left click</system:String>
324+
<system:String x:Key="QuickSwitchResultBehaviourRightClick">Right click</system:String>
325+
<system:String x:Key="quickSwitchFileResultBehaviour">Quick Switch File Navigation Behaviour</system:String>
326+
<system:String x:Key="quickSwitchFileResultBehaviourToolTip">Behaviour to navigate file dialogs when paths of the results are files</system:String>
327+
<system:String x:Key="QuickSwitchFileResultBehaviourFullPath">Open full path in file name box</system:String>
328+
<system:String x:Key="QuickSwitchFileResultBehaviourDirectory">Open file directory in path box</system:String>
329+
<system:String x:Key="QuickSwitchFileResultBehaviourDirectoryAndFileName">Open file directory in path box and file name in file name box</system:String>
317330

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

Flow.Launcher/SettingPages/ViewModels/SettingsPaneGeneralViewModel.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,19 @@ public bool EnableQuickSwitch
166166
}
167167
}
168168

169+
public class QuickSwitchWindowPositionData : DropdownDataGeneric<QuickSwitchWindowPositions> { }
170+
public class QuickSwitchResultBehaviourData : DropdownDataGeneric<QuickSwitchResultBehaviours> { }
171+
public class QuickSwitchFileResultBehaviourData : DropdownDataGeneric<QuickSwitchFileResultBehaviours> { }
172+
173+
public List<QuickSwitchWindowPositionData> QuickSwitchWindowPositions { get; } =
174+
DropdownDataGeneric<QuickSwitchWindowPositions>.GetValues<QuickSwitchWindowPositionData>("QuickSwitchWindowPosition");
175+
176+
public List<QuickSwitchResultBehaviourData> QuickSwitchResultBehaviours { get; } =
177+
DropdownDataGeneric<QuickSwitchResultBehaviours>.GetValues<QuickSwitchResultBehaviourData>("QuickSwitchResultBehaviour");
178+
179+
public List<QuickSwitchFileResultBehaviourData> QuickSwitchFileResultBehaviours { get; } =
180+
DropdownDataGeneric<QuickSwitchFileResultBehaviours>.GetValues<QuickSwitchFileResultBehaviourData>("QuickSwitchFileResultBehaviour");
181+
169182
public int SearchDelayTimeValue
170183
{
171184
get => Settings.SearchDelayTime;
@@ -187,6 +200,9 @@ private void UpdateEnumDropdownLocalizations()
187200
DropdownDataGeneric<SearchWindowAligns>.UpdateLabels(SearchWindowAligns);
188201
DropdownDataGeneric<SearchPrecisionScore>.UpdateLabels(SearchPrecisionScores);
189202
DropdownDataGeneric<LastQueryMode>.UpdateLabels(LastQueryModes);
203+
DropdownDataGeneric<QuickSwitchWindowPositions>.UpdateLabels(QuickSwitchWindowPositions);
204+
DropdownDataGeneric<QuickSwitchResultBehaviours>.UpdateLabels(QuickSwitchResultBehaviours);
205+
DropdownDataGeneric<QuickSwitchFileResultBehaviours>.UpdateLabels(QuickSwitchFileResultBehaviours);
190206
}
191207

192208
public string Language

Flow.Launcher/SettingPages/Views/SettingsPaneGeneral.xaml

Lines changed: 60 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -214,27 +214,67 @@
214214
OnContent="{DynamicResource enable}" />
215215
</cc:ExCard.SideContent>
216216

217-
<!-- TODO: Due to many issues, this option is removed from FL -->
218-
<!-- Please see https://github.com/Flow-Launcher/Flow.Launcher/pull/1018 -->
219-
<!--<cc:Card
220-
Title="{DynamicResource autoQuickSwitch}"
221-
Sub="{DynamicResource autoQuickSwitchToolTip}"
222-
Type="InsideFit">
223-
<ui:ToggleSwitch
224-
IsOn="{Binding Settings.AutoQuickSwitch}"
225-
OffContent="{DynamicResource disable}"
226-
OnContent="{DynamicResource enable}" />
227-
</cc:Card>-->
217+
<cc:CardGroup>
218+
<!-- TODO: Due to many issues, this option is removed from FL -->
219+
<!-- Please see https://github.com/Flow-Launcher/Flow.Launcher/pull/1018 -->
220+
<!--<cc:Card
221+
Title="{DynamicResource autoQuickSwitch}"
222+
Sub="{DynamicResource autoQuickSwitchToolTip}"
223+
Type="InsideFit">
224+
<ui:ToggleSwitch
225+
IsOn="{Binding Settings.AutoQuickSwitch}"
226+
OffContent="{DynamicResource disable}"
227+
OnContent="{DynamicResource enable}" />
228+
</cc:Card>-->
228229

229-
<cc:Card
230-
Title="{DynamicResource showQuickSwitchWindow}"
231-
Sub="{DynamicResource showQuickSwitchWindowToolTip}"
232-
Type="InsideFit">
233-
<ui:ToggleSwitch
234-
IsOn="{Binding Settings.ShowQuickSwitchWindow}"
235-
OffContent="{DynamicResource disable}"
236-
OnContent="{DynamicResource enable}" />
237-
</cc:Card>
230+
<cc:Card
231+
Title="{DynamicResource showQuickSwitchWindow}"
232+
Sub="{DynamicResource showQuickSwitchWindowToolTip}"
233+
Type="InsideFit">
234+
<ui:ToggleSwitch
235+
IsOn="{Binding Settings.ShowQuickSwitchWindow}"
236+
OffContent="{DynamicResource disable}"
237+
OnContent="{DynamicResource enable}" />
238+
</cc:Card>
239+
240+
<cc:Card
241+
Title="{DynamicResource quickSwitchWindowPosition}"
242+
Sub="{DynamicResource quickSwitchWindowPositionToolTip}"
243+
Type="InsideFit">
244+
<ComboBox
245+
MinWidth="120"
246+
MaxWidth="210"
247+
DisplayMemberPath="Display"
248+
ItemsSource="{Binding QuickSwitchWindowPositions}"
249+
SelectedValue="{Binding Settings.QuickSwitchWindowPosition}"
250+
SelectedValuePath="Value" />
251+
</cc:Card>
252+
253+
<cc:Card
254+
Title="{DynamicResource quickSwitchResultBehaviour}"
255+
Sub="{DynamicResource quickSwitchResultBehaviourToolTip}"
256+
Type="InsideFit">
257+
<ComboBox
258+
MinWidth="120"
259+
DisplayMemberPath="Display"
260+
ItemsSource="{Binding QuickSwitchResultBehaviours}"
261+
SelectedValue="{Binding Settings.QuickSwitchResultBehaviour}"
262+
SelectedValuePath="Value" />
263+
</cc:Card>
264+
265+
<cc:Card
266+
Title="{DynamicResource quickSwitchFileResultBehaviour}"
267+
Sub="{DynamicResource quickSwitchFileResultBehaviourToolTip}"
268+
Type="InsideFit">
269+
<ComboBox
270+
MinWidth="120"
271+
MaxWidth="210"
272+
DisplayMemberPath="Display"
273+
ItemsSource="{Binding QuickSwitchFileResultBehaviours}"
274+
SelectedValue="{Binding Settings.QuickSwitchFileResultBehaviour}"
275+
SelectedValuePath="Value" />
276+
</cc:Card>
277+
</cc:CardGroup>
238278
</cc:ExCard>
239279

240280
<cc:ExCard

0 commit comments

Comments
 (0)