# danielchalmers/desktopclock architecture

> Architecture diagram of the GitHub repository danielchalmers/desktopclock, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-06). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/danielchalmers/desktopclock
- Repository: https://github.com/danielchalmers/desktopclock

## Overview

DesktopClock is a Windows desktop clock widget. The main workflow is launching the app, displaying a live clock or countdown, and adjusting its format and appearance in the companion windows; preferences persist between runs. Additional capabilities include time-zone display, countdown sound, theme and system-theme support, localization, startup behavior, fullscreen hiding, and OLED burn-in mitigation. The graph follows documented capabilities and visible source references; some feature details come from the README because their implementation was not sampled.

Main entry points: [`DesktopClock/MainWindow.xaml.cs`](https://github.com/danielchalmers/desktopclock/blob/master/DesktopClock/MainWindow.xaml.cs) (Clock window), [`DesktopClock/Properties/Settings.cs`](https://github.com/danielchalmers/desktopclock/blob/master/DesktopClock/Properties/Settings.cs) (Saved preferences), [`DesktopClock/App.xaml.cs`](https://github.com/danielchalmers/desktopclock/blob/master/DesktopClock/App.xaml.cs) (App startup), [`DesktopClock/FormatEditor.xaml.cs`](https://github.com/danielchalmers/desktopclock/blob/master/DesktopClock/FormatEditor.xaml.cs) (Format editor)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Clock runtime"]
  node_app["App startup<br/>[App.xaml.cs]"]
  node_clock["Clock window<br/>[MainWindow.xaml.cs]"]
  node_settings[("Saved preferences<br/>[Settings.cs]")]
  node_clock_timer["Clock timer"]
end

subgraph group_customize["User customization"]
  node_settings_window["Settings window"]
  node_format_editor["Format editor"]
  node_countdown_editor["Countdown editor"]
  node_theme_picker["Theme picker"]
end

subgraph group_formatting["Time and formatting"]
  node_presets["Format presets<br/>[FormatPresets.cs]"]
  node_tokenizer["Format tokenizer<br/>[Tokenizer.cs]"]
  node_time_formatter["Time formatter"]
  node_date_utils["Date and time utilities<br/>[DateTimeUtil.cs]"]
  node_relative_time["Relative time"]
  node_countdown_converter["Countdown conversion"]
end

subgraph group_platform["Platform and presentation"]
  node_clock_theme["Clock themes<br/>[ClockTheme.cs]"]
  node_theme_manager["System palette<br/>[ThemeManager.cs]"]
  node_system_theme["Windows theme service"]
  node_localization["Localization<br/>[Loc.cs]"]
  node_fullscreen["Fullscreen hiding"]
  node_pixel_shifter["Burn-in mitigation<br/>[PixelShifter.cs]"]
  node_text_rendering["Outlined text"]
  node_height_scaling["Height scaling"]
end

node_user(("Desktop user"))

node_user -->|"launches"| node_app
node_app -.->|"shows"| node_clock
node_app -->|"initializes"| node_theme_manager
node_app -.->|"prefetches lists"| node_settings
node_user -->|"opens settings"| node_settings_window
node_user -->|"edits format"| node_format_editor
node_user -->|"sets countdown"| node_countdown_editor
node_user -->|"chooses theme"| node_theme_picker
node_settings_window -->|"updates"| node_settings
node_settings_window -->|"applies theme"| node_theme_manager
node_format_editor -->|"updates format"| node_settings
node_format_editor -->|"loads presets"| node_presets
node_format_editor -->|"previews format"| node_tokenizer
node_format_editor -->|"previews time"| node_time_formatter
node_countdown_editor -->|"updates target"| node_settings
node_countdown_editor -->|"loads formats"| node_presets
node_countdown_editor -->|"previews target"| node_relative_time
node_theme_picker -->|"selects preset"| node_clock_theme
node_theme_picker -->|"applies preset"| node_settings
node_clock -->|"reads preferences"| node_settings
node_clock -->|"updates display"| node_clock_timer
node_clock -->|"formats display"| node_time_formatter
node_clock -->|"uses date utilities"| node_date_utils
node_clock -->|"checks fullscreen"| node_fullscreen
node_clock -->|"shifts position"| node_pixel_shifter
node_time_formatter -->|"formats tokens"| node_tokenizer
node_time_formatter -->|"formats relative time"| node_relative_time
node_clock -.->|"uses countdown target"| node_countdown_converter
node_clock -.->|"renders appearance"| node_clock_theme
node_clock -.->|"renders outlined text"| node_text_rendering
node_clock -->|"scales display"| node_height_scaling
node_clock -->|"shows translated text"| node_localization
node_theme_manager -->|"reads system colors"| node_system_theme
node_clock_theme -->|"gets accent color"| node_system_theme
node_clock_theme -->|"applies appearance"| node_settings
node_app -->|"sets text culture"| node_localization
node_user -->|"views clock"| node_clock

click node_app "https://github.com/danielchalmers/desktopclock/blob/master/DesktopClock/App.xaml.cs"
click node_clock "https://github.com/danielchalmers/desktopclock/blob/master/DesktopClock/MainWindow.xaml.cs"
click node_settings "https://github.com/danielchalmers/desktopclock/blob/master/DesktopClock/Properties/Settings.cs"
click node_settings_window "https://github.com/danielchalmers/desktopclock/blob/master/DesktopClock/SettingsWindow.xaml.cs"
click node_format_editor "https://github.com/danielchalmers/desktopclock/blob/master/DesktopClock/FormatEditor.xaml.cs"
click node_countdown_editor "https://github.com/danielchalmers/desktopclock/blob/master/DesktopClock/CountdownTargetEditor.xaml.cs"
click node_theme_picker "https://github.com/danielchalmers/desktopclock/blob/master/DesktopClock/ThemePresetPicker.xaml.cs"
click node_presets "https://github.com/danielchalmers/desktopclock/blob/master/DesktopClock/Utilities/FormatPresets.cs"
click node_tokenizer "https://github.com/danielchalmers/desktopclock/blob/master/DesktopClock/Utilities/Tokenizer.cs"
click node_time_formatter "https://github.com/danielchalmers/desktopclock/blob/master/DesktopClock/Utilities/TimeStringFormatter.cs"
click node_date_utils "https://github.com/danielchalmers/desktopclock/blob/master/DesktopClock/Utilities/DateTimeUtil.cs"
click node_relative_time "https://github.com/danielchalmers/desktopclock/blob/master/DesktopClock/Utilities/RelativeTimeFormatter.cs"
click node_countdown_converter "https://github.com/danielchalmers/desktopclock/blob/master/DesktopClock/Utilities/CountdownTargetConverter.cs"
click node_clock_timer "https://github.com/danielchalmers/desktopclock/blob/master/DesktopClock/Utilities/SystemClockTimer.cs"
click node_clock_theme "https://github.com/danielchalmers/desktopclock/blob/master/DesktopClock/ClockTheme.cs"
click node_theme_manager "https://github.com/danielchalmers/desktopclock/blob/master/DesktopClock/Utilities/ThemeManager.cs"
click node_system_theme "https://github.com/danielchalmers/desktopclock/blob/master/DesktopClock/Utilities/SystemThemeService.cs"
click node_localization "https://github.com/danielchalmers/desktopclock/blob/master/DesktopClock/Localization/Loc.cs"
click node_fullscreen "https://github.com/danielchalmers/desktopclock/blob/master/DesktopClock/Utilities/FullscreenHideManager.cs"
click node_pixel_shifter "https://github.com/danielchalmers/desktopclock/blob/master/DesktopClock/Utilities/PixelShifter.cs"
click node_text_rendering "https://github.com/danielchalmers/desktopclock/blob/master/DesktopClock/OutlinedTextBlock.cs"
click node_height_scaling "https://github.com/danielchalmers/desktopclock/blob/master/DesktopClock/Utilities/HeightScaleConverter.cs"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_app,node_clock,node_settings,node_clock_timer,node_user toneBlue
class node_settings_window,node_format_editor,node_countdown_editor,node_theme_picker toneAmber
class node_presets,node_tokenizer,node_time_formatter,node_date_utils,node_relative_time,node_countdown_converter toneMint
class node_clock_theme,node_theme_manager,node_system_theme,node_localization,node_fullscreen,node_pixel_shifter,node_text_rendering,node_height_scaling toneRose
```

## Components

### Clock runtime

- [App startup](https://github.com/danielchalmers/desktopclock/blob/master/DesktopClock/App.xaml.cs): `DesktopClock/App.xaml.cs`
- [Clock window](https://github.com/danielchalmers/desktopclock/blob/master/DesktopClock/MainWindow.xaml.cs): `DesktopClock/MainWindow.xaml.cs`
- [Saved preferences](https://github.com/danielchalmers/desktopclock/blob/master/DesktopClock/Properties/Settings.cs): `DesktopClock/Properties/Settings.cs`
- [Clock timer](https://github.com/danielchalmers/desktopclock/blob/master/DesktopClock/Utilities/SystemClockTimer.cs): `DesktopClock/Utilities/SystemClockTimer.cs`

### User customization

- [Settings window](https://github.com/danielchalmers/desktopclock/blob/master/DesktopClock/SettingsWindow.xaml.cs): `DesktopClock/SettingsWindow.xaml.cs`
- [Format editor](https://github.com/danielchalmers/desktopclock/blob/master/DesktopClock/FormatEditor.xaml.cs): `DesktopClock/FormatEditor.xaml.cs`
- [Countdown editor](https://github.com/danielchalmers/desktopclock/blob/master/DesktopClock/CountdownTargetEditor.xaml.cs): `DesktopClock/CountdownTargetEditor.xaml.cs`
- [Theme picker](https://github.com/danielchalmers/desktopclock/blob/master/DesktopClock/ThemePresetPicker.xaml.cs): `DesktopClock/ThemePresetPicker.xaml.cs`

### Time and formatting

- [Format presets](https://github.com/danielchalmers/desktopclock/blob/master/DesktopClock/Utilities/FormatPresets.cs): `DesktopClock/Utilities/FormatPresets.cs`
- [Format tokenizer](https://github.com/danielchalmers/desktopclock/blob/master/DesktopClock/Utilities/Tokenizer.cs): `DesktopClock/Utilities/Tokenizer.cs`
- [Time formatter](https://github.com/danielchalmers/desktopclock/blob/master/DesktopClock/Utilities/TimeStringFormatter.cs): `DesktopClock/Utilities/TimeStringFormatter.cs`
- [Date and time utilities](https://github.com/danielchalmers/desktopclock/blob/master/DesktopClock/Utilities/DateTimeUtil.cs): `DesktopClock/Utilities/DateTimeUtil.cs`
- [Relative time](https://github.com/danielchalmers/desktopclock/blob/master/DesktopClock/Utilities/RelativeTimeFormatter.cs): `DesktopClock/Utilities/RelativeTimeFormatter.cs`
- [Countdown conversion](https://github.com/danielchalmers/desktopclock/blob/master/DesktopClock/Utilities/CountdownTargetConverter.cs): `DesktopClock/Utilities/CountdownTargetConverter.cs`

### Platform and presentation

- [Clock themes](https://github.com/danielchalmers/desktopclock/blob/master/DesktopClock/ClockTheme.cs): `DesktopClock/ClockTheme.cs`
- [System palette](https://github.com/danielchalmers/desktopclock/blob/master/DesktopClock/Utilities/ThemeManager.cs): `DesktopClock/Utilities/ThemeManager.cs`
- [Windows theme service](https://github.com/danielchalmers/desktopclock/blob/master/DesktopClock/Utilities/SystemThemeService.cs): `DesktopClock/Utilities/SystemThemeService.cs`
- [Localization](https://github.com/danielchalmers/desktopclock/blob/master/DesktopClock/Localization/Loc.cs): `DesktopClock/Localization/Loc.cs`
- [Fullscreen hiding](https://github.com/danielchalmers/desktopclock/blob/master/DesktopClock/Utilities/FullscreenHideManager.cs): `DesktopClock/Utilities/FullscreenHideManager.cs`
- [Burn-in mitigation](https://github.com/danielchalmers/desktopclock/blob/master/DesktopClock/Utilities/PixelShifter.cs): `DesktopClock/Utilities/PixelShifter.cs`
- [Outlined text](https://github.com/danielchalmers/desktopclock/blob/master/DesktopClock/OutlinedTextBlock.cs): `DesktopClock/OutlinedTextBlock.cs`
- [Height scaling](https://github.com/danielchalmers/desktopclock/blob/master/DesktopClock/Utilities/HeightScaleConverter.cs): `DesktopClock/Utilities/HeightScaleConverter.cs`

### Other components

- **Desktop user**

## Connections

- Desktop user → App startup: launches (evidence: `README.md`)
- App startup → Clock window: shows
- App startup → System palette: initializes (evidence: `DesktopClock/App.xaml.cs`)
- App startup → Saved preferences: prefetches lists
- Desktop user → Settings window: opens settings (evidence: `README.md`)
- Desktop user → Format editor: edits format (evidence: `README.md`)
- Desktop user → Countdown editor: sets countdown (evidence: `README.md`)
- Desktop user → Theme picker: chooses theme (evidence: `README.md`)
- Settings window → Saved preferences: updates (evidence: `DesktopClock/SettingsWindow.xaml.cs`)
- Settings window → System palette: applies theme (evidence: `DesktopClock/SettingsWindow.xaml.cs`)
- Format editor → Saved preferences: updates format (evidence: `DesktopClock/FormatEditor.xaml.cs`)
- Format editor → Format presets: loads presets (evidence: `DesktopClock/FormatEditor.xaml.cs`)
- Format editor → Format tokenizer: previews format (evidence: `DesktopClock/FormatEditor.xaml.cs`)
- Format editor → Time formatter: previews time (evidence: `DesktopClock/FormatEditor.xaml.cs`)
- Countdown editor → Saved preferences: updates target (evidence: `DesktopClock/CountdownTargetEditor.xaml.cs`)
- Countdown editor → Format presets: loads formats (evidence: `DesktopClock/CountdownTargetEditor.xaml.cs`)
- Countdown editor → Relative time: previews target (evidence: `DesktopClock/CountdownTargetEditor.xaml.cs`)
- Theme picker → Clock themes: selects preset (evidence: `DesktopClock/ThemePresetPicker.xaml.cs`)
- Theme picker → Saved preferences: applies preset (evidence: `DesktopClock/ThemePresetPicker.xaml.cs`)
- Clock window → Saved preferences: reads preferences (evidence: `DesktopClock/MainWindow.xaml.cs`)
- Clock window → Clock timer: updates display (evidence: `DesktopClock/MainWindow.xaml.cs`)
- Clock window → Time formatter: formats display (evidence: `DesktopClock/MainWindow.xaml.cs`)
- Clock window → Date and time utilities: uses date utilities (evidence: `DesktopClock/MainWindow.xaml.cs`)
- Clock window → Fullscreen hiding: checks fullscreen (evidence: `DesktopClock/MainWindow.xaml.cs`)
- Clock window → Burn-in mitigation: shifts position (evidence: `DesktopClock/MainWindow.xaml.cs`)
- Time formatter → Format tokenizer: formats tokens (evidence: `DesktopClock/Utilities/TimeStringFormatter.cs`)
- Time formatter → Relative time: formats relative time (evidence: `DesktopClock/Utilities/TimeStringFormatter.cs`)
- Clock window → Countdown conversion: uses countdown target
- Clock window → Clock themes: renders appearance
- Clock window → Outlined text: renders outlined text
- Clock window → Height scaling: scales display (evidence: `DesktopClock/MainWindow.xaml.cs`)
- Clock window → Localization: shows translated text (evidence: `DesktopClock/MainWindow.xaml.cs`)
- System palette → Windows theme service: reads system colors (evidence: `DesktopClock/Utilities/ThemeManager.cs`)
- Clock themes → Windows theme service: gets accent color (evidence: `DesktopClock/ClockTheme.cs`)
- Clock themes → Saved preferences: applies appearance (evidence: `DesktopClock/ClockTheme.cs`)
- App startup → Localization: sets text culture (evidence: `DesktopClock/App.xaml.cs`)
- Desktop user → Clock window: views clock (evidence: `README.md`)
