GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Merge pull request #4 from devohmycode/0.1.2 · devohmycode/NoteUI@7dcbe7a

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • AcrylicSettingsWindow.xaml.cs
  • ActionPanel.cs
  • App.xaml.cs
  • App.xaml
  • AppSettings.cs
  • Assets/Fonts
    • Geist-Bold.otf
    • Geist-Medium.otf
    • Geist-Regular.otf
    • Inter-Bold.ttf
    • Inter-Medium.ttf
    • Inter-Regular.ttf
    • JetBrainsMono-Bold.ttf
    • JetBrainsMono-Medium.ttf
    • JetBrainsMono-Regular.ttf
  • FirebaseSync.cs
  • Lang.cs
  • MainWindow.xaml.cs
  • NoteUI.csproj
  • NoteWindow.xaml.cs
  • NoteWindow.xaml
  • NotepadWindow.xaml.cs
  • RuntimeSecrets.cs
  • SpeechRecognitionService.cs
  • VoiceNoteWindow.xaml.cs
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎AcrylicSettingsWindow.xaml.cs‎

Copy file name to clipboardExpand all lines: AcrylicSettingsWindow.xaml.cs
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@ public AcrylicSettingsWindow(BackdropSettings settings, Action<BackdropSettings>
4040
AppWindow.SetIcon(iconPath);
4141

4242
var theme = AppSettings.LoadThemeSetting();
43-
AppSettings.ApplyThemeToWindow(this, theme);
4443

4544
// Apply acrylic to this window too (live preview)
4645
AppSettings.ApplyToWindow(this, settings, ref _acrylicController, ref _configSource);
46+
AppSettings.ApplyThemeToWindow(this, theme, _configSource);
4747

4848
LoadSettings(settings);
4949
ApplyAcrylicLocalization();
Collapse file

‎ActionPanel.cs‎

Copy file name to clipboardExpand all lines: ActionPanel.cs
+388-199Lines changed: 388 additions & 199 deletions
Large diffs are not rendered by default.
Collapse file

‎App.xaml‎

Copy file name to clipboardExpand all lines: App.xaml
+10Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,16 @@
99
<ResourceDictionary.MergedDictionaries>
1010
<XamlControlsResources xmlns="using:Microsoft.UI.Xaml.Controls" />
1111
</ResourceDictionary.MergedDictionaries>
12+
<FontFamily x:Key="GeistRegular">Assets/Fonts/Geist-Regular.otf#Geist</FontFamily>
13+
<FontFamily x:Key="GeistMedium">Assets/Fonts/Geist-Medium.otf#Geist Medium</FontFamily>
14+
<FontFamily x:Key="GeistBold">Assets/Fonts/Geist-Bold.otf#Geist Bold</FontFamily>
15+
<FontFamily x:Key="InterRegular">Assets/Fonts/Inter-Regular.ttf#Inter</FontFamily>
16+
<FontFamily x:Key="InterMedium">Assets/Fonts/Inter-Medium.ttf#Inter Medium</FontFamily>
17+
<FontFamily x:Key="InterBold">Assets/Fonts/Inter-Bold.ttf#Inter Bold</FontFamily>
18+
<FontFamily x:Key="JetBrainsMonoRegular">Assets/Fonts/JetBrainsMono-Regular.ttf#JetBrains Mono</FontFamily>
19+
<FontFamily x:Key="JetBrainsMonoMedium">Assets/Fonts/JetBrainsMono-Medium.ttf#JetBrains Mono Medium</FontFamily>
20+
<FontFamily x:Key="JetBrainsMonoBold">Assets/Fonts/JetBrainsMono-Bold.ttf#JetBrains Mono Bold</FontFamily>
21+
<FontFamily x:Key="ContentControlThemeFontFamily">Assets/Fonts/Geist-Regular.otf#Geist</FontFamily>
1222
<local:ColorToBrushConverter x:Key="ColorToBrush"/>
1323
<LinearGradientBrush x:Key="AccentLinearDownGradientBrush"
1424
StartPoint="0,0" EndPoint="0,1">
Collapse file

‎App.xaml.cs‎

Copy file name to clipboardExpand all lines: App.xaml.cs
+8Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using Microsoft.UI.Xaml;
2+
using Microsoft.UI.Xaml.Media;
23

34
namespace NoteUI;
45

@@ -14,8 +15,15 @@ public App()
1415
protected override void OnLaunched(LaunchActivatedEventArgs args)
1516
{
1617
Lang.SetLanguage(AppSettings.LoadLanguage());
18+
ApplyFontResource(AppSettings.LoadFontSetting());
1719
ReminderService.Initialize();
1820
_window = new MainWindow();
1921
_window.Activate();
2022
}
23+
24+
public static void ApplyFontResource(string font)
25+
{
26+
var fontFamily = AppSettings.GetFontFamily(font);
27+
Application.Current.Resources["ContentControlThemeFontFamily"] = fontFamily;
28+
}
2129
}
Collapse file

‎AppSettings.cs‎

Copy file name to clipboardExpand all lines: AppSettings.cs
+82-1Lines changed: 82 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using System.Text.Json;
22
using Microsoft.UI.Composition.SystemBackdrops;
33
using Microsoft.UI.Xaml;
4+
using Microsoft.UI.Xaml.Controls;
45
using Microsoft.UI.Xaml.Media;
56
using WinRT;
67

@@ -55,6 +56,82 @@ public static void SaveLanguage(string lang)
5556
MergeAndSaveSettings(new Dictionary<string, object> { ["language"] = lang });
5657
}
5758

59+
// ── Font ─────────────────────────────────────────────────
60+
61+
public static string LoadFontSetting()
62+
{
63+
try
64+
{
65+
if (File.Exists(SettingsPath))
66+
{
67+
var json = File.ReadAllText(SettingsPath);
68+
var doc = JsonDocument.Parse(json);
69+
if (doc.RootElement.TryGetProperty("font", out var prop))
70+
return prop.GetString() ?? "geist";
71+
}
72+
}
73+
catch { }
74+
return "geist";
75+
}
76+
77+
public static void SaveFontSetting(string font)
78+
{
79+
MergeAndSaveSettings(new Dictionary<string, object> { ["font"] = font });
80+
}
81+
82+
public static FontFamily GetFontFamily(string font)
83+
{
84+
return font switch
85+
{
86+
"segoe" => new FontFamily("Segoe UI"),
87+
"inter" => new FontFamily("Assets/Fonts/Inter-Regular.ttf#Inter"),
88+
"jetbrains" => new FontFamily("Assets/Fonts/JetBrainsMono-Regular.ttf#JetBrains Mono"),
89+
_ => new FontFamily("Assets/Fonts/Geist-Regular.otf#Geist"),
90+
};
91+
}
92+
93+
public static void ApplyFontToTree(FrameworkElement root, FontFamily fontFamily)
94+
{
95+
if (root is Control c)
96+
c.FontFamily = fontFamily;
97+
else if (root is TextBlock tb)
98+
tb.FontFamily = fontFamily;
99+
100+
if (root is Panel panel)
101+
{
102+
foreach (var child in panel.Children)
103+
if (child is FrameworkElement fe)
104+
ApplyFontToTree(fe, fontFamily);
105+
}
106+
else if (root is ContentControl cc && cc.Content is FrameworkElement content)
107+
{
108+
ApplyFontToTree(content, fontFamily);
109+
}
110+
}
111+
112+
// ── Note style ────────────────────────────────────────────
113+
114+
public static string LoadNoteStyle()
115+
{
116+
try
117+
{
118+
if (File.Exists(SettingsPath))
119+
{
120+
var json = File.ReadAllText(SettingsPath);
121+
var doc = JsonDocument.Parse(json);
122+
if (doc.RootElement.TryGetProperty("noteStyle", out var prop))
123+
return prop.GetString() ?? "titlebar";
124+
}
125+
}
126+
catch { }
127+
return "titlebar";
128+
}
129+
130+
public static void SaveNoteStyle(string style)
131+
{
132+
MergeAndSaveSettings(new Dictionary<string, object> { ["noteStyle"] = style });
133+
}
134+
58135
// ── Slash commands ──────────────────────────────────────────
59136

60137
public static bool LoadSlashEnabled()
@@ -240,7 +317,8 @@ private static void ConfigureBackdropController(
240317
}
241318
}
242319

243-
public static void ApplyThemeToWindow(Window window, string theme)
320+
public static void ApplyThemeToWindow(Window window, string theme,
321+
SystemBackdropConfiguration? configSource = null)
244322
{
245323
if (window.Content is FrameworkElement fe)
246324
{
@@ -250,6 +328,9 @@ public static void ApplyThemeToWindow(Window window, string theme)
250328
"dark" => ElementTheme.Dark,
251329
_ => ElementTheme.Default
252330
};
331+
332+
if (configSource != null)
333+
configSource.Theme = (SystemBackdropTheme)fe.ActualTheme;
253334
}
254335
}
255336

Collapse file

‎Assets/Fonts/Geist-Bold.otf‎

Copy file name to clipboard
163 KB
Binary file not shown.
Collapse file

‎Assets/Fonts/Geist-Medium.otf‎

Copy file name to clipboard
158 KB
Binary file not shown.
Collapse file

‎Assets/Fonts/Geist-Regular.otf‎

Copy file name to clipboard
154 KB
Binary file not shown.
Collapse file

‎Assets/Fonts/Inter-Bold.ttf‎

Copy file name to clipboard
411 KB
Binary file not shown.
Collapse file

‎Assets/Fonts/Inter-Medium.ttf‎

Copy file name to clipboard
408 KB
Binary file not shown.

0 commit comments

Comments
0 (0)
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.