Skip to content

Commit 6aefca2

Browse files
committed
Remove OS theme detection code
Add some string change enum location
1 parent 92ee763 commit 6aefca2

File tree

7 files changed

+30
-92
lines changed

7 files changed

+30
-92
lines changed

Flow.Launcher.Infrastructure/UserSettings/Settings.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public class Settings : BaseModel
1515
private string language = "en";
1616
public string Hotkey { get; set; } = $"{KeyConstant.Alt} + {KeyConstant.Space}";
1717
public string OpenResultModifiers { get; set; } = KeyConstant.Alt;
18-
public string DarkMode { get; set; }
18+
public string DarkMode { get; set; } = "System";
1919
public bool ShowOpenResultHotkey { get; set; } = true;
2020
public double WindowSize { get; set; } = 580;
2121

@@ -164,4 +164,11 @@ public enum LastQueryMode
164164
Empty,
165165
Preserved
166166
}
167+
168+
public enum DarkMode
169+
{
170+
System,
171+
Light,
172+
Dark
173+
}
167174
}

Flow.Launcher/Flow.Launcher.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@
9696
</PackageReference>
9797
<PackageReference Include="PropertyChanged.Fody" Version="3.4.0" />
9898
<PackageReference Include="SharpVectors" Version="1.7.6" />
99-
<PackageReference Include="System.Management" Version="6.0.0" />
10099
</ItemGroup>
101100

102101
<ItemGroup>

Flow.Launcher/Helper/SystemTheme.cs

Lines changed: 0 additions & 76 deletions
This file was deleted.

Flow.Launcher/Languages/en.xaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,8 @@
8484
<system:String x:Key="ThemeFolder">Theme Folder</system:String>
8585
<system:String x:Key="OpenThemeFolder">Open Theme Folder</system:String>
8686
<system:String x:Key="DarkMode">Dark Mode</system:String>
87-
<system:String x:Key="DarkModeDefault">System Default</system:String>
87+
<system:String x:Key="DarkModeTip">System settings will take effect from the next run.</system:String>
88+
<system:String x:Key="DarkModeSystem">System Default</system:String>
8889
<system:String x:Key="DarkModeLight">Light</system:String>
8990
<system:String x:Key="DarkModeDark">Dark</system:String>
9091

Flow.Launcher/SettingWindow.xaml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1866,15 +1866,18 @@
18661866
<ItemsControl Style="{StaticResource SettingGrid}">
18671867
<StackPanel Style="{StaticResource TextPanel}">
18681868
<TextBlock Style="{DynamicResource SettingTitleLabel}" Text="{DynamicResource DarkMode}" />
1869+
<TextBlock Style="{DynamicResource SettingSubTitleLabel}" Text="{DynamicResource DarkModeTip}" />
18691870
</StackPanel>
18701871
<ComboBox
18711872
x:Name="DarkModeComboBox"
18721873
Grid.Column="2"
1873-
Width="120"
1874+
Width="180"
18741875
Margin="0,0,18,0"
1876+
DisplayMemberPath="Display"
18751877
FontSize="14"
1876-
ItemsSource="{Binding DarkMode}"
1877-
SelectedItem="{Binding Settings.DarkMode}"
1878+
ItemsSource="{Binding DarkModes}"
1879+
SelectedValue="{Binding Settings.DarkMode}"
1880+
SelectedValuePath="Value"
18781881
SelectionChanged="DarkModeSelectedIndexChanged" />
18791882
<TextBlock Style="{StaticResource Glyph}">
18801883
&#xe708;

Flow.Launcher/SettingWindow.xaml.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,6 @@ private void DarkModeSelectedIndexChanged(object sender, EventArgs e)
322322
{
323323
ModernWpf.ThemeManager.Current.ApplicationTheme = ModernWpf.ApplicationTheme.Dark;
324324
}
325-
326325
}
327326

328327
/* Custom TitleBar */

Flow.Launcher/ViewModel/SettingWindowViewModel.cs

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -317,20 +317,25 @@ public bool DropShadowEffect
317317
}
318318
}
319319

320-
enum DarkModes
320+
public class DarkMode
321321
{
322-
System,
323-
Light,
324-
Dark
322+
public string Display { get; set; }
323+
public Infrastructure.UserSettings.DarkMode Value { get; set; }
325324
}
326-
public List<string> DarkMode
325+
public List<DarkMode> DarkModes
327326
{
328327
get
329328
{
330-
var darkModeStrings = new List<string>();
331-
var enumList = Enum.GetValues(typeof(DarkModes)).Cast<DarkModes>().ToList();
332-
enumList.ForEach(x => darkModeStrings.Add(x.ToString()));
333-
return darkModeStrings;
329+
List<DarkMode> modes = new List<DarkMode>();
330+
var enums = (Infrastructure.UserSettings.DarkMode[])Enum.GetValues(typeof(Infrastructure.UserSettings.DarkMode));
331+
foreach (var e in enums)
332+
{
333+
var key = $"DarkMode{e}";
334+
var display = _translater.GetTranslation(key);
335+
var m = new DarkMode { Display = display, Value = e, };
336+
modes.Add(m);
337+
}
338+
return modes;
334339
}
335340
}
336341

0 commit comments

Comments
 (0)