Skip to content

Commit cc65562

Browse files
Save settings
1 parent d1bb08a commit cc65562

File tree

2 files changed

+16
-10
lines changed

2 files changed

+16
-10
lines changed

Plugins/Flow.Launcher.Plugin.Program/ProgramSuffixes.xaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -193,9 +193,9 @@
193193
FontSize="16"
194194
FontWeight="SemiBold"
195195
Text="{DynamicResource flowlauncher_plugin_program_suffixes_URL_types}" />
196-
<CheckBox Name="steam" Margin="10,0,0,0" IsChecked="{Binding ProtocolsStatus[steam://run/;steam://rungameid/]}">Steam Games</CheckBox>
197-
<CheckBox Name="epic" Margin="10,0,0,0" IsChecked="{Binding ProtocolsStatus[com.epicgames.launcher://apps/]}">Epic Games</CheckBox>
198-
<CheckBox Name="http" Margin="10,0,0,0" IsChecked="{Binding ProtocolsStatus[http://;https://]}">Http/Https</CheckBox>
196+
<CheckBox Name="steam" Margin="10,0,0,0" IsChecked="{Binding ProtocolsStatus[steam]}">Steam Games</CheckBox>
197+
<CheckBox Name="epic" Margin="10,0,0,0" IsChecked="{Binding ProtocolsStatus[epic]}">Epic Games</CheckBox>
198+
<CheckBox Name="http" Margin="10,0,0,0" IsChecked="{Binding ProtocolsStatus[http]}">Http/Https</CheckBox>
199199
<CheckBox
200200
Name="CustomProtocol"
201201
Margin="10,0,0,0"

Plugins/Flow.Launcher.Plugin.Program/Settings.cs

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,17 @@ public class Settings
1414
public string[] CustomSuffixes { get; set; } = Array.Empty<string>();
1515
public string[] CustomProtocols { get; set; } = Array.Empty<string>();
1616

17-
[JsonIgnore]
1817
public Dictionary<string, bool> BuiltinSuffixesStatus { get; set; } = new Dictionary<string, bool>{
1918
{ "exe", true }, { "appref-ms", true }, { "lnk", true }
2019
};
2120

22-
[JsonIgnore]
2321
public Dictionary<string, bool> BuiltinProtocolsStatus { get; set; } = new Dictionary<string, bool>{
24-
{ $"steam://run/{SuffixSeparator}steam://rungameid/", true }, { "com.epicgames.launcher://apps/", true }, { $"http://{SuffixSeparator}https://", false}
22+
{ "steam", true }, { "epic", true }, { "http", false }
23+
};
24+
25+
[JsonIgnore]
26+
public Dictionary<string, string> BuiltinProtocols { get; set; } = new Dictionary<string, string>{
27+
{ "steam", $"steam://run/{SuffixSeparator}steam://rungameid/" }, { "epic", "com.epicgames.launcher://apps/" }, { "http", $"http://{SuffixSeparator}https://"}
2528
};
2629

2730
public bool UseCustomSuffixes { get; set; } = false;
@@ -30,7 +33,7 @@ public class Settings
3033
public string[] GetSuffixes()
3134
{
3235
List<string> extensions = new List<string>();
33-
foreach(var item in BuiltinSuffixesStatus)
36+
foreach (var item in BuiltinSuffixesStatus)
3437
{
3538
if (item.Value)
3639
{
@@ -60,10 +63,13 @@ public string[] GetProtocols()
6063
{
6164
if (item.Value)
6265
{
63-
var tmp = item.Key.Split(SuffixSeparator, StringSplitOptions.RemoveEmptyEntries);
64-
foreach(var p in tmp)
66+
if (BuiltinProtocols.TryGetValue(item.Key, out string ps))
6567
{
66-
protocols.Add(p);
68+
var tmp = ps.Split(SuffixSeparator, StringSplitOptions.RemoveEmptyEntries);
69+
foreach (var protocol in tmp)
70+
{
71+
protocols.Add(protocol);
72+
}
6773
}
6874
}
6975
}

0 commit comments

Comments
 (0)