Skip to content

Commit e6baa88

Browse files
committed
decouple Shell from the ComboBox SelectedIndex
enables us to add new `Shell` options without messing with the user's saved settings, while keeping the `RunCommand` option last.
1 parent 1b68d09 commit e6baa88

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

Plugins/Flow.Launcher.Plugin.Shell/ShellSetting.xaml.cs

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System.Collections.Generic;
1+
using System.Collections.Generic;
22
using System.Windows;
33
using System.Windows.Controls;
44

@@ -68,10 +68,21 @@ private void CMDSetting_OnLoaded(object sender, RoutedEventArgs re)
6868
_settings.ReplaceWinR = false;
6969
};
7070

71-
ShellComboBox.SelectedIndex = (int) _settings.Shell;
71+
ShellComboBox.SelectedIndex = _settings.Shell switch
72+
{
73+
Shell.Cmd => 0,
74+
Shell.Powershell => 1,
75+
_ => ShellComboBox.Items.Count - 1
76+
};
77+
7278
ShellComboBox.SelectionChanged += (o, e) =>
7379
{
74-
_settings.Shell = (Shell) ShellComboBox.SelectedIndex;
80+
_settings.Shell = ShellComboBox.SelectedIndex switch
81+
{
82+
0 => Shell.Cmd,
83+
1 => Shell.Powershell,
84+
_ => Shell.RunCommand
85+
};
7586
LeaveShellOpen.IsEnabled = _settings.Shell != Shell.RunCommand;
7687
};
7788

0 commit comments

Comments
 (0)