Skip to content

Commit c99269c

Browse files
Add the simple theme
GH-102
1 parent 9330199 commit c99269c

File tree

9 files changed

+28
-4
lines changed

9 files changed

+28
-4
lines changed

src/KeyboardSwitch.Core/Services/Settings/JsonSettingsService.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,9 @@ private AppSettings CreateDefaultAppSettings() =>
120120
ShowUninstalledLayoutsMessage = true,
121121
UseXsel = false,
122122
AppVersion = this.GetAppVersion(),
123-
AppTheme = OperatingSystem.IsMacOS() ? AppTheme.MacOS : AppTheme.Fluent,
123+
AppTheme = OperatingSystem.IsMacOS()
124+
? AppTheme.MacOS
125+
: OperatingSystem.IsLinux() ? AppTheme.Simple : AppTheme.Fluent,
124126
AppThemeVariant = AppThemeVariant.Auto
125127
};
126128

src/KeyboardSwitch.Core/Settings/AppSettings.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ namespace KeyboardSwitch.Core.Settings;
33
public enum AppTheme
44
{
55
Fluent,
6-
MacOS
6+
MacOS,
7+
Simple
78
}
89

910
public enum AppThemeVariant

src/KeyboardSwitch.Settings/App.axaml.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
using Avalonia.Controls.ApplicationLifetimes;
55
using Avalonia.Styling;
6+
using Avalonia.Themes.Simple;
67

78
using FluentAvalonia.Styling;
89

@@ -211,6 +212,7 @@ private void SetTheme(AppTheme appTheme)
211212
this.Styles.Insert(0, appTheme switch
212213
{
213214
AppTheme.MacOS => new MacOSTheme(),
215+
AppTheme.Simple => new SimpleTheme(),
214216
_ => new FluentAvaloniaTheme
215217
{
216218
PreferUserAccentColor = true,

src/KeyboardSwitch.Settings/Converters/Convert.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,15 @@ public static string AppThemeToString(AppTheme theme) =>
3434
{
3535
AppTheme.Fluent => Messages.AppThemeFluent,
3636
AppTheme.MacOS => Messages.AppThemeMacOS,
37+
AppTheme.Simple => Messages.AppThemeSimple,
3738
_ => String.Empty
3839
};
3940

4041
public static AppTheme StringToAppTheme(string theme) =>
4142
theme switch
4243
{
4344
var str when str == Messages.AppThemeMacOS => AppTheme.MacOS,
45+
var str when str == Messages.AppThemeSimple => AppTheme.Simple,
4446
_ => AppTheme.Fluent
4547
};
4648

src/KeyboardSwitch.Settings/KeyboardSwitch.Settings.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
<PackageReference Include="Avalonia.Desktop" Version="11.3.1" />
2020
<PackageReference Include="Avalonia.Diagnostics" Version="11.3.1" />
2121
<PackageReference Include="Avalonia.ReactiveUI" Version="11.3.1" />
22+
<PackageReference Include="Avalonia.Themes.Simple" Version="11.3.1" />
2223
<PackageReference Include="Devolutions.AvaloniaTheme.MacOS" Version="2025.6.12" />
2324
<PackageReference Include="DynamicData" Version="9.4.1" />
2425
<PackageReference Include="FluentAvaloniaUI" Version="2.3.0" />

src/KeyboardSwitch.Settings/Properties/Messages.Designer.cs

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/KeyboardSwitch.Settings/Properties/Messages.resx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,9 @@
132132
<data name="AppThemeMacOS" xml:space="preserve">
133133
<value>macOS</value>
134134
</data>
135+
<data name="AppThemeSimple" xml:space="preserve">
136+
<value>Simple</value>
137+
</data>
135138
<data name="AppThemeVariant" xml:space="preserve">
136139
<value>Variant</value>
137140
</data>

src/KeyboardSwitch.Settings/Views/PreferencesView.axaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@
186186
/>
187187
</Grid>
188188

189-
<StackPanel Orientation="Horizontal" Margin="10 10 0 0">
189+
<StackPanel Orientation="Horizontal" Margin="10 10 0 10">
190190
<TextBlock Text="{l:Translate AppTheme}" Classes="Label" />
191191
<ComboBox x:Name="AppThemeComboBox" Classes="FormControl" />
192192

test/KeyboardSwitch.Tests/Services/JsonSettingsServiceTests.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,11 @@ public async Task GetAppSettingsDefault()
182182
Assert.True(settings.ShowUninstalledLayoutsMessage);
183183
Assert.Equal(Version, settings.AppVersion);
184184

185-
Assert.Equal(OperatingSystem.IsMacOS() ? AppTheme.MacOS : AppTheme.Fluent, settings.AppTheme);
185+
var expectedTheme = OperatingSystem.IsMacOS()
186+
? AppTheme.MacOS
187+
: OperatingSystem.IsLinux() ? AppTheme.Simple : AppTheme.Fluent;
188+
189+
Assert.Equal(expectedTheme, settings.AppTheme);
186190
Assert.Equal(AppThemeVariant.Auto, settings.AppThemeVariant);
187191

188192
layoutService.Received().GetKeyboardLayouts();

0 commit comments

Comments
 (0)