1- using Flow . Launcher . Helper ;
1+ using System ;
2+ using System . Collections . Generic ;
3+ using System . Windows ;
4+ using System . Windows . Controls ;
5+ using Flow . Launcher . Helper ;
26using Flow . Launcher . Infrastructure . Hotkey ;
37using Flow . Launcher . Infrastructure . UserSettings ;
48using System . Windows . Navigation ;
59using CommunityToolkit . Mvvm . Input ;
610using Flow . Launcher . ViewModel ;
711using System . Windows . Media ;
812using CommunityToolkit . Mvvm . DependencyInjection ;
13+ using Flow . Launcher . Core . Plugin ;
14+ using Flow . Launcher . Infrastructure ;
15+ using System . IO ;
16+ using System . Text . Json ;
917
1018namespace Flow . Launcher . Resources . Pages ;
1119
1220public class RadioCardData
1321{
22+ public string Key { get ; set ; }
1423 public string Icon { get ; set ; }
1524 public string Description1 { get ; set ; }
1625 public string Bullet1 { get ; set ; }
@@ -34,6 +43,41 @@ protected override void OnNavigatedTo(NavigationEventArgs e)
3443 Ioc . Default . GetRequiredService < WelcomeViewModel > ( ) . PageNum = 3 ;
3544 InitializeComponent ( ) ;
3645 }
46+
47+ private void OnStyleChecked ( object sender , RoutedEventArgs e )
48+ {
49+ var rb = sender as RadioButton ;
50+ if ( rb ? . Tag is not RadioCardData data ) return ;
51+
52+ var settings = Ioc . Default . GetRequiredService < Settings > ( ) ;
53+
54+ var pluginDirectory = Path . Combine ( AppDomain . CurrentDomain . BaseDirectory , "Plugins" , "Flow.Launcher.Plugin.Explorer" ) ;
55+ var explorerSettingsPath = Path . Combine ( pluginDirectory , "Settings.json" ) ;
56+
57+ if ( File . Exists ( explorerSettingsPath ) )
58+ {
59+ var explorerSettingsJson = File . ReadAllText ( explorerSettingsPath ) ;
60+ var explorerSettings = JsonSerializer . Deserialize < Dictionary < string , object > > ( explorerSettingsJson ) ;
3761
62+ switch ( data . Key )
63+ {
64+ case "CLI" :
65+ if ( explorerSettings != null )
66+ explorerSettings [ "UseLocationAsWorkingDir" ] = false ;
67+ settings . AutoCompleteHotkey = "Tab" ;
68+ break ;
69+
70+ case "GUI" :
71+ if ( explorerSettings != null )
72+ explorerSettings [ "UseLocationAsWorkingDir" ] = true ;
73+ settings . AutoCompleteHotkey = $ "{ KeyConstant . Alt } + Right";
74+ break ;
75+ }
76+
77+ File . WriteAllText ( explorerSettingsPath , JsonSerializer . Serialize ( explorerSettings , new JsonSerializerOptions { WriteIndented = true } ) ) ;
78+ }
79+
80+ settings . Save ( ) ;
81+ }
3882}
3983
0 commit comments