Compare commits
132
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7af21aab09
|
||
|
|
e5f2835229 | ||
|
|
76b27e86ed
|
||
|
|
66812dc467
|
||
|
|
e82507db2d | ||
|
|
14f9e63f12 | ||
|
|
e279e94056 | ||
|
|
d33d6fa442 | ||
|
|
a36c846271
|
||
|
|
5c769ae082 | ||
|
|
e7acfef005
|
||
|
|
60a57b23e0
|
||
|
|
5f1a965153
|
||
|
|
b5c629907b | ||
|
|
c3a79402b8
|
||
|
|
0c9912cc53
|
||
|
|
39019f4fb3 | ||
|
|
9b8086d925
|
||
|
|
8f7a94973f
|
||
|
|
1d4babcd41
|
||
|
|
c21621403b | ||
|
|
311cdf641b
|
||
|
|
4925eee1fd
|
||
|
|
e2e94c6f5c | ||
|
|
6467c87982 | ||
|
|
966e1fb23f
|
||
|
|
e8ea8aa925
|
||
|
|
f52965cdde | ||
|
|
5491f6594f
|
||
|
|
e52b4d679c | ||
|
|
763cc93de0
|
||
|
|
be89c978a6 | ||
|
|
16d6e64b0c
|
||
|
|
6b898994a3
|
||
|
|
fbc2a3c2b6
|
||
|
|
df161596f8 | ||
|
|
48ba07c2ad
|
||
|
|
7e6d0f474a | ||
|
|
a0b473459c
|
||
|
|
4d24d2243c | ||
|
|
779cb13002
|
||
|
|
1a2b41be40 | ||
|
|
cdf8b1f004
|
||
|
|
6edea9bb01 | ||
|
|
5b46489596 | ||
|
|
176cf3cf4a
|
||
|
|
3a609e88c3
|
||
|
|
677e58f5c2
|
||
|
|
eef73cac86 | ||
|
|
43eb0e0da7
|
||
|
|
6019bc6c33
|
||
|
|
038c695987 | ||
|
|
932385a71e | ||
|
|
6dbfa9e6d4
|
||
|
|
503f7bd607
|
||
|
|
209fea4e7f
|
||
|
|
8fb9de8702
|
||
|
|
835185f26e | ||
|
|
59d49656d7
|
||
|
|
bf30b52fb8
|
||
|
|
bb729f8348
|
||
|
|
f60d455647 | ||
|
|
0c7a3b684b
|
||
|
|
e03d809492 | ||
|
|
230f7dc8c7
|
||
|
|
5400c6dbe4 | ||
|
|
9b86f98846
|
||
|
|
eb243b7f07
|
||
|
|
67d2bb635f | ||
|
|
78f230c517
|
||
|
|
4c2342620f | ||
|
|
26675d1bd0
|
||
|
|
30a6280d5e
|
||
|
|
322068f1cd
|
||
|
|
ac544cbc52
|
||
|
|
d77e951a10 | ||
|
|
349f67a45b
|
||
|
|
f3d70d503a | ||
|
|
10c065fe20
|
||
|
|
a400fd6f89
|
||
|
|
8a8f7d95e0
|
||
|
|
cda1552a1c | ||
|
|
fbc41e25b6
|
||
|
|
99790377c8 | ||
|
|
8cbb83a0b8
|
||
|
|
07f686ceee
|
||
|
|
ae8187e39d
|
||
|
|
055be54be8 | ||
|
|
f880b8d87c
|
||
|
|
717bd86e1f | ||
|
|
77fcbe11df
|
||
|
|
944e45950a
|
||
|
|
bc44fa5554
|
||
|
|
b11568d6bb
|
||
|
|
196538d62d | ||
|
|
1567bcae25
|
||
|
|
3ea5a1c665
|
||
|
|
4181d9d754 | ||
|
|
769756c060
|
||
|
|
2b84a874d0
|
||
|
|
3a481b9ad6 | ||
|
|
ff4378c701
|
||
|
|
2ab2fba933
|
||
|
|
05a9def6b4
|
||
|
|
7f14eb8f07
|
||
|
|
e551838319 | ||
|
|
e5c80d41e8
|
||
|
|
5813e2dd82 | ||
|
|
c63b5da92b
|
||
|
|
4f57e38c95
|
||
|
|
bc0b7dd3ed | ||
|
|
9a055fba64
|
||
|
|
0e0b429f6b
|
||
|
|
e04c0778f5 | ||
|
|
52f151d476
|
||
|
|
af0a3d30da
|
||
|
|
ade25e5ba4 | ||
|
|
68afcb0b97
|
||
|
|
0621f261a1 | ||
|
|
c3d0407658
|
||
|
|
3e92d0329b | ||
|
|
56a7488e49
|
||
|
|
11207c884e | ||
|
|
ea1682e683
|
||
|
|
6f0b05d7df | ||
|
|
6466c42412
|
||
|
|
0b62699360
|
||
|
|
a7d05d021c | ||
|
|
ca38c3996b
|
||
|
|
b9d936973e | ||
|
|
f120127648
|
||
|
|
aa8a27b186
|
No files matched your search
+10
-2
@@ -51,6 +51,14 @@ dotnet_diagnostic.IDE0005.severity = warning # unnecessary using
|
||||
dotnet_diagnostic.CA1848.severity = none # LoggerMessage delegates: overkill here
|
||||
dotnet_diagnostic.MA0026.severity = suggestion # TODO comments: SonarCloud (S1135) already tracks them
|
||||
|
||||
[src/OmniDeck.App/**.cs]
|
||||
# UI code must resume on the dispatcher thread, so ConfigureAwait(false) is wrong here.
|
||||
[src/{OmniDeck.App,OmniDeck.Modules,OmniDeck.Web}/**.cs]
|
||||
# UI code (the shell, the modules and the web runner) must resume on the dispatcher thread, so ConfigureAwait(false) is wrong here.
|
||||
dotnet_diagnostic.MA0004.severity = none
|
||||
|
||||
[src/OmniDeck.Core/{Modules,Governor}/**.cs]
|
||||
# The module host and the governor drive module views from the dispatcher thread as well.
|
||||
dotnet_diagnostic.MA0004.severity = none
|
||||
|
||||
[tests/**.cs]
|
||||
# Tests await on the STA dispatcher (OdSta) or in xUnit's own context; xUnit1030 forbids ConfigureAwait(false) there.
|
||||
dotnet_diagnostic.MA0004.severity = none
|
||||
Binary file not shown.
@@ -51,24 +51,30 @@ jobs:
|
||||
- name: Restore pinned tools
|
||||
run: dotnet tool restore
|
||||
|
||||
# dotnet format loads the app with the XAML markup compiler, which needs OmniDeck.Core.dll on
|
||||
# disk to resolve {res:OdLoc ...}; without it the window classes lose their generated half and
|
||||
# the analyzers report phantom findings.
|
||||
- name: Build Core for the XAML compiler
|
||||
run: dotnet build src/OmniDeck.Core/OmniDeck.Core.csproj --no-restore
|
||||
|
||||
- name: Verify C# formatting
|
||||
run: dotnet format OmniDeck.slnx --verify-no-changes --no-restore
|
||||
|
||||
- name: Verify XAML formatting (XamlStyler)
|
||||
run: dotnet xstyler -c Settings.XamlStyler -d src -r -p
|
||||
|
||||
- name: Design tokens only in module views
|
||||
- name: Design tokens only in module and web views
|
||||
shell: pwsh
|
||||
run: |
|
||||
# docs/UI-MODES.md §2: module views consume Od.* tokens, never a literal FontSize.
|
||||
# docs/UI-MODES.md §2: module and web-runner views consume Od.* tokens, never a literal FontSize.
|
||||
$hits = Get-ChildItem -Path src -Recurse -Filter *.xaml |
|
||||
Where-Object { $_.FullName -match '[\\/]OmniDeck\.Modules[\\/]' } |
|
||||
Where-Object { $_.FullName -match '[\\/]OmniDeck\.(Modules|Web)[\\/]' } |
|
||||
Select-String -Pattern 'FontSize\s*=\s*"\s*\d'
|
||||
if ($hits) {
|
||||
$hits | ForEach-Object { Write-Host "::error file=$($_.Path),line=$($_.LineNumber)::Literal FontSize in a module view; use an Od.* token." }
|
||||
$hits | ForEach-Object { Write-Host "::error file=$($_.Path),line=$($_.LineNumber)::Literal FontSize in a module or web view; use an Od.* token." }
|
||||
exit 1
|
||||
}
|
||||
Write-Host 'No literal FontSize in module views.'
|
||||
Write-Host 'No literal FontSize in module or web views.'
|
||||
|
||||
- name: Build (Release, warnings are errors)
|
||||
run: dotnet build OmniDeck.slnx -c Release --no-restore
|
||||
|
||||
@@ -102,7 +102,9 @@ jobs:
|
||||
'/d:sonar.cs.vstest.reportsPaths=TestResults/*.trx',
|
||||
'/d:sonar.cs.roslyn.ignoreIssues=true',
|
||||
'/d:sonar.exclusions=**/bin/**,**/obj/**,**/TestResults/**,publish/**,Releases/**',
|
||||
'/d:sonar.coverage.exclusions=**/*.xaml.cs,**/Program.cs,scripts/**,.github/**'
|
||||
# Views, and the thin wrappers over the native engines (the WebView2 runtime, libVLC), run only
|
||||
# against those engines, which CI does not load; the logic around them is tested on its own.
|
||||
'/d:sonar.coverage.exclusions=**/*.xaml.cs,**/Program.cs,**/OdWebRuntime.cs,**/OdVlcEngine.cs,**/OdVlcPlayer.cs,scripts/**,.github/**'
|
||||
)
|
||||
dotnet sonarscanner @scannerArgs
|
||||
if ($LASTEXITCODE -ne 0) { throw "SonarScanner begin failed with exit code $LASTEXITCODE." }
|
||||
|
||||
@@ -25,5 +25,9 @@ bugreport-*.zip
|
||||
*.DotSettings.user
|
||||
.nuget/
|
||||
|
||||
# Python bytecode (CI helper scripts under .github/scripts)
|
||||
__pycache__/
|
||||
*.py[cod]
|
||||
|
||||
# Personal Claude Code settings (.claude/settings.json is shared and committed)
|
||||
.claude/settings.local.json
|
||||
+213
-1
@@ -6,6 +6,211 @@ All notable changes to OmniDeck are documented here. The format follows
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
## [0.2.0-alpha.3] — 2026-11-02
|
||||
|
||||
Third P2 alpha, the build to try out before 0.2.0: pop-out windows, web pages in full screen, an icon
|
||||
of its own, and fixes to the media player's controls.
|
||||
|
||||
### Added
|
||||
- Any module can open in a window of its own: choose "Open in new window" in its sidebar menu, or the
|
||||
window button on its library tile. It runs there beside whatever the main window shows, and OmniDeck
|
||||
never puts it to sleep while its window is open. Closing the window puts it back in the sidebar;
|
||||
"Return to main window" shows it there. Web apps and videos keep playing through the move, and the
|
||||
module's window goes full screen like the main window.
|
||||
- Web apps: a video, or anything else a page shows full screen, now fills the screen, and Esc goes
|
||||
back.
|
||||
- OmniDeck has an icon of its own, a white "O" on blue: on the program, its windows, the taskbar and
|
||||
the installer.
|
||||
|
||||
### Changed
|
||||
- Media: the Play/Pause button shows Pause while something plays.
|
||||
- The roadmap is re-baselined: P2 started on 2 November 2026, as soon as P1 was done. The README,
|
||||
the spec and the architecture notes now describe what P2 built.
|
||||
|
||||
### Fixed
|
||||
- Media: in full screen the picture started a few pixels from the left edge of the screen. It now
|
||||
fills the screen.
|
||||
- Media: beside the queue, the seek bar shrank to almost nothing, and at the window's default size
|
||||
the queue button was cut off. The seek bar now has a row of its own, and the volume slider gets
|
||||
shorter before anything is cut off.
|
||||
|
||||
## [0.2.0-alpha.2] — 2026-11-02
|
||||
|
||||
Second P2 alpha: the media player and the bug report join the web apps of alpha.1. Pop-out windows
|
||||
and the final polish come before 0.2.0.
|
||||
|
||||
### Added
|
||||
- Media: play your own music and videos. Add files, a folder or an .m3u playlist, or drop them on the
|
||||
player; the queue and where you stopped are kept for next time, and the queue can be saved as an
|
||||
.m3u. OmniDeck keeps the player running while something plays, and frees its memory once it has
|
||||
been paused and out of sight for a while. Its More menu picks the audio and subtitle tracks, adds
|
||||
a subtitle file and sets its encoding, plays from a quarter to four times the speed, sends the
|
||||
sound to another device, and saves a snapshot of the picture in Pictures\OmniDeck. A double-click
|
||||
on the video, or its full-screen button, fills the screen, and Esc goes back. While something is
|
||||
loaded, the tray menu names it and offers play or pause, next and previous.
|
||||
- Report a bug from Settings → About, or from the dialog that shows an error. OmniDeck shows the
|
||||
issue text first, then saves a report on this PC: the issue text, the version and Windows build,
|
||||
the modules and the memory they use, the end of the log and, for a web app, its console. It then
|
||||
opens a new GitHub issue in your browser with the short fields filled in. Nothing is sent: attach
|
||||
the report yourself. Addresses keep no query, and tokens, cookies, email addresses, long ids and
|
||||
your user name are taken out first. The ten newest reports are kept.
|
||||
|
||||
### Fixed
|
||||
- A dialog that opened while a web app was on screen could hide behind the page. The page now steps
|
||||
aside while a dialog is open.
|
||||
|
||||
## [0.2.0-alpha.1] — 2026-11-02
|
||||
|
||||
First P2 alpha, for trying the web apps out. The eight apps of the catalog run inside OmniDeck on
|
||||
Microsoft Edge WebView2, with their notifications, site permissions and memory figures, and Weather
|
||||
and Calendar join the built-in modules. The bug report, Media, pop-out windows and the final polish
|
||||
arrive in the next alphas.
|
||||
|
||||
### Added
|
||||
- Weather: forecasts from Open-Meteo for the places you save, found by searching for a city. It
|
||||
shows the conditions now, the next 48 hours and the next 7 days, in the units your region uses or
|
||||
the ones you pick. A forecast is fetched again at most every half hour, and only while Weather is
|
||||
on screen; without a connection it shows the last forecast and says how old it is.
|
||||
- Calendar: your own events in a month grid, a week list or a 30-day agenda, with repeats (daily,
|
||||
weekly, monthly or yearly, every so many, until a date) and reminders, which appear while OmniDeck
|
||||
is running. Import and export .ics files; repeats written by other calendar apps are kept as they
|
||||
are. One date of a series can be deleted without touching the rest.
|
||||
- OmniDeck keeps its list of web apps up to date: once a day it checks the list in this repository and,
|
||||
when there is a newer valid one, uses it from the next start.
|
||||
- Web apps: Spotify, Discord, YouTube, Gmail, Google Calendar, Google Drive, Google Maps and Facebook
|
||||
open inside OmniDeck like the built-in modules. The Google apps share one sign-in; every other app
|
||||
keeps its own. A link to another site opens in your default browser, while sign-in popups stay in
|
||||
the app. A web app that sleeps or is closed down to save memory comes back on the page it showed;
|
||||
one whose page crashes reloads by itself. Downloads go to your Downloads folder.
|
||||
- Web app notifications appear as Windows notifications under the app's name. Clicking one opens the
|
||||
app on what it was about. Settings → Web apps turns them on or off for each app. An app with
|
||||
notifications on keeps running while hidden, so it can still notify you; OmniDeck closes it only
|
||||
when memory runs short, and tells you when it does.
|
||||
- When a web app asks for your camera, microphone, location, clipboard or a similar permission,
|
||||
OmniDeck asks you above the app and remembers your answer for that app. Settings → Web apps lists
|
||||
the answers, lets an app ask again, and clears a group of apps' sign-in data.
|
||||
|
||||
### Changed
|
||||
- Clicking a notification opens the module that raised it: a finished timer opens Timer.
|
||||
- Settings → Memory shows what each open web app uses, and the browser processes they share in a row
|
||||
of their own. The memory limits count the web apps' processes too. When OmniDeck must free memory,
|
||||
it picks the app that uses more among those hidden for as long. When the shared processes alone
|
||||
keep it over the limit, OmniDeck says so instead of closing apps that would free nothing.
|
||||
- Quitting closes every open module first, so each one can save its state before OmniDeck exits. With
|
||||
web apps open, it also waits a moment for the browser to save its cookies, so you stay signed in.
|
||||
- OmniDeck re-styles its windows only when Windows' dark or light mode, accent color, High Contrast or
|
||||
animation setting changes, not on every settings broadcast from Windows.
|
||||
|
||||
## [0.1.1] — 2026-11-02
|
||||
|
||||
A fix release for 0.1.0. Picking accent colors, or Windows changing a theme setting, could make
|
||||
OmniDeck run out of Windows graphics handles, show "A generic error occurred in GDI+" over and over,
|
||||
and stop drawing its window. Installed copies find this update in Settings → About, and say so in a
|
||||
notification within a day.
|
||||
|
||||
### Fixed
|
||||
- Changing the accent color no longer ends in "Something went wrong… A generic error occurred in
|
||||
GDI+". The notification-area icon leaked a Windows graphics handle every time it was redrawn in a
|
||||
new color, and each change redrew it more often than the last, so after enough color or theme
|
||||
changes OmniDeck ran out of handles and could stop drawing its window. The icon is now drawn by
|
||||
OmniDeck itself and redrawn only when the color actually changes.
|
||||
- Toggle switches take a newly picked accent color at once. Before, they kept the previous color
|
||||
until the next change.
|
||||
- An error that keeps repeating is now reported once a minute, with a count of the repeats, instead
|
||||
of every time, so a single fault can no longer stack error dialogs or fill the logs.
|
||||
- Logs are kept for seven days, as the privacy policy says. Before, a burst of errors could push out
|
||||
the whole week of logs before it.
|
||||
|
||||
## [0.1.0] — 2026-10-30
|
||||
|
||||
The first installable OmniDeck, closing phase P1. It brings the shell with its sidebar, module
|
||||
library, command palette and notification-area icon, plus the RAM governor and its panel. It also
|
||||
has the clock, timer and calculator, the settings, legal documents and onboarding, and updates from
|
||||
inside the app. The 0.1.0-alpha.1 and 0.1.0-alpha.2 notes list all of it in detail. Web apps,
|
||||
weather, calendar, stocks and media arrive in P2 and P3.
|
||||
|
||||
### Added
|
||||
- Keyboard shortcuts: Ctrl+1 to Ctrl+9 open the modules in the sidebar, in order, and Ctrl+, opens
|
||||
Settings; Ctrl+K still opens the command palette.
|
||||
- Installed copies check for updates a few minutes after starting and then once a day, and say so in
|
||||
a notification when a new version is out. Opening Settings → About checks too. Nothing downloads
|
||||
until you choose to.
|
||||
|
||||
### Changed
|
||||
- The sidebar follows the layout preset as you switch: Dynamic shows icons only, with each name in a
|
||||
tooltip, and Comfort shows at most six modules, always including the one on screen.
|
||||
|
||||
### Fixed
|
||||
- The command palette shrinks to fit a short list of results.
|
||||
- With High Contrast on, Windows' colors win over a custom accent color.
|
||||
- Lines and borders in the legal documents follow the theme, High Contrast included.
|
||||
- Screen readers announce the layout presets and settings choices by their names.
|
||||
|
||||
## [0.1.0-alpha.2] — 2026-10-30
|
||||
|
||||
Second alpha: the settings pages, the legal gate and onboarding. It is also the first build that can
|
||||
update itself. 0.1.0-alpha.1 cannot, so install this one over it with its `Setup.exe` and choose to
|
||||
overwrite; your settings and data stay. From here on, Settings → About → Check for updates finds new
|
||||
releases.
|
||||
|
||||
### Added
|
||||
- First run: the license agreement, disclaimer, privacy policy and third-party notices, shown from the
|
||||
app's `legal` folder, to acknowledge before OmniDeck opens (again after each legal update). Then a
|
||||
short setup picks the language and the layout preset.
|
||||
- Settings: General (language, keep running in the notification area, start with Windows), Appearance
|
||||
(theme, layout preset, text size, animations, accent color), Memory (the governor's thresholds and
|
||||
the running modules), Data (open the data folder, export and import settings) and About (version,
|
||||
update check, links, the legal documents).
|
||||
- Starting with Windows opens OmniDeck straight to the notification area.
|
||||
|
||||
### Changed
|
||||
- Running modules moved from the sidebar into Settings → Memory; the command palette opens it too.
|
||||
|
||||
## [0.1.0-alpha.1] — 2026-10-30
|
||||
|
||||
First alpha, for trying OmniDeck out: the shell, the RAM governor and three built-in modules. Web
|
||||
apps, weather, calendar, stocks and media arrive in P2–P3, and the settings pages, legal gate and
|
||||
onboarding in the next alpha.
|
||||
|
||||
### Added
|
||||
- One OmniDeck per Windows session: starting it again brings the running window to the front.
|
||||
- Settings stored in `%LocalAppData%\OmniDeck.Data\settings.json`, written atomically. A damaged
|
||||
file is set aside and defaults take over.
|
||||
- Local log files in `%LocalAppData%\OmniDeck.Data\logs`, kept for seven days, plus crash handling
|
||||
that shows a support code and keeps OmniDeck running.
|
||||
- Uninstalling removes `%LocalAppData%\OmniDeck.Data`, as the privacy policy promises.
|
||||
- A local database, `%LocalAppData%\OmniDeck.Data\omnideck.db`, with a versioned schema that
|
||||
upgrades itself at startup.
|
||||
- The window follows Windows: light or dark mode, the accent color, High Contrast and the text size.
|
||||
- The shell: a sidebar with pinned and open modules, a module library to open and pin them from,
|
||||
and a command palette (Ctrl+K, or the search box in the title bar) that finds modules and commands.
|
||||
- Closing the window keeps OmniDeck running in the notification area; its icon's menu opens or quits
|
||||
it. Modules can raise Windows notifications from there.
|
||||
- The RAM governor: modules hidden for 5 minutes are suspended and after 30 minutes hibernated.
|
||||
Above a soft memory limit the least recently used one is hibernated; above a hard limit as many as
|
||||
it takes, with a notification. The limits default to min(4.5 GB, 35 % of RAM) and min(6 GB, 50 %).
|
||||
- Running modules (the sidebar's Memory item): every module's state and last use, memory in use
|
||||
against the limits, and Suspend, Hibernate, Close and Keep running controls.
|
||||
- Clock: local time and any number of world clocks, in 12- or 24-hour time, with each zone's offset
|
||||
from here. The zones are remembered.
|
||||
- Timer: countdowns with presets (1, 5, 10 and 25 minutes) or a custom length and name, and a
|
||||
stopwatch with laps. A finished countdown raises a Windows notification, also from the
|
||||
notification area, and the tray menu starts a 5-minute timer. Timers run only while OmniDeck
|
||||
runs, as the module says.
|
||||
- Calculator: standard and scientific keypads (degrees or radians), keyboard input, the session's
|
||||
history, and copying the result.
|
||||
|
||||
### Changed
|
||||
- Stocks: Twelve Data with the user's own API key is now the only provider. Stooq was dropped because
|
||||
its download endpoints now block scripted clients (P0 spike #7). The free Twelve Data plan covers US
|
||||
listings; home-market EU listings and indices need a paid plan.
|
||||
- Legal documents (EULA, disclaimer, privacy policy) are now version 1.1, and the third-party notices
|
||||
follow: Stooq and Messenger are no longer mentioned.
|
||||
|
||||
### Removed
|
||||
- Messenger from the web app catalog: Meta closed messenger.com on 15 April 2026 and sends web
|
||||
users to `facebook.com/messages`, which the Facebook entry already covers.
|
||||
|
||||
## [0.0.1-alpha.1] — 2026-10-28
|
||||
|
||||
Kickoff build. It proves the build, packaging, and release pipeline end to end and has no
|
||||
@@ -30,5 +235,12 @@ user-facing features yet: the window only shows the version.
|
||||
- Supported platform narrowed to Windows 11 (24H2 or later), x64.
|
||||
- App data moves to `%LocalAppData%\OmniDeck.Data`, outside Velopack's install folder.
|
||||
|
||||
[Unreleased]: https://github.com/poli0981/OmniDeck/compare/v0.0.1-alpha.1...HEAD
|
||||
[Unreleased]: https://github.com/poli0981/OmniDeck/compare/v0.2.0-alpha.3...HEAD
|
||||
[0.2.0-alpha.3]: https://github.com/poli0981/OmniDeck/compare/v0.2.0-alpha.2...v0.2.0-alpha.3
|
||||
[0.2.0-alpha.2]: https://github.com/poli0981/OmniDeck/compare/v0.2.0-alpha.1...v0.2.0-alpha.2
|
||||
[0.2.0-alpha.1]: https://github.com/poli0981/OmniDeck/compare/v0.1.1...v0.2.0-alpha.1
|
||||
[0.1.1]: https://github.com/poli0981/OmniDeck/compare/v0.1.0...v0.1.1
|
||||
[0.1.0]: https://github.com/poli0981/OmniDeck/compare/v0.1.0-alpha.2...v0.1.0
|
||||
[0.1.0-alpha.2]: https://github.com/poli0981/OmniDeck/compare/v0.1.0-alpha.1...v0.1.0-alpha.2
|
||||
[0.1.0-alpha.1]: https://github.com/poli0981/OmniDeck/compare/v0.0.1-alpha.1...v0.1.0-alpha.1
|
||||
[0.0.1-alpha.1]: https://github.com/poli0981/OmniDeck/releases/tag/v0.0.1-alpha.1
|
||||
+8
-1
@@ -19,6 +19,13 @@ dotnet test OmniDeck.slnx
|
||||
dotnet run --project src/OmniDeck.App
|
||||
```
|
||||
|
||||
To run a development build beside an installed OmniDeck, give it a data root of its own. Only Debug builds read the variable, so the installed copy keeps its settings, sign-ins and database, and the two run side by side:
|
||||
|
||||
```powershell
|
||||
$env:OMNIDECK_DATA_ROOT = "$env:TEMP\OmniDeck.Dev"
|
||||
dotnet run --project src/OmniDeck.App
|
||||
```
|
||||
|
||||
## Code style & quality gates (enforced in CI)
|
||||
|
||||
- `.editorconfig` is authoritative. `dotnet format OmniDeck.slnx --verify-no-changes` must pass.
|
||||
@@ -43,7 +50,7 @@ dotnet run --project src/OmniDeck.App
|
||||
|
||||
## Reporting bugs
|
||||
|
||||
Prefer the in-app **About → Report bug** flow (from P2) — it captures the console errors and logs the template asks for. For web app issues, include the console errors it captured; "it doesn't work" without details is triaged last.
|
||||
Prefer the in-app **Settings → About → Report a bug** flow — it captures the console errors and logs the template asks for. For web app issues, include the console errors it captured; "it doesn't work" without details is triaged last.
|
||||
|
||||
## Contact
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
<RepositoryUrl>https://github.com/poli0981/OmniDeck</RepositoryUrl>
|
||||
<PackageProjectUrl>https://github.com/poli0981/OmniDeck</PackageProjectUrl>
|
||||
<RepositoryType>git</RepositoryType>
|
||||
<Version>0.0.1-alpha.1</Version>
|
||||
<Version>0.2.0-alpha.3</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- Build-time analyzers (warnings are errors). They live here rather than in each .csproj:
|
||||
@@ -63,7 +63,7 @@
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Meziantou.Analyzer" Version="3.0.317">
|
||||
<PackageReference Include="Meziantou.Analyzer" Version="3.0.318">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
<Folder Name="/src/">
|
||||
<Project Path="src/OmniDeck.App/OmniDeck.App.csproj" />
|
||||
<Project Path="src/OmniDeck.Core/OmniDeck.Core.csproj" />
|
||||
<Project Path="src/OmniDeck.Modules/OmniDeck.Modules.csproj" />
|
||||
<Project Path="src/OmniDeck.Web/OmniDeck.Web.csproj" />
|
||||
</Folder>
|
||||
<Folder Name="/tests/">
|
||||
<Project Path="tests/OmniDeck.Tests/OmniDeck.Tests.csproj" />
|
||||
|
||||
@@ -2,23 +2,24 @@
|
||||
|
||||
> One deck for your everyday apps — a Windows 11 host for native mini-apps and curated web apps.
|
||||
|
||||
[](docs/ROADMAP.md)
|
||||
[](docs/ROADMAP.md)
|
||||
[](#install)
|
||||
[](LICENSE)
|
||||
[](https://dotnet.microsoft.com/)
|
||||
[](https://github.com/poli0981/OmniDeck/actions/workflows/ci.yml)
|
||||
[](https://sonarcloud.io/summary/new_code?id=poli0981_OmniDeck)
|
||||
|
||||
OmniDeck combines a set of lightweight native mini-apps (weather, calculator, stocks, media player, clock, timer, calendar) with a curated runner for popular web apps (Spotify, Discord, YouTube, Gmail, Google Calendar, Google Drive, Google Maps, Facebook, Messenger) — no separate installs, one window, one tray icon.
|
||||
OmniDeck combines a set of lightweight native mini-apps (weather, calculator, stocks, media player, clock, timer, calendar) with a curated runner for popular web apps (Spotify, Discord, YouTube, Gmail, Google Calendar, Google Drive, Google Maps, Facebook) — no separate installs, one window, one tray icon.
|
||||
|
||||
It is built on WPF (.NET 10 LTS) and **WebView2**, which reuses the Edge runtime that ships with Windows 11 instead of bundling a browser engine. That is what keeps the installer small while still running full web apps.
|
||||
|
||||
**Project status: pre-alpha.** Development starts with phase P0 on 2 November 2026; the 0.9 public beta is planned for April 2027 and v1.0 for May 2027 ([roadmap](docs/ROADMAP.md)). Builds published before then are pipeline and development builds without the features below — follow along, but don't install them expecting a working app yet.
|
||||
**Project status: alpha.** 0.2.0-alpha.2 (phase P2) runs the curated web apps beside the clock, timer, calculator, weather, calendar and media player, with pop-out windows and an in-app bug report. Stocks, the polished Dynamic and Comfort presets, and the Vietnamese and Japanese translations come in P3; the 0.9 public beta is planned for April 2027 and v1.0 for May 2027 ([roadmap](docs/ROADMAP.md)). Until then, expect missing features and changes between versions.
|
||||
|
||||
## Planned features (v1.0)
|
||||
|
||||
- **Native mini-apps** — clock & world clocks, countdown timer, calculator, weather (Open-Meteo), local calendar with `.ics` import/export, stock watchlist with candlestick charts (US/EU markets), and a full-codec media player (libVLC).
|
||||
- **Curated web apps** — each runs in its own WebView2 profile with a per-app navigation allowlist. Web notifications become Windows toasts. Adding a new app is a JSON entry, not a release ([catalog docs](docs/WEBAPP-CATALOG.md)).
|
||||
- **Pop-out windows** — any module can move into a window of its own, and go full screen there.
|
||||
- **RAM governor** — inactive modules are automatically suspended and then hibernated, with a hard memory cap. A built-in task-manager panel shows per-module RAM with manual suspend/kill ([details](docs/RAM-GOVERNOR.md)).
|
||||
- **Three UI presets** — Dynamic, Standard, and Comfort, implemented as design-token presets over one theme engine, with per-token overrides ([details](docs/UI-MODES.md)).
|
||||
- **Privacy** — zero telemetry, zero data collection. Everything is stored locally ([privacy policy](docs/legal/PRIVACY.md)).
|
||||
@@ -32,21 +33,21 @@ Running web apps means running Chromium processes. OmniDeck manages this aggress
|
||||
|
||||
These are properties of the web versions of the services, documented here so they are not reported as OmniDeck bugs:
|
||||
|
||||
- **Spotify** runs the Web Player: audio quality is lower than the desktop app, and playback requires DRM (Widevine) support in the WebView2 runtime. A P0 spike decides whether the entry ships; if DRM is unavailable, it ships disabled with an explanation (see the [ROADMAP](docs/ROADMAP.md) risk register).
|
||||
- **Discord** web has no native global push-to-talk and limited screen sharing. OmniDeck provides a host-side global hotkey as partial mitigation.
|
||||
- **Spotify** runs the Web Player: audio quality is lower than the desktop app, and playback relies on DRM (Widevine), which ships with the WebView2 runtime (P0 spike #1). If a future runtime drops it, the entry is disabled with an explanation (see the [ROADMAP](docs/ROADMAP.md) risk register).
|
||||
- **Discord** web has no native global push-to-talk and limited screen sharing. A host-side global hotkey is on the roadmap's backlog.
|
||||
- Web app availability, layout, and sign-in flows are controlled by the respective service providers and can change or break at any time.
|
||||
|
||||
## Install
|
||||
|
||||
1. Requirements: **Windows 11 (24H2 or later), x64.** Windows 10 is not supported. The Microsoft Edge **WebView2 Runtime** ships with Windows 11.
|
||||
2. Download a build from [Releases](https://github.com/poli0981/OmniDeck/releases) and run `OmniDeck-win-Setup.exe` (per-user, no admin required). Every version before 1.0 is published as a **pre-release** for testing.
|
||||
3. On first run (from P1 on), review and acknowledge the legal documents (EULA, disclaimer, privacy policy, third-party notices), then pick a UI preset and language.
|
||||
3. On first run, review and acknowledge the legal documents (EULA, disclaimer, privacy policy, third-party notices), then pick a UI preset and language.
|
||||
|
||||
Updates are delivered in-app via Velopack; you can also check manually from **About**. Builds are not yet Authenticode-signed, so Windows SmartScreen may warn about an unknown publisher — see [SECURITY](SECURITY.md) for how to verify a download.
|
||||
|
||||
## Reporting bugs
|
||||
|
||||
Use **About → Report bug** inside the app (from P2). It pre-fills a GitHub issue with the app version, OS build, active modules, and captured console errors from the affected web app, and saves a `bugreport-*.zip` (logs) to `%LocalAppData%\OmniDeck.Data\reports` that you can attach. Sensitive values (query strings, cookies, tokens) are scrubbed before packaging. You can also file manually with the [bug template](https://github.com/poli0981/OmniDeck/issues/new?template=bug_report.yml).
|
||||
Use **Settings → About → Report a bug** inside the app, or **Report bug** on an error dialog. OmniDeck shows the report first, then saves a `bugreport-*.zip` to `%LocalAppData%\OmniDeck.Data\reports` (the issue text, the version and Windows build, the modules and their memory, the end of the log and, for a web app, its console), shows it in Explorer, and opens a GitHub issue with the short fields filled in. Nothing is uploaded: attach the zip yourself. Addresses lose their query strings, and tokens, cookies, email addresses, long ids and your user name are taken out first. You can also file manually with the [bug template](https://github.com/poli0981/OmniDeck/issues/new?template=bug_report.yml).
|
||||
|
||||
## Documentation
|
||||
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@ These are design requirements from the [SPEC](docs/SPEC.md); each one is enforce
|
||||
- Web apps run only from the reviewed catalog: per-app navigation allowlists, per-app cookie profiles, SSO popups restricted to listed identity domains, everything else opens in your default browser.
|
||||
- Release builds disable the WebView2 DevTools UI and browser password autosave/autofill; OmniDeck never sees or stores web credentials.
|
||||
- The only secret the app stores (optional Twelve Data API key) is encrypted with Windows DPAPI, current-user scope.
|
||||
- All service calls (Open-Meteo, Stooq, Twelve Data, GitHub) are HTTPS-only.
|
||||
- All service calls (Open-Meteo, Twelve Data, GitHub) are HTTPS-only.
|
||||
- Bug reports scrub query strings, cookie values, and token-shaped strings before packaging; nothing is ever uploaded automatically — you attach the zip yourself.
|
||||
- No telemetry, no analytics, no crash auto-upload (see [PRIVACY](docs/legal/PRIVACY.md)).
|
||||
|
||||
|
||||
+201
-15
@@ -1,14 +1,205 @@
|
||||
{
|
||||
"$schema": "./webapps.schema.json",
|
||||
"schemaVersion": 1,
|
||||
"updated": "2026-07-17",
|
||||
"schemaVersion": 2,
|
||||
"updated": "2026-11-03",
|
||||
"navAllowSets": {
|
||||
"google-account-domains": [
|
||||
"accounts.google.ad",
|
||||
"accounts.google.ae",
|
||||
"accounts.google.al",
|
||||
"accounts.google.am",
|
||||
"accounts.google.as",
|
||||
"accounts.google.at",
|
||||
"accounts.google.az",
|
||||
"accounts.google.ba",
|
||||
"accounts.google.be",
|
||||
"accounts.google.bf",
|
||||
"accounts.google.bg",
|
||||
"accounts.google.bi",
|
||||
"accounts.google.bj",
|
||||
"accounts.google.bs",
|
||||
"accounts.google.bt",
|
||||
"accounts.google.by",
|
||||
"accounts.google.ca",
|
||||
"accounts.google.cat",
|
||||
"accounts.google.cd",
|
||||
"accounts.google.cf",
|
||||
"accounts.google.cg",
|
||||
"accounts.google.ch",
|
||||
"accounts.google.ci",
|
||||
"accounts.google.cl",
|
||||
"accounts.google.cm",
|
||||
"accounts.google.cn",
|
||||
"accounts.google.co.ao",
|
||||
"accounts.google.co.bw",
|
||||
"accounts.google.co.ck",
|
||||
"accounts.google.co.cr",
|
||||
"accounts.google.co.id",
|
||||
"accounts.google.co.il",
|
||||
"accounts.google.co.in",
|
||||
"accounts.google.co.jp",
|
||||
"accounts.google.co.ke",
|
||||
"accounts.google.co.kr",
|
||||
"accounts.google.co.ls",
|
||||
"accounts.google.co.ma",
|
||||
"accounts.google.co.mz",
|
||||
"accounts.google.co.nz",
|
||||
"accounts.google.co.th",
|
||||
"accounts.google.co.tz",
|
||||
"accounts.google.co.ug",
|
||||
"accounts.google.co.uk",
|
||||
"accounts.google.co.uz",
|
||||
"accounts.google.co.ve",
|
||||
"accounts.google.co.vi",
|
||||
"accounts.google.co.za",
|
||||
"accounts.google.co.zm",
|
||||
"accounts.google.co.zw",
|
||||
"accounts.google.com.af",
|
||||
"accounts.google.com.ag",
|
||||
"accounts.google.com.ar",
|
||||
"accounts.google.com.au",
|
||||
"accounts.google.com.bd",
|
||||
"accounts.google.com.bh",
|
||||
"accounts.google.com.bn",
|
||||
"accounts.google.com.bo",
|
||||
"accounts.google.com.br",
|
||||
"accounts.google.com.bz",
|
||||
"accounts.google.com.co",
|
||||
"accounts.google.com.cu",
|
||||
"accounts.google.com.cy",
|
||||
"accounts.google.com.do",
|
||||
"accounts.google.com.ec",
|
||||
"accounts.google.com.eg",
|
||||
"accounts.google.com.et",
|
||||
"accounts.google.com.fj",
|
||||
"accounts.google.com.gh",
|
||||
"accounts.google.com.gi",
|
||||
"accounts.google.com.gt",
|
||||
"accounts.google.com.hk",
|
||||
"accounts.google.com.jm",
|
||||
"accounts.google.com.kh",
|
||||
"accounts.google.com.kw",
|
||||
"accounts.google.com.lb",
|
||||
"accounts.google.com.ly",
|
||||
"accounts.google.com.mm",
|
||||
"accounts.google.com.mt",
|
||||
"accounts.google.com.mx",
|
||||
"accounts.google.com.my",
|
||||
"accounts.google.com.na",
|
||||
"accounts.google.com.ng",
|
||||
"accounts.google.com.ni",
|
||||
"accounts.google.com.np",
|
||||
"accounts.google.com.om",
|
||||
"accounts.google.com.pa",
|
||||
"accounts.google.com.pe",
|
||||
"accounts.google.com.pg",
|
||||
"accounts.google.com.ph",
|
||||
"accounts.google.com.pk",
|
||||
"accounts.google.com.pr",
|
||||
"accounts.google.com.py",
|
||||
"accounts.google.com.qa",
|
||||
"accounts.google.com.sa",
|
||||
"accounts.google.com.sb",
|
||||
"accounts.google.com.sg",
|
||||
"accounts.google.com.sl",
|
||||
"accounts.google.com.sv",
|
||||
"accounts.google.com.tj",
|
||||
"accounts.google.com.tr",
|
||||
"accounts.google.com.tw",
|
||||
"accounts.google.com.ua",
|
||||
"accounts.google.com.uy",
|
||||
"accounts.google.com.vc",
|
||||
"accounts.google.com.vn",
|
||||
"accounts.google.cv",
|
||||
"accounts.google.cz",
|
||||
"accounts.google.de",
|
||||
"accounts.google.dj",
|
||||
"accounts.google.dk",
|
||||
"accounts.google.dm",
|
||||
"accounts.google.dz",
|
||||
"accounts.google.ee",
|
||||
"accounts.google.es",
|
||||
"accounts.google.fi",
|
||||
"accounts.google.fm",
|
||||
"accounts.google.fr",
|
||||
"accounts.google.ga",
|
||||
"accounts.google.ge",
|
||||
"accounts.google.gg",
|
||||
"accounts.google.gl",
|
||||
"accounts.google.gm",
|
||||
"accounts.google.gr",
|
||||
"accounts.google.gy",
|
||||
"accounts.google.hn",
|
||||
"accounts.google.hr",
|
||||
"accounts.google.ht",
|
||||
"accounts.google.hu",
|
||||
"accounts.google.ie",
|
||||
"accounts.google.im",
|
||||
"accounts.google.iq",
|
||||
"accounts.google.is",
|
||||
"accounts.google.it",
|
||||
"accounts.google.je",
|
||||
"accounts.google.jo",
|
||||
"accounts.google.kg",
|
||||
"accounts.google.ki",
|
||||
"accounts.google.kz",
|
||||
"accounts.google.la",
|
||||
"accounts.google.li",
|
||||
"accounts.google.lk",
|
||||
"accounts.google.lt",
|
||||
"accounts.google.lu",
|
||||
"accounts.google.lv",
|
||||
"accounts.google.md",
|
||||
"accounts.google.me",
|
||||
"accounts.google.mg",
|
||||
"accounts.google.mk",
|
||||
"accounts.google.ml",
|
||||
"accounts.google.mn",
|
||||
"accounts.google.mu",
|
||||
"accounts.google.mv",
|
||||
"accounts.google.mw",
|
||||
"accounts.google.ne",
|
||||
"accounts.google.nl",
|
||||
"accounts.google.no",
|
||||
"accounts.google.nr",
|
||||
"accounts.google.nu",
|
||||
"accounts.google.pl",
|
||||
"accounts.google.pn",
|
||||
"accounts.google.ps",
|
||||
"accounts.google.pt",
|
||||
"accounts.google.ro",
|
||||
"accounts.google.rs",
|
||||
"accounts.google.ru",
|
||||
"accounts.google.rw",
|
||||
"accounts.google.sc",
|
||||
"accounts.google.se",
|
||||
"accounts.google.sh",
|
||||
"accounts.google.si",
|
||||
"accounts.google.sk",
|
||||
"accounts.google.sm",
|
||||
"accounts.google.sn",
|
||||
"accounts.google.so",
|
||||
"accounts.google.sr",
|
||||
"accounts.google.st",
|
||||
"accounts.google.td",
|
||||
"accounts.google.tg",
|
||||
"accounts.google.tl",
|
||||
"accounts.google.tm",
|
||||
"accounts.google.tn",
|
||||
"accounts.google.to",
|
||||
"accounts.google.tt",
|
||||
"accounts.google.vu",
|
||||
"accounts.google.ws"
|
||||
]
|
||||
},
|
||||
"apps": [
|
||||
{
|
||||
"id": "spotify",
|
||||
"name": "Spotify",
|
||||
"startUrl": "https://open.spotify.com/",
|
||||
"profile": "spotify",
|
||||
"navAllow": ["spotify.com", "spotifycdn.com", "scdn.co"],
|
||||
"navAllow": ["spotify.com", "spotifycdn.com", "scdn.co", "accounts.google.com", "www.facebook.com", "appleid.apple.com"],
|
||||
"navAllowSets": ["google-account-domains"],
|
||||
"popupAllow": ["accounts.spotify.com"],
|
||||
"notifications": false,
|
||||
"audioPin": true
|
||||
@@ -21,7 +212,7 @@
|
||||
"navAllow": ["discord.com", "discordapp.com", "discord.gg", "discordapp.net"],
|
||||
"popupAllow": ["discord.com"],
|
||||
"notifications": true,
|
||||
"audioPin": false
|
||||
"audioPin": true
|
||||
},
|
||||
{
|
||||
"id": "youtube",
|
||||
@@ -29,6 +220,7 @@
|
||||
"startUrl": "https://www.youtube.com/",
|
||||
"profile": "google",
|
||||
"navAllow": ["youtube.com", "google.com", "googlevideo.com", "ytimg.com", "ggpht.com", "gstatic.com"],
|
||||
"navAllowSets": ["google-account-domains"],
|
||||
"popupAllow": ["accounts.google.com"],
|
||||
"notifications": true,
|
||||
"audioPin": true
|
||||
@@ -39,6 +231,7 @@
|
||||
"startUrl": "https://mail.google.com/",
|
||||
"profile": "google",
|
||||
"navAllow": ["google.com", "googleusercontent.com", "gstatic.com"],
|
||||
"navAllowSets": ["google-account-domains"],
|
||||
"popupAllow": ["accounts.google.com"],
|
||||
"notifications": true,
|
||||
"audioPin": false
|
||||
@@ -49,6 +242,7 @@
|
||||
"startUrl": "https://calendar.google.com/",
|
||||
"profile": "google",
|
||||
"navAllow": ["google.com", "googleusercontent.com", "gstatic.com"],
|
||||
"navAllowSets": ["google-account-domains"],
|
||||
"popupAllow": ["accounts.google.com"],
|
||||
"notifications": true,
|
||||
"audioPin": false
|
||||
@@ -59,6 +253,7 @@
|
||||
"startUrl": "https://drive.google.com/",
|
||||
"profile": "google",
|
||||
"navAllow": ["google.com", "googleusercontent.com", "gstatic.com"],
|
||||
"navAllowSets": ["google-account-domains"],
|
||||
"popupAllow": ["accounts.google.com"],
|
||||
"notifications": true,
|
||||
"audioPin": false
|
||||
@@ -69,6 +264,7 @@
|
||||
"startUrl": "https://www.google.com/maps",
|
||||
"profile": "google",
|
||||
"navAllow": ["google.com", "googleusercontent.com", "gstatic.com", "googleapis.com"],
|
||||
"navAllowSets": ["google-account-domains"],
|
||||
"popupAllow": ["accounts.google.com"],
|
||||
"notifications": false,
|
||||
"audioPin": false
|
||||
@@ -81,17 +277,7 @@
|
||||
"navAllow": ["facebook.com", "fbcdn.net", "fbsbx.com"],
|
||||
"popupAllow": ["facebook.com"],
|
||||
"notifications": true,
|
||||
"audioPin": false
|
||||
},
|
||||
{
|
||||
"id": "messenger",
|
||||
"name": "Messenger",
|
||||
"startUrl": "https://www.messenger.com/",
|
||||
"profile": "meta",
|
||||
"navAllow": ["messenger.com", "facebook.com", "fbcdn.net", "fbsbx.com"],
|
||||
"popupAllow": ["facebook.com", "messenger.com"],
|
||||
"notifications": true,
|
||||
"audioPin": false
|
||||
"audioPin": true
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -11,13 +11,24 @@
|
||||
"description": "Editor hint pointing at this schema; ignored by the app."
|
||||
},
|
||||
"schemaVersion": {
|
||||
"const": 1
|
||||
"const": 2
|
||||
},
|
||||
"updated": {
|
||||
"type": "string",
|
||||
"description": "Date of the last content change (yyyy-MM-dd).",
|
||||
"pattern": "^\\d{4}-\\d{2}-\\d{2}$"
|
||||
},
|
||||
"navAllowSets": {
|
||||
"type": "object",
|
||||
"description": "Named lists of domains that entries add to their navAllow by name, for lists too long to repeat in each entry.",
|
||||
"propertyNames": { "$ref": "#/$defs/slug" },
|
||||
"additionalProperties": {
|
||||
"type": "array",
|
||||
"minItems": 1,
|
||||
"uniqueItems": true,
|
||||
"items": { "$ref": "#/$defs/domain" }
|
||||
}
|
||||
},
|
||||
"apps": {
|
||||
"type": "array",
|
||||
"minItems": 1,
|
||||
@@ -67,6 +78,13 @@
|
||||
"uniqueItems": true,
|
||||
"items": { "$ref": "#/$defs/domain" }
|
||||
},
|
||||
"navAllowSets": {
|
||||
"type": "array",
|
||||
"description": "Names of top-level navAllowSets whose domains the main frame may also navigate to.",
|
||||
"minItems": 1,
|
||||
"uniqueItems": true,
|
||||
"items": { "$ref": "#/$defs/slug" }
|
||||
},
|
||||
"popupAllow": {
|
||||
"type": "array",
|
||||
"description": "Domains whose popups open in-app on the same profile (SSO flows).",
|
||||
|
||||
+90
-21
@@ -10,18 +10,19 @@ Directory.Build.props shared build settings: nullable, warnings as errors, anal
|
||||
NuGet Audit, product metadata and dev-build version
|
||||
global.json pinned .NET SDK
|
||||
.config/ dotnet-tools.json: vpk, dotnet-sonarscanner, XamlStyler
|
||||
scripts/ pack.ps1 (publish + Velopack), validate-catalog.ps1
|
||||
scripts/ pack.ps1 (publish + Velopack), validate-catalog.ps1, make-icon.ps1
|
||||
src/
|
||||
OmniDeck.App/ WPF shell: windows, navigation, tray, command palette,
|
||||
theme engine, legal gate, settings UI, task-manager panel
|
||||
OmniDeck.Core/ contracts (IOdModule, IOdQuoteProvider, ...), RAM governor,
|
||||
storage (SQLite/Dapper, settings), toast service,
|
||||
bug-report composer, update service (Velopack), i18n helpers
|
||||
OmniDeck.App/ WPF shell: windows, navigation, tray and notifications, command
|
||||
palette, theme engine, legal gate, onboarding, settings UI,
|
||||
task-manager panel, update service (Velopack)
|
||||
OmniDeck.Core/ contracts (IOdModule, IOdNotifier, IOdQuoteProvider, ...), module
|
||||
host, RAM governor, storage (SQLite/Dapper, settings), theme
|
||||
tokens, legal acknowledgment, bug-report composer, i18n helpers
|
||||
OmniDeck.Modules/ built-in mini-apps: Clock, Timer, Calculator, Weather,
|
||||
Calendar, Stocks, Media — one folder per module (P1)
|
||||
OmniDeck.Web/ web runner: environment/profile management, catalog loader,
|
||||
navigation policy, notifications bridge, permissions,
|
||||
downloads, CDP console capture (P2)
|
||||
sign-in health, CDP console capture (P2)
|
||||
tests/
|
||||
OmniDeck.Tests/ xUnit v3; governor state machine, providers, catalog validation,
|
||||
scrubber, rate limiter
|
||||
@@ -30,12 +31,14 @@ catalog/
|
||||
webapps.schema.json its JSON Schema (CI validation, editor completion)
|
||||
```
|
||||
|
||||
State at kickoff: `OmniDeck.App` (Velopack bootstrap + a placeholder `FluentWindow`), `OmniDeck.Core` (`OdVersionInfo`) and `OmniDeck.Tests` exist. `OmniDeck.Modules` and `OmniDeck.Web` are created when their first real code lands (P1/P2), so the build never carries empty projects.
|
||||
State at kickoff: `OmniDeck.App` (Velopack bootstrap + a placeholder `FluentWindow`), `OmniDeck.Core` (`OdVersionInfo`) and `OmniDeck.Tests` exist. `OmniDeck.Modules` and `OmniDeck.Web` are created when their first real code lands (P1/P2), so the build never carries empty projects. `OmniDeck.Modules` arrived in P1 with Clock, Timer and Calculator: it references Core (and WPF-UI for its views) but never the app, registers its modules with `AddOmniDeckModules()`, and keeps its own string table. `OmniDeck.Web` arrived in P2 the same way: it references Core, the WebView2 SDK and WPF-UI but never the app or `OmniDeck.Modules`, and `AddOmniDeckWeb(catalog, options)` registers the catalog service, the runtime and one module per catalog entry, after the built-in modules. Durable module state lives outside the views, in a service (`OdTimerService`), a view model the module keeps (the calculator's history), or the module's settings document (the clock's zones), so hibernating a view loses nothing.
|
||||
|
||||
Naming: namespace `OmniDeck.*`, public type prefix `Od*` (`OdModuleHost`, `OdRamGovernor`, `OdWebRunner`, `OdCatalogEntry`), interfaces `IOd*`. The WPF application class is `OdApp` (`OdApp.xaml`), started from `Program.Main` after Velopack's hooks; the executable is `OmniDeck.exe`.
|
||||
|
||||
Patterns: MVVM via CommunityToolkit.Mvvm; constructor DI via `Microsoft.Extensions.DependencyInjection`; no service locator.
|
||||
|
||||
Startup, as built in P1: `Program.Main` runs Velopack's hooks first (the uninstall hook deletes the data root), then the single-instance guard: a session-local mutex, and a second launch signals the first to show its window and exits. `OdApp` builds the container (`ServiceCollection` with `ValidateOnBuild`), installs the crash handler and starts the theme engine. It then shows the legal gate when the acknowledged legal version is not the current one, and onboarding on first run. Next it creates the main window, which owns the tray icon and therefore exists even when Windows starts OmniDeck in the tray (`--minimized`). Last come the governor and the daily update check. Shutdown is explicit: closing the window hides it in the tray unless the user turned that off, and otherwise only Quit ends the process. Notifications are tray balloons behind `IOdNotifier`, which Windows 11 shows as toasts, so the app needs no Windows-specific target framework or WinRT projection. The tray icon's image, a bold "O" on the accent color, is drawn in code (`OdTrayIcon`) and loaded from ICO bytes so that it owns its handle. H.NotifyIcon's `GeneratedIconSource` is avoided: in 2.4.1 it leaks an icon handle on every redraw and adds a redraw handler on every brush change, which used up the process's GDI objects after a few accent changes (fixed in 0.1.1). The Velopack update service lives in the app, because Core must not reference Velopack.
|
||||
|
||||
## 2. Module contract
|
||||
|
||||
```csharp
|
||||
@@ -44,7 +47,7 @@ public enum OdModuleState { Created, Active, Idle, Suspended, Hibernated, Closed
|
||||
|
||||
public interface IOdModule
|
||||
{
|
||||
OdModuleInfo Info { get; } // Id, Name, Icon, Category, RamClass
|
||||
OdModuleInfo Info { get; } // Id, NameKey, Icon, CategoryKey, RamClass
|
||||
FrameworkElement CreateView(); // called on Activate after hibernation
|
||||
Task InitializeAsync(IOdModuleContext ctx); // once per process lifetime
|
||||
Task ActivateAsync(); // became visible
|
||||
@@ -55,24 +58,68 @@ public interface IOdModule
|
||||
}
|
||||
```
|
||||
|
||||
`IOdModuleContext` gives modules storage (scoped SQLite access + settings section), the toast service, logger, and the HTTP client factory — modules never construct these themselves.
|
||||
`IOdModuleContext` gives modules their own settings document (one JSON row per module in the `module_settings` table), the notifier (tray balloons, which Windows 11 shows as toasts; clicking one opens the module that raised it), a logger, the clock, the shared HTTP client and the database for the module's own tables. The HTTP client (`OdHttp`) is one `HttpClient` for OmniDeck's own features: it names OmniDeck in its User-Agent, keeps no cookies and gives up after 15 seconds. Module tables are migrated with Core's migrations, so one schema version covers the database. Modules never construct these themselves. Quitting closes every open module first (`OdModuleHost.CloseAllAsync`), so each one can save its state and let go of what it holds.
|
||||
|
||||
`CreateView()` returns a WPF `FrameworkElement`, so wherever `IOdModule` lives must reference WPF. P1 decides between letting `OmniDeck.Core` take that dependency (it already targets `net10.0-windows`) and moving the contract into a small WPF-aware abstractions project.
|
||||
`CreateView()` returns a WPF `FrameworkElement`, so wherever `IOdModule` lives must reference WPF. P1 decided to let `OmniDeck.Core` take that dependency (`UseWPF`) rather than add an abstractions project. Core holds the contract, `OdModuleHost` and the localization layer (`OdLocalization`, `{res:OdLoc Key}`), so modules depend on Core alone; Core still never references the app, Velopack or WPF-UI (an architecture test checks it), which is why `OdModuleInfo.Icon` is a `SymbolRegular` name rather than a symbol.
|
||||
|
||||
`OdModuleHost` runs the contract. It initializes a module on first open, builds its view when it has none (first open, or after hibernation), keeps the view of the visible module, and moves hidden ones down the ladder when the shell or the governor asks; it refuses to suspend or hibernate a module whose `CanSuspendAsync` returns false. Calls run one at a time on the UI thread. The shell's navigation view is chrome only: every module item navigates to one shared stage page, whose content is the view the host hands back, so the control never creates or caches module views.
|
||||
|
||||
A view asks for full screen with `OdFullscreen.Request(view, on)`, a bubbling routed event raised from the view itself, since content it hosts in a window of its own (a video overlay) is outside the main window's tree. The main window then:
|
||||
|
||||
- covers the monitor it is on (`OdMonitors.BoundsOf`, `OdWindowCover`), and keeps where it was;
|
||||
- hides the title bar;
|
||||
- folds the navigation pane to zero width. Changing its display mode would re-template the navigation view and re-create the stage, and with it any native child window;
|
||||
- sets `OdFullscreen.IsActive` on the stage, which views inherit.
|
||||
|
||||
Esc, hiding to the tray, or showing another module ends it. A module that plays media implements `IOdMediaControls`, which the tray menu uses while something is loaded.
|
||||
|
||||
A module can also show in a window of its own (`OdPopOutWindow`), opened from its sidebar menu or its library tile:
|
||||
|
||||
- The host keeps the module active there (`OdModuleHost.PopOutAsync`), so the governor leaves it alone. If the main window showed it, the main window shows the library instead. Asking for the module again brings its window to the front.
|
||||
- The view itself moves, so a web app's browser and a video keep running: WPF re-parents their native windows rather than creating new ones. Spike #6's hand-over to a second video view, with its track re-selection and seek, is not needed.
|
||||
- Closing the window docks the module back into the main window, hidden (`DockAsync`), and the time ladder applies again. "Return to main window" in the sidebar menu also shows it there.
|
||||
- Before closing, the window lets go of the view and hands the windows it still owns to the main window. LibVLCSharp's video overlay is owned by the window its video is in and would otherwise close for good with it.
|
||||
- A pop-out goes full screen as the main window does, and opens where it was last time in the session.
|
||||
|
||||
Native modules run in-process. True RAM release for them means honoring `SuspendAsync`/`HibernateAsync`: dispose charts, bitmaps, timers, caches; the governor follows up with a GC. Web modules get real process-level release for free because WebView2 is out-of-process by design.
|
||||
|
||||
## 3. Web runner internals
|
||||
|
||||
- **Environment:** one `CoreWebView2Environment` for the whole app → browser/GPU processes are shared across web apps. Created lazily on first web app open.
|
||||
- **Profiles:** `CoreWebView2Profile` per catalog `profile` value. `google` is shared (one sign-in for Gmail/Calendar/Drive/Maps/YouTube); every other app is isolated. Cookies live in the profile, which is what lets **hibernate = full dispose** without losing sessions.
|
||||
- **Per-app pipeline on creation:** apply settings (`AreDevToolsEnabled=false` in Release, `IsPasswordAutosaveEnabled=false`, `IsGeneralAutofillEnabled=false`) → attach `NavigationStarting` (navAllow suffix check) → `NewWindowRequested` (popupAllow → in-app popup on same profile; else default browser) → `PermissionRequested` → `NotificationReceived` → `DownloadStarting` → start CDP console capture (`Runtime.enable`, `Log.enable`).
|
||||
- **Suspend path:** hide the control → `TrySuspendAsync()` → set `MemoryUsageTargetLevel = Low`. **Resume:** set target `Normal`, show; WebView2 resumes automatically on visibility.
|
||||
- **Hibernate path:** persist `{ url }`, `Dispose()` the control and `CoreWebView2`. Reopen = new control on the same profile navigating to the saved URL.
|
||||
- **Catalog refresh:** at most daily, fetch `catalog/webapps.json` from this repo's raw URL over HTTPS; validate against schema version; on any validation failure keep the bundled copy.
|
||||
As built in P2 (`OmniDeck.Web`):
|
||||
|
||||
- **Environment** (`OdWebRuntime`): one `CoreWebView2Environment` for the whole app, so the browser and GPU processes are shared across web apps. It is created when the first web app opens, with its user data folder in the data root's `WebView2\` folder. The runtime counts open browsers: after the last one closes, the shared browser process exits and writes its cookies out, and a web app opened meanwhile waits for that exit (up to 3 s), because a controller created during it stalls for seconds (docs/spikes/03-memory.md). Quitting closes every module, then waits the same way before the process ends. Without an installed WebView2 Runtime, a web app shows a notice whose button opens Microsoft's download page.
|
||||
- **Profiles:** one WebView2 profile per catalog `profile` value (`CoreWebView2ControllerOptions.ProfileName`). `google` is shared (one sign-in for Gmail/Calendar/Drive/Maps/YouTube); every other app is isolated. Cookies live in the profile, which is what lets **hibernate = full dispose** without losing sessions.
|
||||
- **Modules:** each catalog entry is an `OdWebAppModule` (Heavy, titled with the brand name, which is never translated). Its view (`OdWebAppView`) hosts the WPF `WebView2` control; notices sit above the browser rather than over it, because no WPF element can cover the browser's native window.
|
||||
- **Per-app pipeline on creation:** apply settings (`AreDevToolsEnabled=false` in Release, `IsPasswordAutosaveEnabled=false`, `IsGeneralAutofillEnabled=false`) → attach `NavigationStarting` → `NewWindowRequested` → `ProcessFailed` → `ContainsFullScreenElementChanged` → `NotificationReceived` → `PermissionRequested` → start the CDP console capture → navigate.
|
||||
- **Navigation policy** (`OdNavPolicy`, a pure function of the entry and the catalog): a main-frame navigation stays in the app when it is HTTPS to a host that `navAllow` or one of the entry's `navAllowSets` covers (whole-label suffix match, case-insensitive), or an `about:`, `data:` or `blob:` page. Other web and `mailto:` links open in the default browser; every other scheme is blocked and only the scheme is logged. Frames inside a page are not filtered. A popup (`NewWindowRequested`) to a `popupAllow` host opens in an in-app window (`OdWebPopupWindow`) on the same profile, so a sign-in popup lands in the app's cookies; any other popup goes to the default browser.
|
||||
- **Link loop guard** (`OdExternalLinks`): the same link (scheme, host and path) opens in the browser at most 3 times in 30 s; after that it is held back and the app shows a notice, once per 30 s. In P0, Google retried a blocked sign-in hop 15 times in 40 seconds (docs/spikes/02-google-sign-in.md).
|
||||
- **Suspend path:** set `MemoryUsageTargetLevel = Low` → `TrySuspendAsync()` (WebView2 refuses while the control is visible; that is logged at Debug). **Resume:** set target `Normal`, and `Resume()` if still suspended.
|
||||
- **Hibernate path:** the module keeps the page on screen in memory, then disposes the control, which releases the app's processes. Reopening creates a new control on the same profile and navigates to that page. Closing the module forgets the page, and so does a restart: the next session opens `startUrl`.
|
||||
- **Crash recovery:** `ProcessFailed` for the page or the browser reloads the app once, on the page it showed; a second failure within a minute shows a notice with a Reload button instead. Frame, GPU and helper process failures recover on their own and are only logged.
|
||||
- **Full screen:** when the page shows something full screen (a video, say), the view asks for the window's full screen (§2). When the window leaves it first (Esc, another module), the page is told to leave too (`document.exitFullscreen()`).
|
||||
- **Console capture:** CDP `Runtime.consoleAPICalled`, `Runtime.exceptionThrown` and `Log.entryAdded` feed two rings kept by the module (`OdConsoleLog`: the last 200 entries and the last 50 errors), so they survive hibernation. They are formatted like DevTools (`%s`, `%d`, `%c`), held only for the session, and are there for the bug report.
|
||||
- **Notifications:** `NotificationReceived` is always marked handled, so WebView2 never shows its own notification window.
|
||||
- When the app's notifications are on, the notification becomes a tray notification: "‹App›: ‹title›" with the body below, cut to what a balloon holds. That switch is in Settings → Web apps and defaults to the catalog's `notifications`.
|
||||
- Then `ReportShown` runs. Clicking the notification opens the app and calls `ReportClicked`, so the page can open the conversation.
|
||||
- The Notifications permission follows the same switch, without asking.
|
||||
- An app with notifications on is resident: the governor never suspends it for being hidden (RAM-GOVERNOR.md §3).
|
||||
- Only non-persistent notifications (`new Notification(...)` from a page) reach WebView2's event. Service-worker push does not.
|
||||
- **Permissions** (`OdWebPermissions`, `OdWebPreferences`):
|
||||
- Kinds that reach the user's devices or data are asked about once per app: camera, microphone, location, clipboard reading, motion sensors, several downloads at once, file access, local fonts, MIDI system-exclusive messages and window placement.
|
||||
- The question shows in a bar above the browser, because a content dialog cannot cover the browser's native window. The page waits on a deferral until the user answers.
|
||||
- The answer is kept in `settings.json` (`web.apps.<id>.permissions`). `SavesInProfile` is false, so the profile keeps no answers of its own.
|
||||
- Autoplay and persistent storage are left to the browser. Any other kind is refused.
|
||||
- Settings → Web apps lists each app's answers; "Ask again" forgets them.
|
||||
- **Downloads:** WebView2's own download flyout. It saves to the user's Downloads folder and handles SmartScreen verdicts and dangerous-file prompts, which a download row of OmniDeck's own would have to repeat.
|
||||
- **Clearing data:** Settings → Web apps → Clear data, per profile group:
|
||||
- It closes the group's apps, then clears the profile's browsing data (`ClearBrowsingDataAsync`) through a hidden browser on that profile, hosted by the main window.
|
||||
- It also tells sign-in health that an empty profile is expected.
|
||||
- **Sign-in health** (`OdSignInHealth`): when an app closes or hibernates, and at the first load of each profile in a session, it counts the cookies the profile holds for the app's start page (the number only, never a name or value), keeps the count in `app_meta` (`web.cookies.<profile>`) and logs it. A profile that had cookies at the last close and comes back with none is logged as a warning. Starting OmniDeck with `--wv2-logging` also turns on Chromium's own logging (`--enable-logging --v=0`) in the WebView2 folder, for chasing a lost sign-in while dogfooding.
|
||||
- **Catalog refresh** (`OdCatalogService`, as built in P2): each build carries the catalog as of its commit (`catalog\webapps.json` next to the executable), and the session uses the newer of that copy and the last one fetched (`%LocalAppData%\OmniDeck.Data\catalog\webapps.json`), by `updated`. A minute after startup, and then at most once a day, it fetches `main`'s copy from the repository's raw URL over HTTPS with `If-None-Match`. It parses strictly (unknown or missing properties are errors) and applies the same rules as `validate-catalog.ps1` (`OdCatalogValidator`, tested against the repository's file). A valid catalog replaces the last fetched one atomically and takes effect at the next start, so the modules on screen never change mid-session; anything else is logged and dropped. Requests are never retried before the next daily check.
|
||||
|
||||
## 4. RAM governor (summary — full spec in RAM-GOVERNOR.md)
|
||||
|
||||
A single scheduler owns all state transitions. Inputs: per-module visibility + last-interaction time, pin status (`CanSuspendAsync` / `IsDocumentPlayingAudio`), and total footprint = shell `Process.WorkingSet64` + `CoreWebView2Environment.GetProcessInfos()` working sets. Policies: idle timers demote Active→Idle→Suspended→Hibernated; soft cap demotes LRU modules early; hard cap force-hibernates and toasts. The task-manager panel is a read/write view over the same scheduler (manual suspend/kill).
|
||||
A single scheduler owns all state transitions. Inputs: per-module visibility + last-interaction time, pin status (`CanSuspendAsync` / `IsDocumentPlayingAudio`), and total footprint = private commit (`Process.PrivateMemorySize64`) of the shell plus the WebView2 processes, which the web runner reports per app (`IOdMemoryReporter`, renderers matched to apps through `GetProcessExtendedInfosAsync`) with the browser, GPU and utility processes as one shared figure. Policies: idle timers demote Active→Idle→Suspended→Hibernated; soft cap demotes LRU modules early; hard cap force-hibernates and toasts. The task-manager panel is a read/write view over the same scheduler (manual suspend/kill). In code: `OdRamGovernor` in `OmniDeck.Core/Governor`, polling every 10 s on the UI thread through `OdModuleHost`, behind `IOdMemory` so tests drive it with a fake gauge and `FakeTimeProvider`.
|
||||
|
||||
## 5. Storage
|
||||
|
||||
@@ -88,10 +135,32 @@ Why not `%LocalAppData%\OmniDeck`: that is Velopack's install folder (packId `Om
|
||||
|
||||
## 6. Logging & failure handling
|
||||
|
||||
Serilog rolling files (7-day retention). Global handlers (`DispatcherUnhandledException`, `AppDomain.UnhandledException`, `TaskScheduler.UnobservedTaskException`) log, show a friendly dialog, and offer the bug-report flow. `CoreWebView2.ProcessFailed` triggers an automatic single reload of that app before surfacing an error tab.
|
||||
Serilog rolling files, kept for 7 days by age (a burst of errors rolls a new file every 10 MB, so a file count alone could push out the week before it). Global handlers (`DispatcherUnhandledException`, `AppDomain.UnhandledException`, `TaskScheduler.UnobservedTaskException`) log, show a friendly dialog, and offer the bug-report flow. A failure that repeats is reported once a minute, with the number of repeats in between, so one fault in a loop can neither stack dialogs nor flood the logs. When a web app's page or browser process fails, the app reloads once by itself; a second failure within a minute shows a notice with a Reload button (§3).
|
||||
|
||||
**Bug reports**, as built in P2. Two buttons open the same dialog: About → Report a bug, and Report bug on the error dialog, which also passes in the error it showed.
|
||||
|
||||
- **What the report holds:**
|
||||
- OmniDeck's version and commit, Windows' version and build, and the UI preset;
|
||||
- each module's state, how long it has been hidden, and the memory it uses;
|
||||
- the last 500 lines of the logs;
|
||||
- the sign-in cookie count of each profile;
|
||||
- for a web app, its console capture.
|
||||
- **Scrubbing** (`OdScrubber` in `OmniDeck.Core/Reports`, a pure function) runs over every file before it is written. It replaces the user's profile folder with `%USERPROFILE%`, cuts URLs back to scheme, host and path, and removes:
|
||||
- cookie values;
|
||||
- bearer tokens, JWTs, and long hex or base64 runs;
|
||||
- email addresses;
|
||||
- numeric ids of 15 digits or more.
|
||||
- **Preview:** the dialog shows the issue text the report will carry. Picking another subject composes the report again.
|
||||
- **On Save:**
|
||||
- `OdBugReports` writes `reports\bugreport-‹stamp›.zip` (issue.md, system.json, logs.txt and console-‹app›.txt for a web app) and keeps the ten newest.
|
||||
- File Explorer opens with the zip selected.
|
||||
- The browser opens the bug form with only the short fields (version, Windows, preset, module) in its query.
|
||||
- Nothing is uploaded (PRIVACY §3).
|
||||
|
||||
A content dialog cannot cover a web app's browser, which is a native window. So while any dialog is open, the main window hides the module stage, and with it the browser.
|
||||
|
||||
## 7. Updates & packaging
|
||||
|
||||
Velopack, per-user, GitHub Releases channel, delta updates; update check on About open and once per day in the background (notify-only, never auto-restart). Builds below 1.0 are GitHub pre-releases, so their update check includes pre-releases.
|
||||
Velopack, per-user, GitHub Releases channel, delta updates. The package carries libVLC for the media player in `libvlc\win-x64` next to OmniDeck.exe (x64 only, with the plugin set in SPEC §3.6), and LibVLCSharp loads it on the first play. Update check on About open and once per day in the background (notify-only, never auto-restart). Builds below 1.0 are GitHub pre-releases, so their update check includes pre-releases. In code: `OdVelopackUpdateService` behind `IOdUpdateService`; Settings → About checks when opened and offers *Download and restart*, and `OdUpdateWatcher` checks a few minutes after start, then daily, and notifies once per new version. A development build is not installed, so it does neither.
|
||||
|
||||
Releases are built by [`release.yml`](../.github/workflows/release.yml), self-contained in this repository: a GPG-signed `vX.Y.Z[-suffix]` tag on `main` runs `scripts/pack.ps1` (self-contained `win-x64` publish + `vpk pack`), build-provenance attestations, a draft GitHub Release with an SPDX SBOM and SHA-256 checksums, release notes from CHANGELOG, publication, and a Discord announcement — see [RELEASING](../RELEASING.md). The WebView2 Runtime ships with Windows 11; if it is ever missing, Velopack's `--framework webview2` bootstrapper can install it (evaluate in P2).
|
||||
Releases are built by [`release.yml`](../.github/workflows/release.yml), self-contained in this repository: a GPG-signed `vX.Y.Z[-suffix]` tag on `main` runs `scripts/pack.ps1` (self-contained `win-x64` publish + `vpk pack`), build-provenance attestations, a draft GitHub Release with an SPDX SBOM and SHA-256 checksums, release notes from CHANGELOG, publication, and a Discord announcement — see [RELEASING](../RELEASING.md). The WebView2 Runtime ships with Windows 11; if it is ever missing, a web app says so and links to Microsoft's download page (§3). Velopack's `--framework webview2` bootstrapper was considered in P2 and left out for that reason. The executable, its windows and Setup carry `src/OmniDeck.App/Assets/OmniDeck.ico`, drawn by `scripts/make-icon.ps1` until a designed icon replaces it.
|
||||
+40
-13
@@ -4,15 +4,17 @@ The governor is the feature that makes "many apps in one" viable. It moves every
|
||||
|
||||
## 1. State ladder
|
||||
|
||||
| State | Entered when | Native module | Web app | Typical web-app RAM |
|
||||
| State | Entered when | Native module | Web app | Measured web-app cost (committed, P0 spike #3) |
|
||||
|---|---|---|---|---|
|
||||
| Active | visible / interacted | full UI | full WebView2 | 300–700 MB |
|
||||
| Idle | hidden < `IdleAfter` | keep view, stop animations/timers | hidden, still live | unchanged |
|
||||
| Suspended | hidden ≥ `IdleAfter` | `SuspendAsync`: drop caches, charts, bitmaps; GC follows | `TrySuspendAsync` + `MemoryUsageTargetLevel.Low` | tens of MB |
|
||||
| Hibernated | hidden ≥ `HibernateAfter`, or cap pressure | `HibernateAsync`: view + everything released, tiny state blob kept | `Dispose()`; only `{url}` kept, session lives in profile cookies | ≈ 0 |
|
||||
| Active | visible / interacted | full UI | full WebView2 | app 250–450 MB, plus 170–270 MB of shared browser, GPU and utility processes |
|
||||
| Idle | hidden < `IdleAfter` | keep view, stop animations/timers | hidden, still live | 15–31 % less, as Chromium drops the hidden page's caches |
|
||||
| Suspended | hidden ≥ `IdleAfter` | `SuspendAsync`: drop caches, charts, bitmaps; GC follows | `TrySuspendAsync` + `MemoryUsageTargetLevel.Low` | 85–95 % of Idle. The working set is trimmed by about 65 %, so this rung saves CPU and power, not memory |
|
||||
| Hibernated | hidden ≥ `HibernateAfter`, or cap pressure | `HibernateAsync`: view + everything released, tiny state blob kept | `Dispose()`; only `{url}` kept, session lives in profile cookies | 0. Disposing the *last* web app also ends the shared processes |
|
||||
| Closed | user closes | released | released | 0 |
|
||||
|
||||
Reactivation from Suspended is instant; from Hibernated it is a cold open (view rebuild / page reload) — acceptable because the profile keeps the user signed in.
|
||||
A module in a window of its own (a pop-out) is visible while that window is open, so it stays Active whatever the main window shows; closing the window puts it back on the ladder as a hidden module.
|
||||
|
||||
Reactivation from Suspended is instant. From Hibernated it is a cold open (view rebuild and page reload, about 0.6–2.5 s); that is acceptable because the profile keeps the user signed in. After the last web app has been hibernated, the next one also restarts the browser process (about 160 ms).
|
||||
|
||||
## 2. Defaults (all configurable in Settings → Memory)
|
||||
|
||||
@@ -20,8 +22,8 @@ Reactivation from Suspended is instant; from Hibernated it is a cold open (view
|
||||
|---|---|
|
||||
| `IdleAfter` | 5 min hidden |
|
||||
| `HibernateAfter` | 30 min hidden |
|
||||
| `SoftCapBytes` | 4.5 GiB |
|
||||
| `HardCapBytes` | 6.0 GiB |
|
||||
| `SoftCapBytes` | min(4.5 GiB, 35 % of physical RAM) |
|
||||
| `HardCapBytes` | min(6.0 GiB, 50 % of physical RAM) |
|
||||
| `PollInterval` | 10 s |
|
||||
|
||||
## 3. Pinning
|
||||
@@ -32,18 +34,32 @@ A module is **pinned** (governor must not demote it below its current state) whe
|
||||
- the web app's `IsDocumentPlayingAudio` is true **and** its catalog entry has `audioPin: true` (Spotify, YouTube);
|
||||
- the user pinned it manually in the task-manager panel.
|
||||
|
||||
A module that works while hidden is **resident** (`IOdResidency`): in P2, a web app with notifications on, which would stop notifying once suspended. The time ladder skips it; the caps may still hibernate it, after every other victim, and then OmniDeck shows a notification naming the app, which reopens it when clicked.
|
||||
|
||||
Pinned modules are skipped by cap enforcement; if the hard cap is exceeded purely by pinned modules, the governor toasts a warning instead of killing audio.
|
||||
|
||||
## 4. Cap enforcement
|
||||
|
||||
Total footprint = shell process + Σ all WebView2 processes (`CoreWebView2Environment.GetProcessInfos()` → PID), sampled every `PollInterval`.
|
||||
Total footprint = shell process + Σ all WebView2 processes, sampled every `PollInterval`.
|
||||
|
||||
**Metric — chosen by P0 spike #3.** Summing `Process.WorkingSet64` over-counts: Chromium processes share DLL and shared-memory pages, and each process reports them again. Working set also drops whenever pages are trimmed (for example by `MemoryUsageTargetLevel.Low`), so a working-set cap would reward exactly the page shuffling the honesty note below rejects. The spike compares private commit (`Process.PrivateMemorySize64`) with private working set and fixes one metric; the caps, the toasts, and the task-manager panel all use it.
|
||||
**Metric: private commit** (`Process.PrivateMemorySize64`), summed over the shell and every WebView2 process. P0 spike #3 ([note](spikes/03-memory.md)) chose it for three reasons:
|
||||
- Summing `Process.WorkingSet64` over-counts, because Chromium processes share DLL and shared-memory pages and each one reports them again.
|
||||
- Working sets drop whenever pages are trimmed. Suspend + `Low` cut the private working set by 65–70 % but committed memory by only 5–15 %, so a working-set cap would reward exactly the page shuffling the honesty note below rejects.
|
||||
- Private commit needs no process handle.
|
||||
|
||||
- **> SoftCap:** demote the least-recently-used unpinned module one step down the ladder; repeat next tick if still above.
|
||||
- **> HardCap:** force-hibernate LRU unpinned modules until below, then raise one toast summarizing what was hibernated.
|
||||
The caps, the toasts and the task-manager panel all use it. The panel may show the private working set beside it, since that is the figure Task Manager shows. Renderer processes are attributed to apps through `GetProcessExtendedInfosAsync`. The shared browser, GPU and utility processes form one "WebView2 (shared)" row and are never a demotion target.
|
||||
|
||||
Ordering hint: `RamClass.Heavy` modules (web apps, media, stocks charts) are preferred victims over `Light` ones at equal recency.
|
||||
- **> SoftCap:** hibernate the least-recently-used unpinned module, since Suspended frees almost no memory. Repeat on the next tick if still above.
|
||||
- **> HardCap:** force-hibernate LRU unpinned modules until below, then raise one toast summarizing what was hibernated. If the shared WebView2 processes alone keep the total above the cap (the GPU process grows with video), the toast says so instead of hibernating apps that would free nothing.
|
||||
|
||||
Ordering hint: `RamClass.Heavy` modules (web apps, media, stocks charts) are preferred victims over `Light` ones at equal recency. Recency counts in poll intervals, so modules hidden within the same interval are equally recent.
|
||||
|
||||
As built in P2:
|
||||
|
||||
- **Measuring.** `IOdMemory` measures the shell; every `IOdMemoryReporter` adds the processes it follows. The web runner's `OdWebMemoryReporter` lists the WebView2 processes with `GetProcessExtendedInfosAsync` on each pass. A renderer counts for the app whose page it hosts: matched by main frame id (`CoreWebView2.FrameId`), or by host when only one open app shows that host. A renderer hosting pages of several apps is split evenly between them. The browser, GPU and utility processes, and pages no open app shows, count as shared. A reporter that fails is left out of that pass.
|
||||
- **Victim order:** resident modules last, then least recently used, then `Heavy` first, then the module that uses more.
|
||||
- **After a hibernation:** a web app's processes take a moment to exit. The pass therefore counts its figure as gone at once (and the shared processes too, when it was the last web app), and the next pass measures again. This keeps the hard-cap loop from hibernating more apps than needed.
|
||||
- **Shared processes at the hard cap:** the governor checks whether the shell, the shared processes and the web apps that are not victims (on screen, kept running, or refusing) are above the hard cap on their own. If they are, it hibernates nothing and its one notification for that excursion says why.
|
||||
|
||||
Honesty note: for in-process native modules the real win comes from modules *actually releasing* resources in `SuspendAsync`/`HibernateAsync`. The governor performs a `GC.Collect` + LOH compaction after demotions, and deliberately does **not** call `EmptyWorkingSet` tricks — those only shuffle pages to standby and fake the numbers.
|
||||
|
||||
@@ -51,6 +67,17 @@ Honesty note: for in-process native modules the real win comes from modules *act
|
||||
|
||||
Settings → Memory → "Running modules": live table of every module with state, memory estimate (the governor metric), last-used time, pin toggle, and Suspend / Hibernate / Close buttons. This is both a user feature and the primary debugging tool for the governor itself; the panel reads and writes the same scheduler, no side channel.
|
||||
|
||||
As built in P1, the panel sits in Settings → Memory under the threshold fields, and the command palette's "Running modules" opens it. Native modules share the shell process, so the panel shows OmniDeck's total against both caps rather than a per-module figure. Since P2, each open web app's row shows its own figure, and a "Shared web processes" row after the modules shows the shared ones. That row has no buttons, because the governor never demotes it. The pin toggle is labelled "Keep running", so it is not confused with pinning a module to the sidebar, and it is stored in `settings.json` (`memory.keepRunning`) next to the thresholds.
|
||||
|
||||
## 6. Testing
|
||||
|
||||
The scheduler is pure logic over an injected clock and an injected memory sampler — unit-test every transition, cap scenario, and pinning rule in `OmniDeck.Tests` without touching real WebView2.
|
||||
|
||||
**Resource soak, P2** (2 November 2026, Release build, one 2560×1440 monitor at 100 %):
|
||||
|
||||
- Idle on the library page, the shell held 103 MB of private commit, 32 GDI and 36 USER objects and 735 handles.
|
||||
- 21 pop-out round trips (Clock into a window of its own and back) left the GDI and USER objects and handles flat after the first one: 39, 45 and 762.
|
||||
- 21 page full-screen round trips on Discord's sign-in page also left them flat: 40, 49 and 798.
|
||||
- With that page open, the seven WebView2 processes held 508 MB. The first full screen raised them to about 725 MB, mostly the GPU process's surfaces for the larger window, and they stayed there.
|
||||
|
||||
A signed-in day of use is the P2 exit's dogfooding ([ROADMAP](ROADMAP.md) §1).
|
||||
+37
-11
@@ -3,6 +3,8 @@
|
||||
Solo-developer plan, ~29 weeks from the start of P0 (2 November 2026). Each phase has exit criteria; slipping triggers the cut order in §4, never a death march.
|
||||
|
||||
> **Re-baselined 2026-10-28.** The first draft assumed a 20 July 2026 start and a January 2027 release. Development actually starts on 2 November 2026, so every phase keeps its original length and moves; P2 gains one buffer week for Tết (Lunar New Year, 6 February 2027). Windows 10 support was dropped at the same time ([SPEC](SPEC.md) §1).
|
||||
>
|
||||
> **Re-baselined 2026-11-02.** P0 and P1 both finished early, on 30 October 2026, so P2 started on 2 November 2026 instead of 11 January 2027. P3 and P4 keep their dates until P2 exits, and are re-baselined then.
|
||||
|
||||
## 1. Phases
|
||||
|
||||
@@ -10,7 +12,7 @@ Solo-developer plan, ~29 weeks from the start of P0 (2 November 2026). Each phas
|
||||
|
||||
Repository foundation: documentation suite; solution skeleton (`OmniDeck.App`, `OmniDeck.Core`, `OmniDeck.Tests`); self-contained CI (build, tests, formatting, analyzers as errors, NuGet Audit, catalog validation, workflow and link linting, CodeQL, SonarCloud, Dependency Review, OpenSSF Scorecard); protected `main` and release tags; the Velopack release pipeline proven end to end with the `0.0.1-alpha.1` pre-release.
|
||||
|
||||
### P0 — Spikes (2 – 15 Nov 2026)
|
||||
### P0 — Spikes (2 – 15 Nov 2026) — done early, 30 Oct 2026
|
||||
|
||||
De-risk everything that could invalidate the design, on real hardware:
|
||||
|
||||
@@ -22,23 +24,45 @@ De-risk everything that could invalidate the design, on real hardware:
|
||||
6. **LibVLCSharp WPF:** airspace behavior — overlay controls + fullscreen toggle over `VideoView`. If blocked, evaluate FlyleafLib as the fallback engine.
|
||||
7. **Providers:** hit Stooq CSV and Twelve Data free endpoints; freeze response models.
|
||||
|
||||
**Exit:** written go/no-go note per spike committed to `docs/spikes/`.
|
||||
**Exit:** a written go/no-go note per spike in [`docs/spikes/`](spikes/README.md). The proof-of-concept code stays on the unmerged `spike/p0` branch, so spike-only packages never reach `main`'s dependency graph or the release SBOM.
|
||||
|
||||
### P1 — Shell & skeleton (16 Nov 2026 – 10 Jan 2027)
|
||||
**Result:** all seven notes are in. #1, #3 and #4 are GO; #2, #5, #6 and #7 are GO with conditions:
|
||||
- #1 DRM: Widevine ships with the runtime.
|
||||
- #2 sign-in: works and persists; Google's country-code hop needs `navAllowSets` in P2.
|
||||
- #3 memory: the governor metric is private commit; suspend trims, only hibernate frees.
|
||||
- #4 CDP capture: always on.
|
||||
- #5 presets: code-built, with `Od` styles over WPF-UI's static keys.
|
||||
- #6 libVLC: fullscreen in place; pop-out needs a vout restart and a seek.
|
||||
- #7 providers: Twelve Data with the user's own key; Stooq dropped.
|
||||
|
||||
### P1 — Shell & skeleton (16 Nov 2026 – 10 Jan 2027) — done early, 30 Oct 2026
|
||||
|
||||
Shell (nav, tray, single-instance, command palette), module contract + host, RAM governor v1 with task-manager panel, theme engine + three presets (Standard polished, others functional), legal gate + About, settings + storage layer (data root, Velopack uninstall hook), and the three trivial modules: clock, timer, calculator.
|
||||
|
||||
**Exit (0.1.0):** installable Velopack build; governor demotes/restores the trivial modules correctly; unit tests for governor + storage green.
|
||||
|
||||
### P2 — Web runner & core modules (11 Jan – 7 Mar 2027)
|
||||
As delivered: eight work packages (PRs #20–#25, #27 and #29) and three releases (`0.1.0-alpha.1`, `0.1.0-alpha.2`, `0.1.0`), all three exit criteria met. Settings import/export, planned for P3, shipped with it. Carried forward:
|
||||
|
||||
- **P3 presets:** Comfort's AAA body text and Dynamic's gradient accents (docs/UI-MODES.md §2).
|
||||
- **P3 accessibility:** UI Automation exposes WPF-UI 4.3's navigation items as data items with no Invoke or Select pattern; keyboard users reach them with Tab and Enter. The accent swatches are announced by their hex codes.
|
||||
- **P2:** pop-out module windows, deferred by the P1 plan.
|
||||
|
||||
### P2 — Web runner & core modules (from 2 Nov 2026; planned 11 Jan – 7 Mar 2027)
|
||||
|
||||
Full web runner (profiles, nav policy, SSO popups, notifications→toast, permissions, downloads, suspend/hibernate, catalog fetch) with the v1 catalog; weather; calendar (local + .ics); media player v1 on LibVLCSharp. Bug-report flow end to end (CDP capture → scrubber → prefilled issue + zip).
|
||||
|
||||
**Exit (0.2.0):** dogfood daily — Gmail + Discord + YouTube stay signed in across hibernation; a full day's use stays under the hard cap.
|
||||
|
||||
As delivered so far: the `0.1.1` hotfix (a tray icon that leaked GDI objects), then the plan's ten work packages and two catalog pull requests, released as `0.2.0-alpha.1` and `0.2.0-alpha.2` on 2 November 2026. `0.2.0` follows about a week of dogfooding against the exit criterion. Changed on the way:
|
||||
|
||||
- Downloads use WebView2's own flyout rather than a progress row of OmniDeck's, and permission questions sit in a bar above the page, because no dialog can cover WebView2 ([SPEC](SPEC.md) §4).
|
||||
- Web apps with notifications on stay resident: the time ladder skips them ([RAM-GOVERNOR](RAM-GOVERNOR.md) §3).
|
||||
- Pop-out windows move the module's view, so web pages and videos keep running through the move ([ARCHITECTURE](ARCHITECTURE.md) §2).
|
||||
- Left for later: web app favicons, `.ics` subscriptions (they would need a privacy policy update) and Discord's global push-to-talk hotkey (all in §5), and the weather charts, which wait for ScottPlot in P3.
|
||||
|
||||
### P3 — Stocks, presets, i18n (8 Mar – 11 Apr 2027)
|
||||
|
||||
Stocks module (Stooq default + Twelve Data BYO key, watchlist, candlesticks); Dynamic and Comfort presets polished to spec (UI-MODES token table); VI + JA translations; settings import/export; accessibility pass (text scaling, contrast themes, keyboard nav).
|
||||
Stocks module (Twelve Data with the user's own key, which spike #7 left as the only provider; watchlist, candlesticks); Dynamic and Comfort presets polished to spec (UI-MODES token table); VI + JA translations; accessibility pass (text scaling, contrast themes, keyboard nav).
|
||||
|
||||
**Exit (0.3.0):** feature-complete against SPEC v1 scope.
|
||||
|
||||
@@ -51,7 +75,8 @@ Stocks module (Stooq default + Twelve Data BYO key, watchlist, candlesticks); Dy
|
||||
| Milestone | Version |
|
||||
|---|---|
|
||||
| Kickoff build | `0.0.1-alpha.1` |
|
||||
| Interim builds during phase N | `0.N.0-alpha.M` |
|
||||
| P0 — spikes | no build: the app does not change |
|
||||
| Interim builds during phase N (P1–P3) | `0.N.0-alpha.M` |
|
||||
| P1 exit — first installable shell | `0.1.0` |
|
||||
| P2 exit | `0.2.0` |
|
||||
| P3 exit — feature-complete | `0.3.0` |
|
||||
@@ -64,10 +89,11 @@ Every version below 1.0.0 is published as a GitHub **pre-release**; 1.0.0 is the
|
||||
|
||||
| Risk | Impact | Mitigation |
|
||||
|---|---|---|
|
||||
| Widevine unavailable in WebView2 on target machines | Spotify won't play | P0 spike gates the catalog entry; fallback: ship Spotify entry disabled with an explanatory note, YouTube covers music for many users |
|
||||
| Google blocks sign-in in WebView2 | Google group unusable | P0 spike; fallback: session import guidance / treat as upstream limitation, documented |
|
||||
| LibVLCSharp airspace friction in WPF | Media UX degraded | P0 spike; fallback engine FlyleafLib |
|
||||
| Free API tiers change (Twelve Data/Stooq) | Stocks degraded | provider abstraction; BYO-key model isolates OmniDeck from quota policy |
|
||||
| Widevine unavailable in WebView2 on target machines | Spotify won't play | **Retired by spike #1:** the evergreen runtime ships Widevine and Spotify plays without flags. If a future runtime breaks EME, the bug report's EME self-check shows it. Fallback unchanged: ship the Spotify entry disabled with a note |
|
||||
| Google blocks sign-in in WebView2 | Google group unusable | **Spike #2:** sign-in works with the default user agent, and one sign-in covers the `google` group. Google's hop to country-code domains needs `navAllowSets` (P2). Client hints name WebView2, so Google could still block it later; fallback: treat it as an upstream limitation, documented |
|
||||
| LibVLCSharp airspace friction in WPF | Media UX degraded | **Retired by spike #6:** overlay controls and fullscreen in place work in a `FluentWindow`. Pop-out, in P2, moves the same view, so the video keeps playing and the overlay follows. FlyleafLib is not needed |
|
||||
| Free API tiers change (Twelve Data/Stooq) | Stocks degraded | **Materialized for Stooq** (2026-10-30), which now blocks scripted clients. Spike #7 leaves Twelve Data with the user's own key as the only provider; its free plan covers US listings. The provider abstraction stays; Stocks is first in the cut order (§4) |
|
||||
| Web sessions lost across restarts | Users signed out of web apps | Seen once in P0 and not reproduced (spike #2). Since P2, quitting closes the web apps cleanly so the browser writes its cookies out; sign-in health logs each profile's cookie count at close and at first load and warns when it drops to none; bug reports carry the counts (never values) |
|
||||
| User data stored in Velopack's install folder | Uninstall or reinstall wipes data and sign-ins | data root `%LocalAppData%\OmniDeck.Data`, never `%LocalAppData%\OmniDeck` ([ARCHITECTURE](ARCHITECTURE.md) §5) |
|
||||
| Solo bandwidth vs. other projects | Schedule slip | cut order below; phases sized with buffer |
|
||||
|
||||
@@ -81,4 +107,4 @@ The web runner, governor, legal gate, and the trivial modules are never cut —
|
||||
|
||||
## 5. Post-v1 backlog (unordered)
|
||||
|
||||
Finnhub provider (real-time US), Google Calendar native sync, multi-point global hotkeys per web app, catalog entries from §4 of WEBAPP-CATALOG, per-module popout window session restore, portable build.
|
||||
Finnhub provider (real-time US), Google Calendar native sync, `.ics` calendar subscriptions, multi-point global hotkeys per web app (Discord's push-to-talk among them), web app favicons in the sidebar, catalog entries from §4 of WEBAPP-CATALOG, per-module popout window session restore, portable build.
|
||||
+38
-18
@@ -22,11 +22,11 @@ Status: draft for v1.0 (target May 2027) · Applies to: Windows 11 (24H2 or late
|
||||
|
||||
## 2. Shell
|
||||
|
||||
- **Navigation:** left sidebar listing pinned modules; full module library behind a "+" view. Sidebar density and item count vary by UI preset.
|
||||
- **Navigation:** left sidebar listing pinned modules, then the other open ones; the full module library is a page of its own (Library). Sidebar density and item count vary by UI preset.
|
||||
- **Command palette:** `Ctrl+K` opens a fuzzy launcher for every module, web app, and settings page.
|
||||
- **Tray:** single-instance app with tray icon; closing the window minimizes to tray (configurable). Tray menu: open, quick timer, media controls when playing, quit.
|
||||
- **Windowing:** modules open as tabs in the main window; any module can be popped out into its own top-level window.
|
||||
- **Settings:** general (language EN/VI/JA, startup, tray behavior), appearance (preset + per-token overrides), memory (governor thresholds), per-module settings, data (export/import settings JSON, open data folder), about.
|
||||
- **Tray:** single-instance app with tray icon; closing the window minimizes to tray (configurable). Tray menu: open, quick timer, media controls while the player has something loaded, quit.
|
||||
- **Windowing:** modules open in the main window one at a time, and stay in the sidebar while open; any module can move into a top-level window of its own (pop-out) and back ([ARCHITECTURE](ARCHITECTURE.md) §2).
|
||||
- **Settings:** general (language EN/VI/JA, startup, tray behavior), appearance (preset + per-token overrides), memory (governor thresholds), web apps (each app's notifications and permissions, clearing a group's sign-in data, the catalog in use), data (export/import settings JSON, open data folder), about.
|
||||
- **Legal gate:** on first run and whenever the acknowledged legal-doc version differs from the shipped version, show EULA, Disclaimer, Privacy Policy, and Third-Party Notices (shipped in the app's `legal\` folder, with links to this repo). The user acknowledges having read them; the acknowledgment (doc version + timestamp) is stored locally and the app stays on the gate until then. It is an acknowledgment, not a condition of the license: GPL-3.0 §9 does not require accepting the license to run the program.
|
||||
- **About:** app version + commit hash, update check (Velopack), links (GitHub, Discussions, Discord), credits, **Report bug** button (§6).
|
||||
|
||||
@@ -54,26 +54,46 @@ All mini-apps implement the module contract in [ARCHITECTURE](ARCHITECTURE.md) a
|
||||
|
||||
### 3.5 Stocks (US/EU)
|
||||
- **Watchlist** with quote, day change, sparkline; detail view with candlestick/OHLC + volume charts (ScottPlot 5), range 1M/6M/1Y/5Y.
|
||||
- **Providers** behind `IOdQuoteProvider`:
|
||||
- `Stooq` (default, keyless): end-of-day CSV for US and major EU tickers and indices. Zero configuration.
|
||||
- `TwelveData` (optional, user-supplied free API key): delayed intraday quotes and time series, US + international coverage. Key stored via **DPAPI**, never in plaintext or logs.
|
||||
- Client-side **sliding-window rate limiting** per provider; on limit or error, keep last cached values and show `N/A` for missing fields (never delete cached data on network failure).
|
||||
- **Provider** behind `IOdQuoteProvider`: `TwelveData`, with the user's own API key (free Basic plan or paid). The module asks for the key on first use; it is stored via **DPAPI**, never in plaintext or logs.
|
||||
- **Coverage depends on the user's plan.** The free plan covers US stocks, ETFs and US-listed ADRs. Home-market EU listings need Grow, and indices need Pro. Symbol search (`show_plan=true`, free) labels each listing with the plan it needs, and a plan error reads "not available on your Twelve Data plan".
|
||||
- **Stooq was dropped** in P0 because it now blocks scripted clients ([spike #7](spikes/07-providers.md)).
|
||||
- Client-side **sliding-window rate limiting**: ≤ 8 credits per rolling 60 s and the plan's daily budget, counting failed calls. Watchlist refreshes use batch quotes. On limit or error, keep the last cached values and show `N/A` for missing fields; never delete cached data on network failure.
|
||||
- Every stocks screen carries the data disclaimer footer ("delayed/indicative data — not investment advice"), mirrored in [DISCLAIMER](legal/DISCLAIMER.md).
|
||||
|
||||
### 3.6 Media player
|
||||
- Engine: **LibVLCSharp + VideoLAN.LibVLC.Windows (x64)**, plugins trimmed to codecs/demux/audio/video output.
|
||||
- Local files and folders, playlist (m3u load/save), subtitles (embedded + external `.srt`/`.ass`, encoding selection), audio track & device selection, speed 0.25–4×, snapshot.
|
||||
- libVLC initializes lazily on first open; the player counts as **pinned** while playback is active (governor may not suspend it).
|
||||
- libVLC initializes lazily on first open; the player counts as **pinned** while playback is active (governor may not suspend it). Suspend stops and disposes the player, and hibernate disposes libVLC too: playback holds 280–520 MB committed.
|
||||
- **Fullscreen** makes the module's own window cover the monitor. **Pop-out** moves the player's view, video window included, into the new window, so playback goes on; the track re-selection and seek that a second video view would need ([spike #6](spikes/06-libvlcsharp.md)) are not used.
|
||||
- **Build:** x64 only (`VlcWindowsX86Enabled` and `VlcWindowsArm64Enabled` set to false), with the trimmed plugin set: about 86 MB raw, 39 MB compressed.
|
||||
- **As built in P2:**
|
||||
- The player opens local files, folders and .m3u playlists, from its buttons or dropped on it, and saves the queue as an .m3u.
|
||||
- The queue and where playback stood live in the database (`media_playlists`), so they survive restarts.
|
||||
- It has transport controls, a seek bar, volume and mute.
|
||||
- libVLC ships in `libvlc\win-x64` next to OmniDeck.exe, with these plugin folders: access, audio_filter, audio_mixer, audio_output, codec, demux, misc, packetizer, spu, stream_filter, text_renderer, video_chroma, video_filter and video_output. The network access plugins (http, https, ftp, sftp, smb, rtp, srt) are left out, which comes to about 80 MB raw.
|
||||
- Only libVLC's errors reach the app log, as warnings, less the three known harmless ones.
|
||||
- The overlay's More menu has:
|
||||
- the audio track and the subtitle track;
|
||||
- a subtitle file (libVLC also picks one up from beside the video, with the same name);
|
||||
- the subtitles' encoding, from Automatic, UTF-8 and the common code pages. libVLC reads it only when a file opens, so a new choice reopens the file where it stood;
|
||||
- the speed, from 0.25× to 4×, kept for the files that follow;
|
||||
- the audio device (Windows' default, or one libVLC lists);
|
||||
- a snapshot of the picture, saved in Pictures\OmniDeck.
|
||||
- Speed, encoding and device live in the module's settings document.
|
||||
- Full screen: the button in the overlay, or a double-click on the picture, makes the main window cover its monitor (chrome hidden, square corners, topmost). Esc, or showing another module, puts it back. The player never moves, so its video window stays the same. The overlay is not fully transparent over a picture (alpha 1), because a click on a fully clear pixel of a layered window falls through to libVLC's window.
|
||||
- While a player has a file loaded, the tray menu shows the file with Play or Pause, Next and Previous (`IOdMediaControls`). Without a player there is nothing to control: starting one while the view is away could make libVLC open a video window of its own.
|
||||
|
||||
## 4. Web runner
|
||||
|
||||
- One shared `CoreWebView2Environment` (user data under `%LocalAppData%\OmniDeck.Data\WebView2`); one `CoreWebView2Profile` per catalog `profile` group (the `google` group is shared across Google apps for single sign-on; all others are isolated).
|
||||
- **Navigation policy:** top-level navigation outside the entry's `navAllow` suffix list opens in the system default browser. `NewWindowRequested` to a `popupAllow` domain opens an in-app popup on the same profile (SSO); everything else goes to the default browser.
|
||||
- **Notifications:** `NotificationReceived` is intercepted and re-raised as a Windows toast tagged with the app name; per-app opt-out in settings.
|
||||
- **Permissions:** `PermissionRequested` (mic/camera/clipboard/geolocation) shows a native prompt; the decision is remembered per app and reviewable in settings.
|
||||
- **Downloads:** routed through `DownloadStarting` to the user's Downloads folder with an in-shell progress row.
|
||||
- **Media pinning:** while `IsDocumentPlayingAudio` is true, the module is pinned (see RAM-GOVERNOR).
|
||||
- **Lifecycle:** hidden web apps are suspended via `TrySuspendAsync` + `MemoryUsageTargetLevel.Low`, later disposed entirely (session survives via profile cookies). Full state machine in [RAM-GOVERNOR](RAM-GOVERNOR.md).
|
||||
- **Notifications:** `NotificationReceived` is intercepted and shown as a Windows notification under the app's name; each app's switch in Settings → Web apps defaults to the catalog's `notifications`. An app with notifications on keeps running while hidden ([RAM-GOVERNOR](RAM-GOVERNOR.md) §3).
|
||||
- **Permissions:** `PermissionRequested` for the user's devices and data (camera, microphone, location, clipboard reading and the like) asks once per app, in a bar above the page, since no dialog can cover WebView2. The answer is remembered per app and reviewable in Settings → Web apps.
|
||||
- **Downloads:** WebView2's own download flyout saves to the user's Downloads folder; it already handles SmartScreen verdicts and dangerous-file prompts.
|
||||
- **Full screen:** a page that goes full screen (a video, say) takes the window full screen with it, as the media player does; Esc or showing another module ends both.
|
||||
- **Media pinning:** while `IsDocumentPlayingAudio` is true and the entry has `audioPin`, the module is pinned (see RAM-GOVERNOR).
|
||||
- **Lifecycle:** hidden web apps are suspended via `TrySuspendAsync` + `MemoryUsageTargetLevel.Low`, later disposed entirely (session survives via profile cookies). Disposing the last web app ends the shared browser process. Full state machine in [RAM-GOVERNOR](RAM-GOVERNOR.md).
|
||||
- **Google account domains:** Google's sign-in sets cookies on country-code domains (for example `accounts.google.com.vn`). The `google` entries allow them through the catalog's `google-account-domains` set (schema v2 `navAllowSets`, decided on 2 November 2026; [WEBAPP-CATALOG](WEBAPP-CATALOG.md) §1, [spike #2](spikes/02-google-sign-in.md)).
|
||||
- **Catalog:** shipped in `catalog/webapps.json`, refreshed from this repo's raw URL at most once per day; schema and rules in [WEBAPP-CATALOG](WEBAPP-CATALOG.md).
|
||||
|
||||
## 5. Cross-cutting requirements
|
||||
@@ -86,10 +106,10 @@ All mini-apps implement the module contract in [ARCHITECTURE](ARCHITECTURE.md) a
|
||||
|
||||
## 6. Bug reporting flow
|
||||
|
||||
1. A DevTools Protocol session per web app subscribes to `Runtime.consoleAPICalled` and `Log.entryAdded`, keeping a 200-entry ring buffer per app. .NET unhandled exceptions and the Serilog tail are collected shell-side.
|
||||
2. **Report bug** composes: version, Windows build, UI preset, active modules + RAM snapshot, the relevant console ring buffer, and last log lines.
|
||||
3. Before packaging, a scrubber strips query strings, cookie values, and bearer-token-shaped strings.
|
||||
4. The app opens a pre-filled GitHub issue (bug template) and writes `bugreport-<timestamp>.zip` to `%LocalAppData%\OmniDeck.Data\reports` for the user to attach (issue-URL prefill has a length limit, so long logs travel in the zip).
|
||||
1. A DevTools Protocol session per web app (`Runtime` + `Log`, always on, DevTools UI still disabled) subscribes to `Runtime.consoleAPICalled`, `Runtime.exceptionThrown` and `Log.entryAdded`. It keeps a 200-entry ring buffer per app, plus a 50-entry errors-only ring so chatty apps cannot evict errors ([spike #4](spikes/04-cdp-console.md)). .NET unhandled exceptions and the Serilog tail are collected shell-side.
|
||||
2. **Report a bug** (Settings → About, or Report bug on the error dialog) composes: version and commit, Windows build, UI preset, the modules with their states and memory, the last 500 log lines, the console rings of the web app picked as the subject, and each web profile's cookie count (never values).
|
||||
3. Before anything is shown or saved, a scrubber removes query strings and fragments, cookie values, bearer, JWT and other long hex or base64 tokens, email addresses, ids of 15 digits or more, and the user name in profile paths.
|
||||
4. A dialog previews the issue text. Saving writes `bugreport-<timestamp>.zip` (issue.md, system.json, logs.txt and the console) to `%LocalAppData%\OmniDeck.Data\reports`, keeps the ten newest, shows it in Explorer, and opens a GitHub issue (bug template) with the short fields filled in; long logs travel in the zip, since issue URLs have a length limit. Nothing is uploaded.
|
||||
|
||||
## 7. Reference versions (verified 2026-10-28; Dependabot owns bumps from here)
|
||||
|
||||
|
||||
@@ -28,6 +28,8 @@ Presets are named by their character, never by age, both in the UI and in code:
|
||||
|
||||
Rules for module authors: never hardcode a font size, padding, radius, or animation duration — consume tokens. CI includes a XAML lint pass (XamlStyler + a grep rule) that flags literal `FontSize=` in module views.
|
||||
|
||||
As built in P1, the font, density, hit-target, corner-radius and motion tokens and both `Od.Nav.*` tokens drive the shell. Dynamic closes the sidebar to icons, with each name in a tooltip; Comfort shows at most six modules, always including the one on screen, and the rest stay in the library and the palette. `Od.Contrast.Target` and `Od.Accent.Saturation` are not tokens yet: every preset uses WPF-UI's palette, which meets AA. Comfort's AAA body text and Dynamic's gradient accents come with the P3 preset work, and `Od.Chart.LineWeight` with the first chart (Stocks, P3).
|
||||
|
||||
## 3. User overrides
|
||||
|
||||
Appearance settings expose the presets as three cards plus granular overrides on top: font-size slider (0.85–1.4× of preset base), motion on/off, accent color. Overrides persist independently of preset choice, so switching presets keeps the user's font preference.
|
||||
|
||||
+11
-9
@@ -26,13 +26,16 @@ OmniDeck deliberately does **not** allow arbitrary user-added URLs in v1: the cu
|
||||
| `startUrl` | https URL | initial navigation target |
|
||||
| `profile` | string | cookie/profile group; entries sharing a value share sign-in. Reserved group: `google`. Anything else should be unique per app unless sharing is intentional |
|
||||
| `navAllow` | string[] | domains the main frame may navigate to; anything else opens in the system default browser |
|
||||
| `navAllowSets` | string[], optional | names of top-level `navAllowSets` whose domains this entry's main frame may also navigate to; for lists too long to repeat in each entry |
|
||||
| `popupAllow` | string[] | domains whose `window.open` popups open **in-app on the same profile** (SSO flows); all other popups go to the default browser |
|
||||
| `notifications` | bool | whether web notifications are bridged to Windows toasts (user can still disable per app) |
|
||||
| `notifications` | bool | whether web notifications are bridged to Windows toasts by default; the user can switch it per app in Settings → Web apps. An app with notifications on stays running while hidden (RAM-GOVERNOR.md §3) |
|
||||
| `audioPin` | bool | if true, the governor treats the app as pinned while it is playing audio |
|
||||
|
||||
**Domain matching.** `navAllow` and `popupAllow` entries are lowercase domains or subdomains — no scheme, port, path, or wildcard. A host matches an entry when it equals it or ends with `.` + the entry, on whole DNS labels: `google.com` matches `mail.google.com`, never `evilgoogle.com`. `navAllow` governs **top-level (main-frame) navigations only**; subresource requests (scripts, images, media, API calls to CDNs) are never filtered by it, so a CDN belongs in `navAllow` only when the app really navigates the main frame there (a file download or a media viewer, for example). The `startUrl` host and every `popupAllow` entry must be covered by `navAllow`.
|
||||
**Domain matching.** `navAllow` and `popupAllow` entries are lowercase domains or subdomains — no scheme, port, path, or wildcard. A host matches an entry when it equals it or ends with `.` + the entry, on whole DNS labels: `google.com` matches `mail.google.com`, never `evilgoogle.com`. `navAllow` governs **top-level (main-frame) navigations only**; subresource requests (scripts, images, media, API calls to CDNs) are never filtered by it, so a CDN belongs in `navAllow` only when the app really navigates the main frame there (a file download or a media viewer, for example). The `startUrl` host must be covered by `navAllow`, and every `popupAllow` entry by `navAllow` or the entry's sets.
|
||||
|
||||
Top-level file fields: `$schema` (optional editor hint), `schemaVersion` (int), `updated` (ISO date of the last content change), `apps` (array). The JSON Schema is [`catalog/webapps.schema.json`](../catalog/webapps.schema.json); `scripts/validate-catalog.ps1` checks it plus the rules a schema can't express (unique `id` and `name`, the coverage rules above, `updated` not in the future), and CI runs it on every pull request. The app rejects any fetched catalog whose `schemaVersion` it does not understand or that fails validation, and keeps the bundled copy.
|
||||
Top-level file fields: `$schema` (optional editor hint), `schemaVersion` (int, currently 2), `updated` (ISO date of the last content change), `navAllowSets` (optional: named lists of domains, each name `[a-z0-9-]`), `apps` (array).
|
||||
|
||||
**Named domain sets.** `google-account-domains` lists Google's account host on every country-code domain, `accounts.google.<ccTLD>`, taken from `https://www.google.com/supported_domains` (186 domains; `google.com` itself is already in each entry's `navAllow`). Google's sign-in hops there to set its cookies, for example `accounts.google.com.vn/accounts/SetSID`. Every `google` entry uses the set, because they share one sign-in, and so does `spotify`: its "Continue with Google" signs in to Google on Spotify's own profile, and goes through the same hops. The list lives in the catalog rather than in the app, so a change is a catalog pull request, not a release. Schema v2 (2 November 2026) added `navAllowSets`; no released build read v1, and the app reads v2 only. The JSON Schema is [`catalog/webapps.schema.json`](../catalog/webapps.schema.json); `scripts/validate-catalog.ps1` checks it plus the rules a schema can't express (unique `id` and `name`, every set an entry names exists and every set is used, the coverage rules above, `updated` not in the future), and CI runs it on every pull request. The app checks every catalog it loads or fetches against the same rules (`OdCatalogValidator`, whose test runs on this repository's file), rejects any whose `schemaVersion` it does not understand or that fails them, and keeps the copy it has. A fetched catalog takes effect from the next start.
|
||||
|
||||
## 2. Review rules for new entries (PR checklist)
|
||||
|
||||
@@ -40,7 +43,7 @@ Top-level file fields: `$schema` (optional editor hint), `schemaVersion` (int),
|
||||
2. `navAllow` is the *minimal* set of domains the app's main frame genuinely navigates to — test sign-in redirects, core flows, and downloads; do not add ad/tracking domains just to silence the default-browser handoff, and do not add CDN/asset domains that are only loaded as subresources.
|
||||
3. `popupAllow` contains only identity/SSO domains actually used by the sign-in flow.
|
||||
4. Isolated `profile` unless there is a concrete single-sign-on reason to share.
|
||||
5. `audioPin: true` only for apps whose primary function is audio/video playback.
|
||||
5. `audioPin: true` only for apps whose primary function is audio/video playback, or voice and video calls (`discord`, `facebook`): a call must not be suspended while it is in progress.
|
||||
6. No services that primarily distribute illegal content, and nothing requiring DRM schemes known not to work in WebView2 (see ROADMAP risk register).
|
||||
7. State in the PR description which flows you manually tested inside OmniDeck (or a WebView2 sample) — sign-in, notifications, a core action.
|
||||
8. `pwsh scripts/validate-catalog.ps1` passes locally (CI runs it too).
|
||||
@@ -49,15 +52,14 @@ Top-level file fields: `$schema` (optional editor hint), `schemaVersion` (int),
|
||||
|
||||
| id | profile | audioPin | Notes |
|
||||
|---|---|---|---|
|
||||
| spotify | spotify | yes | Web Player; requires DRM in the runtime — gated on the P0 spike result; third-party sign-in buttons (Google/Facebook/Apple) untested until then |
|
||||
| discord | discord | no | no global PTT on web; host hotkey partial mitigation |
|
||||
| youtube | google | yes | |
|
||||
| spotify | spotify | yes | Web Player; DRM works in the runtime ([spike #1](spikes/01-drm-widevine.md)). "Continue with Google / Facebook / Apple" move the main frame to `accounts.google.com`, `www.facebook.com` and `appleid.apple.com` and back, so those hosts and the `google-account-domains` set are listed (each hop checked up to the provider's sign-in page on 2 November 2026) |
|
||||
| discord | discord | yes | pinned while a voice or video call plays audio; no global PTT on web; host hotkey partial mitigation |
|
||||
| youtube | google | yes | sign-in hops to Google's country-code domains, allowed through the `google-account-domains` set like every `google` entry ([spike #2](spikes/02-google-sign-in.md)) |
|
||||
| gmail | google | no | |
|
||||
| gcalendar | google | no | |
|
||||
| gdrive | google | no | |
|
||||
| gmaps | google | no | replaces a native map mini-app entirely |
|
||||
| facebook | meta | no | |
|
||||
| messenger | meta | no | shares `meta` profile with Facebook for one sign-in |
|
||||
| facebook | meta | yes | pinned while a call or video plays audio; also Meta's web messaging (`facebook.com/messages`) since messenger.com closed in April 2026; the Messenger entry was removed |
|
||||
|
||||
## 4. Known-good candidates for post-v1 PRs
|
||||
|
||||
|
||||
@@ -105,5 +105,5 @@ WPF-UI ships Fluent System Icons (MIT). **Segoe Fluent Icons cannot be redistrib
|
||||
- `ui:` controls subclass their native counterparts — code and tests targeting base types (`ButtonBase`, `TextBoxBase`) keep working; don't duplicate logic per control flavor.
|
||||
- XamlStyler formats everything, including `ui:` attributes (upstream uses XamlStyler themselves).
|
||||
- High Contrast: when active, WPF-UI/system colors win over presets ([UI-MODES](UI-MODES.md) §4) — verify in the P3 accessibility pass.
|
||||
- `FluentWindow` chrome + child-HWND content (LibVLCSharp `VideoView`): fullscreen toggle is part of P0 spike #6; don't ship media pop-out before it passes.
|
||||
- `FluentWindow` chrome + child-HWND content (LibVLCSharp `VideoView`): fullscreen passed P0 spike #6, and media pop-out passed in P2 by moving the same view, whose overlay must not be owned by a closing window ([ARCHITECTURE](ARCHITECTURE.md) §2).
|
||||
- Version bumps of `WPF-UI*` packages are Dependabot PRs like any other, but read the release notes first — v3→v4 proved this library will rename APIs between majors.
|
||||
@@ -1,6 +1,6 @@
|
||||
# OmniDeck — Disclaimer
|
||||
|
||||
Version 1.0 — effective from the first public release (0.0.1-alpha.1).
|
||||
Version 1.1 — effective from the first release after 0.0.1-alpha.1. Changes since 1.0: the Stooq stock data service is no longer used, and Messenger is no longer in the web app catalog.
|
||||
|
||||
## Pre-release software
|
||||
|
||||
@@ -8,7 +8,7 @@ OmniDeck is pre-release (alpha/beta) software provided **as is**, without warran
|
||||
|
||||
## Financial data — not investment advice
|
||||
|
||||
The stocks module displays market data obtained from third-party providers (Stooq; optionally Twelve Data). This data may be **delayed, incomplete, or inaccurate**, and end-of-day sources are not suitable for time-sensitive decisions. Nothing displayed by OmniDeck constitutes financial, investment, legal, or tax advice, and no fitness for trading purposes is implied. Any decisions you make based on this data are entirely your own responsibility. Verify figures with your broker or an official exchange source before acting.
|
||||
The stocks module displays market data obtained from a third-party provider (Twelve Data, using your own API key). This data may be **delayed, incomplete, or inaccurate**, and it is not suitable for time-sensitive decisions. Nothing displayed by OmniDeck constitutes financial, investment, legal, or tax advice, and no fitness for trading purposes is implied. Any decisions you make based on this data are entirely your own responsibility. Verify figures with your broker or an official exchange source before acting.
|
||||
|
||||
## Weather data
|
||||
|
||||
@@ -16,7 +16,7 @@ Weather information comes from Open-Meteo and is provided for general planning o
|
||||
|
||||
## Third-party web applications and services
|
||||
|
||||
Web apps accessible through OmniDeck (Spotify, Discord, YouTube, Google services, Facebook, Messenger, and others in the catalog) are operated entirely by their respective providers. Their availability, functionality, sign-in behavior, and content may change or cease at any time without notice, and some capabilities differ from those providers' native desktop apps (documented in the README). OmniDeck has no control over, and assumes no responsibility for, those services or their content. Your use of them is subject to their own terms.
|
||||
Web apps accessible through OmniDeck (Spotify, Discord, YouTube, Google services, Facebook, and others in the catalog) are operated entirely by their respective providers. Their availability, functionality, sign-in behavior, and content may change or cease at any time without notice, and some capabilities differ from those providers' native desktop apps (documented in the README). OmniDeck has no control over, and assumes no responsibility for, those services or their content. Your use of them is subject to their own terms.
|
||||
|
||||
## Trademarks
|
||||
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
# OmniDeck — End User License Agreement (EULA)
|
||||
|
||||
Version 1.0 — effective from the first public release (0.0.1-alpha.1).
|
||||
Version 1.1 — effective from the first release after 0.0.1-alpha.1. Changes since 1.0: the Stooq stock data service is no longer used, and Messenger is no longer in the web app catalog.
|
||||
|
||||
By installing or using OmniDeck ("the Software"), you acknowledge the terms below. If you do not agree with them, do not install or use the Software.
|
||||
|
||||
@@ -10,7 +10,7 @@ The Software is free software licensed under the **GNU General Public License v3
|
||||
|
||||
## 2. Third-party components and services
|
||||
|
||||
The Software bundles third-party components (such as the .NET runtime, WPF-UI, Velopack and, in later versions, libVLC) that are governed by their own licenses, listed in THIRD-PARTY-NOTICES.md. It relies on the Microsoft Edge WebView2 Runtime that ships with Windows 11; the runtime is not bundled with the Software and is governed by Microsoft's license terms. The Software also loads third-party **web applications and data services** (e.g., Spotify, Discord, Google services, Open-Meteo, Stooq, Twelve Data). Your use of those services is governed solely by their own terms of service and privacy policies; you are responsible for complying with them. OmniDeck is not affiliated with, endorsed by, or sponsored by any of these providers, and their trademarks belong to their respective owners.
|
||||
The Software bundles third-party components (such as the .NET runtime, WPF-UI, Velopack and, in later versions, libVLC) that are governed by their own licenses, listed in THIRD-PARTY-NOTICES.md. It relies on the Microsoft Edge WebView2 Runtime that ships with Windows 11; the runtime is not bundled with the Software and is governed by Microsoft's license terms. The Software also loads third-party **web applications and data services** (e.g., Spotify, Discord, Google services, Open-Meteo, Twelve Data). Your use of those services is governed solely by their own terms of service and privacy policies; you are responsible for complying with them. OmniDeck is not affiliated with, endorsed by, or sponsored by any of these providers, and their trademarks belong to their respective owners.
|
||||
|
||||
## 3. Your responsibilities
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# OmniDeck — Privacy Policy
|
||||
|
||||
Version 1.0 — effective from the first public release (0.0.1-alpha.1).
|
||||
Version 1.1 — effective from the first release after 0.0.1-alpha.1. Changes since 1.0: the Stooq stock data service is no longer used, and Messenger is no longer in the web app catalog.
|
||||
|
||||
**Short version: OmniDeck collects nothing.** There is no telemetry, no analytics, no account, no crash auto-upload, and no server operated by the OmniDeck project that receives your data.
|
||||
|
||||
@@ -21,7 +21,7 @@ The app itself is installed separately, in `%LocalAppData%\OmniDeck`. Uninstalli
|
||||
OmniDeck only talks to the internet for the features you use:
|
||||
|
||||
- **Open-Meteo** — weather forecasts and geocoding for your saved locations.
|
||||
- **Stooq** and (only if you configure a key) **Twelve Data** — stock quotes for tickers on your watchlist.
|
||||
- **Twelve Data**, only after you enter your own API key: stock quotes, price history and symbol search for the stocks module.
|
||||
- **GitHub** — update checks/downloads (Velopack) and the daily web-app catalog refresh; opening a pre-filled bug-report issue happens in your browser and only if you choose to.
|
||||
- **Microsoft Edge WebView2 Runtime** — the Microsoft component that renders the web apps may contact Microsoft services on its own, for example Microsoft Defender SmartScreen reputation checks for the pages you visit and the runtime's own updates and diagnostic data. That traffic is governed by Microsoft's privacy statement and your Windows diagnostic-data settings; OmniDeck does not enable any additional reporting.
|
||||
- **The third-party web apps you open** (Spotify, Discord, Google services, Facebook, etc.) — these connections go directly from your device to those providers. Their handling of your data is governed by **their** privacy policies, not this one. OmniDeck does not inject analytics into, read the contents of, or proxy these sessions.
|
||||
|
||||
+1094
-17
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,53 @@
|
||||
# Spike 01 — DRM / Widevine in WebView2
|
||||
|
||||
**Question:** does WebView2 play Widevine-protected media — concretely, does the Spotify Web Player play?
|
||||
**Decision:** GO. The evergreen WebView2 Runtime ships its own Widevine CDM. With default settings and no browser arguments, EME offers Widevine (software) and PlayReady, and the Spotify Web Player played after sign-in.
|
||||
**Measured:** 2026-10-30 on `spike/p0` at `0fe4b12` (`spikes/WebLab`: the `--auto` EME probe, plus a session where the maintainer signed in by hand). Issue [#2](https://github.com/poli0981/OmniDeck/issues/2).
|
||||
|
||||
## Environment
|
||||
|
||||
- WebView2 Runtime 156.0.4314.50, evergreen and machine-wide, with WebView2 SDK 1.0.4314.35.
|
||||
- The runtime folder contains `WidevineCdm\_platform_specific\win_x64\widevinecdm.dll` (CDM 4.10.3050.1, with its `.sig`), and VMP signature files sit next to `msedgewebview2.exe` and `msedge.dll`.
|
||||
- Windows Insider build 29648, RTX 5080.
|
||||
- Spotify: the maintainer's own account, signed in with Spotify credentials.
|
||||
|
||||
## Method
|
||||
|
||||
- **EME probe page** (`spikes/WebLab/LabPages/eme.html`): on a bare profile with default environment options, call `navigator.requestMediaKeySystemAccess` and then `createMediaKeys` for each key system and robustness, with H.264 video and AAC audio.
|
||||
- **Shaka Player** support page, checked by eye.
|
||||
- **Spotify Web Player** on its own profile: sign in, then play, pause, resume and change tracks over about 20 minutes. WebLab logs `IsDocumentPlayingAudioChanged`; processes were checked in Task Manager.
|
||||
|
||||
## Results
|
||||
|
||||
| Key system | Robustness | Available |
|
||||
|---|---|---|
|
||||
| `com.widevine.alpha` | (none) | yes |
|
||||
| `com.widevine.alpha` | `SW_SECURE_CRYPTO` | yes |
|
||||
| `com.widevine.alpha` | `HW_SECURE_ALL` | no |
|
||||
| `com.microsoft.playready.recommendation` | (none) | yes |
|
||||
| `com.microsoft.playready.recommendation` | `3000` | no |
|
||||
| `com.microsoft.playready` | (none) | yes |
|
||||
| `org.w3.clearkey` | (none) | yes |
|
||||
|
||||
- **Spotify plays.**
|
||||
- Sign-in stayed inside `accounts.spotify.com`.
|
||||
- Playback started 11 s after landing on `open.spotify.com` and kept going for about 20 minutes. `IsDocumentPlayingAudio` toggled at each track change.
|
||||
- Task Manager showed three "WebView2 Utility: Widevine" processes of 52–58 MB each (private working set) while Spotify, YouTube and the EME probe page were open.
|
||||
- **No setup needed:** no browser argument or setting was required.
|
||||
- **Hardware-backed DRM** (Widevine `HW_SECURE_ALL`, PlayReady SL3000) is not offered. That limits HD playback on services that demand it. None of those are in the catalog.
|
||||
|
||||
## Consequences
|
||||
|
||||
- The `spotify` entry stays in the v1 catalog. The "gated on the P0 spike" note in [WEBAPP-CATALOG](../WEBAPP-CATALOG.md#3-initial-catalog-v1) §3 can go at P0 exit.
|
||||
- **Governor:** the Widevine processes are utility processes that count toward the footprint while media plays. `audioPin` already keeps Spotify active during playback.
|
||||
- **Future runtimes:** the CDM ships with the runtime and updates with it. If a future runtime breaks EME, the bug-report flow should be able to tell; an EME self-check (the probe page's logic) is a cheap addition to the report.
|
||||
- **Spotify's third-party sign-in buttons** (Google, Facebook, Apple) belong to spike #2.
|
||||
|
||||
## Reproduce
|
||||
|
||||
On `spike/p0`:
|
||||
|
||||
```powershell
|
||||
dotnet run --project spikes/WebLab -- --auto # EME results in %LocalAppData%\OmniDeck.Spikes\weblab\*.log
|
||||
dotnet run --project spikes/WebLab # open "spotify", sign in, play
|
||||
```
|
||||
@@ -0,0 +1,67 @@
|
||||
# Spike 02 — Google sign-in and SSO popups
|
||||
|
||||
**Question:** can users sign in to Google inside WebView2 with the default user agent, and do the SSO flows the catalog relies on work?
|
||||
**Decision:** GO with conditions. Google, Spotify, Discord and Facebook sign-ins all completed inside WebView2 with the default user agent, one Google sign-in covered every app on the shared `google` profile, and in a controlled re-test all five sign-ins survived a restart. Two conditions remain for P2:
|
||||
- Google's sign-in hops through country-code Google domains, and today's `navAllow` blocks that hop.
|
||||
- One session lost every cookie it had set, and the cause is still unknown.
|
||||
|
||||
**Measured:** 2026-10-30. Two sessions where the maintainer signed in by hand, in WebLab on `spike/p0`: the first at `0fe4b12`, the re-test at `3eae21e` with Chromium logging on. Between them, the `--measure` run (`ec79454`) and the cookie probes (`6c60b86`). Issue [#3](https://github.com/poli0981/OmniDeck/issues/3).
|
||||
|
||||
## Environment
|
||||
|
||||
- **User agent:** WebView2 Runtime 156.0.4314.50 with its default user agent, `Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/156.0.0.0 Safari/537.36 Edg/156.0.0.0`. The string is identical to Edge's, but `navigator.userAgentData.brands` also lists **Microsoft Edge WebView2 156**, so sites can see the embedding through client hints.
|
||||
- **Policy:** the catalog's `navAllow` / `popupAllow` were enforced. A navigation outside them was cancelled and logged; the product would hand it to the default browser.
|
||||
- **Profiles:** one environment, one profile per catalog `profile` group.
|
||||
- **Location:** Vietnam.
|
||||
|
||||
## Results
|
||||
|
||||
### Sign-in flows (main frame)
|
||||
|
||||
| App (profile) | Flow | Result |
|
||||
|---|---|---|
|
||||
| YouTube (`google`) | `youtube.com` → `accounts.google.com` sign-in → passkey-enrollment prompt → `CheckCookie` → Google's prompts (a home-address prompt the first time, identity verification by selfie on the re-test) → `accounts.youtube.com/accounts/SetSID` → **`accounts.google.com.vn/accounts/SetSID`** | The credentials were accepted. The main-frame hop to `google.com.vn` falls outside `navAllow` and was cancelled. Google retried it 15 times in about 40 s the first time and 6 times on the re-test, a loop the user can only leave by navigating away. The `.google.com.vn` sign-in cookies were set anyway, through subresource requests. |
|
||||
| Gmail, Drive, Calendar, Maps (`google`) | `mail.google.com` → `accounts.google.com/ServiceLogin` → `<service>/accounts/SetOSID` → app | Signed in with no prompt. One sign-in covers the group. |
|
||||
| Spotify (`spotify`) | `open.spotify.com` → `accounts.spotify.com/login` → back | Signed in with Spotify credentials; playback works (spike #1) |
|
||||
| Discord (`discord`) | inside `discord.com/app` | Signed in |
|
||||
| Facebook (`meta`) | `facebook.com` → `/checkpoint/…` → `/auth_platform/afad/` → home | Facebook's new-device checkpoint, completed in the app, both times |
|
||||
|
||||
Other observations:
|
||||
|
||||
- Google offered passkey enrollment. It was skipped, so WebAuthn was not exercised.
|
||||
- YouTube and Facebook asked for the Notifications permission. P2 bridges these requests through `PermissionRequested`.
|
||||
|
||||
### Sessions across restarts
|
||||
|
||||
- **First session (12:35–13:01, 11 windows, about 25 minutes):**
|
||||
- At the next start, Google, Spotify and Facebook were signed out. Not a single cookie set during that session was left in any of the four profiles: neither the auth cookies nor tracking cookies such as `datr`, `sp_t` and `__dcfduid`.
|
||||
- Cookies set by an earlier scripted run in the same `google` profile were still there.
|
||||
- Discord stayed signed in, because its token lives in localStorage, which survived.
|
||||
- **Cookie probes:** a one-year cookie set from a lab page survived a clean exit, a window close, a host kill, and a hard kill of the whole WebView2 tree 55 s after it was set. How the host shut down does not explain the loss.
|
||||
- **Controlled re-test** (Chromium logging on: sign in, wait, close with the window's X): the auth cookies were on disk right after closing: Google `SID`/`SAPISID`/`__Secure-*PSID`, Spotify `sp_dc`/`sp_key`, Facebook `c_user`/`xs`. On restart, `--check-signed-in` found **Gmail, YouTube, Spotify, Facebook and Discord all signed in**. Gmail was still signed in after a reload with CDP capture on (spike #4). The Chromium log shows no cookie-store or decryption errors.
|
||||
- **One clue:** in the first session the `google` profile wrote nothing to its preferences diagnostics. The other profiles logged every 10 s. Not enough to name a cause.
|
||||
|
||||
### Not tested
|
||||
|
||||
Spotify's "Continue with Google / Facebook / Apple" buttons were not tried; the maintainer used Spotify credentials. `spotify`'s `navAllow` lists only Spotify's domains, so if those buttons move the main frame to `accounts.google.com`, `facebook.com` or `appleid.apple.com`, the product would hand them to the default browser and sign-in would fail. They must be tested in P2 before the entry's lists are final ([WEBAPP-CATALOG](../WEBAPP-CATALOG.md#2-review-rules-for-new-entries-pr-checklist) §2).
|
||||
|
||||
## Consequences
|
||||
|
||||
- **Google's account domains on every country-code TLD.** Google lists them at `https://www.google.com/supported_domains`. Enumerating about 190 domains in each `google` entry would be unreadable. The proposal is a catalog schema v2 field, `navAllowSets: ["google-account-domains"]`, which the app resolves from a list it bundles. A narrower rule in code would only allow `accounts.google.<ccTLD>/accounts/SetSID`. Either way this changes the catalog or its schema, so it is decided in P2 with the maintainer's approval. **Decided on 2 November 2026:** the first option, with the set defined in the catalog itself instead of bundled with the app, so it changes with a catalog pull request ([WEBAPP-CATALOG](../WEBAPP-CATALOG.md) §1).
|
||||
- **Sessions must be checked, not assumed.** The P2 exit criterion "stays signed in across hibernation" makes the unexplained loss a real risk:
|
||||
- P2 dogfoods with Chromium logging available;
|
||||
- the web runner records whether each app comes back signed in after a restart. The `--check-signed-in` probes become a debug-only health check;
|
||||
- the bug report includes per-profile cookie-store counts, never cookie values.
|
||||
- If the loss comes back, it gets investigated before 0.2.0.
|
||||
- **Default user agent only:** this works today, and there is no spoofing. Because client hints name WebView2, Google could block it later. The roadmap's mitigation still applies: document it as an upstream limitation.
|
||||
- **New-device flows** (Facebook's checkpoint, Google's prompts including the selfie check) need full in-app navigation within the entry's domains, which works.
|
||||
|
||||
## Reproduce
|
||||
|
||||
On `spike/p0`:
|
||||
|
||||
```powershell
|
||||
dotnet run --project spikes/WebLab -- "--wv2-args=--enable-logging --v=0" # sign in by hand, then close
|
||||
dotnet run --project spikes/WebLab -- --check-signed-in # SIGNED-IN lines in weblab\*.log
|
||||
dotnet run --project spikes/WebLab -- --cookie-set=probe1 # then --cookie-check
|
||||
```
|
||||
@@ -0,0 +1,114 @@
|
||||
# Spike 03 — Memory reality check and governor metric
|
||||
|
||||
**Question:** what do web apps really cost in each governor state, and which memory metric do the caps use?
|
||||
**Decision:** GO. The governor measures **private commit** (`Process.PrivateMemorySize64`), summed over the shell and every WebView2 process. Suspension mostly trims the working set rather than freeing memory, so a working-set metric would reward exactly that trimming. The ladder's real memory saving comes from hibernation.
|
||||
**Measured:** 2026-10-30 on `spike/p0`: the `WebLab --measure` run at `ec79454` (60 s phases, a sample every 2 s), the signed-in Gmail ladder at `3eae21e`, and the maintainer's own interactive session. Issue [#4](https://github.com/poli0981/OmniDeck/issues/4).
|
||||
|
||||
## Environment
|
||||
|
||||
- Windows Insider build 29648, i7-14700KF, 32 GB RAM, RTX 5080.
|
||||
- WebView2 Runtime 156.0.4314.50. One shared environment and one profile per catalog `profile` group, hosted in WebLab, a plain WPF window standing in for the shell.
|
||||
- Caveat: Chromium's memory heuristics depend on physical RAM, so absolute numbers on an 8 GB machine will differ.
|
||||
|
||||
## Method
|
||||
|
||||
- **Sampler.** Every 2 s, it reads the shell and each process from `CoreWebView2Environment.GetProcessInfos()`. For each process it records:
|
||||
- private commit (`Process.PrivateMemorySize64`);
|
||||
- private working set (`GetProcessMemoryInfo` → `PROCESS_MEMORY_COUNTERS_EX2.PrivateWorkingSetSize`, the figure Task Manager's Memory column shows);
|
||||
- working set;
|
||||
- CPU time.
|
||||
|
||||
Renderers are attributed to apps through `GetProcessExtendedInfosAsync`, from each frame's root frame id and host.
|
||||
- **Ladder per app.** Active → hidden → `TrySuspendAsync` + `MemoryUsageTargetLevel.Low` → resumed (`Normal` + `Resume` + shown) → disposed, keeping only `{url}` → reopened. The active, suspended and reopened phases last 60 s; the others last 30 s. Each figure is the mean of the phase's samples after the first two.
|
||||
- **Everything at once.** All 8 catalog apps open, then every app except the visible one suspended, then all disposed.
|
||||
- **Real use.** The maintainer's session: 11 app windows (Gmail three times), signed in, with Spotify and YouTube playing, for about 20 minutes.
|
||||
|
||||
## Results
|
||||
|
||||
### Ladder (MB)
|
||||
|
||||
"App" counts the processes attributed to the app. "Shared" counts the browser, GPU and utility processes.
|
||||
|
||||
**Discord, signed in**
|
||||
|
||||
| State | App commit | App private WS | Shared commit | Shared private WS | CPU (ms/s) |
|
||||
|---|---|---|---|---|---|
|
||||
| Active | 443 | 394 | 222 | 107 | 15.0 |
|
||||
| Hidden | 307 | 268 | 171 | 96 | 2.6 |
|
||||
| Suspended + Low | 291 | 93 | 170 | 49 | 2.0 |
|
||||
| Resumed | 294 | 61 | 218 | 37 | 0.7 |
|
||||
| Disposed | 0 | 0 | 0 | 0 | 0 |
|
||||
| Reopened | 403 | 356 | 203 | 100 | 10.4 |
|
||||
|
||||
**YouTube home, signed out** (see [Open items](#open-items))
|
||||
|
||||
| State | App commit | App private WS | Shared commit | Shared private WS | CPU (ms/s) |
|
||||
|---|---|---|---|---|---|
|
||||
| Active | 206 | 182 | 260 | 124 | 14.8 |
|
||||
| Hidden | 168 | 144 | 242 | 114 | 2.6 |
|
||||
| Suspended + Low | 145 | 49 | 241 | 56 | 2.6 |
|
||||
| Resumed | 165 | 57 | 258 | 40 | 4.6 |
|
||||
| Disposed | 0 | 0 | 0 | 0 | 0 |
|
||||
| Reopened | 180 | 164 | 263 | 123 | 3.1 |
|
||||
|
||||
**Gmail, signed in** (measured after the sign-in re-test in spike #2; still signed in after the reopen)
|
||||
|
||||
| State | App commit | App private WS | Shared commit | Shared private WS | CPU (ms/s) |
|
||||
|---|---|---|---|---|---|
|
||||
| Active | 253 | 234 | 269 | 130 | 19.4 |
|
||||
| Hidden | 214 | 198 | 248 | 119 | 1.3 |
|
||||
| Suspended + Low | 196 | 65 | 248 | 58 | 0.3 |
|
||||
| Resumed | 221 | 148 | 261 | 39 | 17.6 |
|
||||
| Disposed | 0 | 0 | 0 | 0 | 0 |
|
||||
| Reopened | 255 | 236 | 254 | 122 | 25.7 |
|
||||
|
||||
- **Shell:** the WPF window itself used 93–130 MB of private commit throughout.
|
||||
- **Suspend and resume:** `TrySuspendAsync` returned `true` in 0–4 ms, and resuming took 1–5 ms.
|
||||
- **Reopen after dispose:** 155–176 ms until the controller was ready, and 590–900 ms until the first `NavigationCompleted` (2.5 s for signed-in Gmail).
|
||||
- **One stall:** creating a controller while the previous browser process was still shutting down took 5.2 s once.
|
||||
|
||||
### Everything at once (MB)
|
||||
|
||||
| Scenario | Processes | Σ private commit | Σ private WS (≈ Task Manager) |
|
||||
|---|---|---|---|
|
||||
| 8 catalog apps open, idle (Discord signed in; Google, Spotify and Facebook signed out, see spike #2) | 17 | 2,246 | 1,552 |
|
||||
| the same, with 7 of them suspended + Low | 17 | 2,103 | 853 |
|
||||
| all disposed | 1 (shell) | 130 | 72 |
|
||||
| maintainer's session: 11 windows signed in, 2 playing | 26 | 4,429 (peak 5,022) | 3,037 |
|
||||
|
||||
In the maintainer's session:
|
||||
|
||||
- The GPU process alone held 955 MB of private commit but only 335 MB of private working set.
|
||||
- Widevine ran in three utility processes of 52–58 MB each.
|
||||
- Task Manager showed 3,085 MB for the WebView2 group while the sampler read 2,960 MB of private working set for the WebView2 processes. The sampler matches what users see.
|
||||
|
||||
## Analysis
|
||||
|
||||
- **Hiding** a web app already releases 15–31 % of its committed memory, because Chromium drops caches for hidden pages.
|
||||
- **Suspend + Low** cuts the private working set by 65–70 % but committed memory by only 5–15 %. The pages move to the standby list or the page file; they are not released. After resume the working set stays low until those pages are touched again.
|
||||
|
||||
A working-set metric would therefore read low exactly when nothing has been freed. That is the page shuffling [RAM-GOVERNOR](../RAM-GOVERNOR.md#4-cap-enforcement) §4 rejects.
|
||||
- **Only disposal releases memory.** Disposing the *last* web app ends the whole WebView2 browser process. That is the only way the shared overhead goes away: 170–260 MB when idle, and about 1.5 GB of commit (mostly GPU) in the maintainer's media session.
|
||||
- **The ladder's assumption was wrong:** RAM-GOVERNOR §1 assumed "tens of MB" for a suspended web app. Measured, its committed memory stays at 85–95 % of the hidden state.
|
||||
|
||||
## Consequences
|
||||
|
||||
- **Metric:** private commit, summed over the shell and every WebView2 process. `Process.PrivateMemorySize64` needs no process handle. The task-manager panel labels the figure as committed memory and may show the private working set beside it, since that is the number Task Manager users know.
|
||||
- **Victims:** cap enforcement picks apps by their attributed commit. Shared processes appear as a separate "WebView2 (shared)" row and are never demoted.
|
||||
- **Ladder:** the Suspended rung saves CPU and power (2 ms/s instead of about 15 ms/s), not memory. Memory pressure goes straight to Hibernate. RAM-GOVERNOR §1 and §4 are updated at P0 exit.
|
||||
- **Caps:** the maintainer's real session reached 4.4–5.0 GB committed, right at the 4.5 GiB soft cap. That is fine on 32 GB but not on 8 GB. Proposal for P1: default caps relative to physical memory, for example soft = min(4.5 GiB, 35 % of RAM) and hard = min(6 GiB, 50 %), re-checked while dogfooding in P2.
|
||||
- **Last app:** hibernating the last web app costs a browser restart on the next open (about 160 ms plus the page load). The web runner should avoid disposing the last app and immediately opening another, where a 5 s stall was seen.
|
||||
- **GPU process:** its commit balloons with video (955 MB), and it is shared, so it inflates the total without being something the governor can demote. When shared processes alone push the total over the hard cap, the hard-cap toast says so instead of hibernating apps that would free nothing.
|
||||
|
||||
## Open items
|
||||
|
||||
- ~~**Gmail:** Gmail signed in was not measured, because the profile had lost its session (spike #2).~~ Done after the sign-in re-test; see the Gmail table above. The same pattern holds: hiding −15 % commit, suspend + Low −8 % more commit but −67 % private working set.
|
||||
- **8 GB machines:** every number here comes from a 32 GB machine. Re-measure on a GA build of Windows 11 with 8 GB of RAM during P2 dogfooding.
|
||||
|
||||
## Reproduce
|
||||
|
||||
On `spike/p0`:
|
||||
|
||||
```powershell
|
||||
dotnet run --project spikes/WebLab -- --measure --phase=60 # CSV in %LocalAppData%\OmniDeck.Spikes\memory\
|
||||
```
|
||||
@@ -0,0 +1,58 @@
|
||||
# Spike 04 — CDP console capture
|
||||
|
||||
**Question:** can the web runner keep a per-app console ring buffer through the DevTools Protocol, safely and cheaply?
|
||||
**Decision:** GO. Capture through `Runtime.enable` + `Log.enable` works with the DevTools UI disabled. The widely used page-side check did not detect it, its cost was too small to measure, and signed-in apps kept working with it on. Capture stays on for every web app.
|
||||
**Measured:** 2026-10-30 on `spike/p0`: the `WebLab --auto` run (`0fe4b12`), the `--measure` run (`ec79454`) and the `--check-signed-in` run (`3eae21e`). Issue [#5](https://github.com/poli0981/OmniDeck/issues/5).
|
||||
|
||||
## Environment
|
||||
|
||||
- WebView2 Runtime 156.0.4314.50, with `AreDevToolsEnabled = false` (the release setting) on every view.
|
||||
- The capture subscribes to `Runtime.consoleAPICalled`, `Runtime.exceptionThrown` and `Log.entryAdded` through `GetDevToolsProtocolEventReceiver`, after `CallDevToolsProtocolMethodAsync("Runtime.enable" / "Log.enable")`.
|
||||
- It feeds a 200-entry ring buffer per app.
|
||||
|
||||
## Method
|
||||
|
||||
- **Detection page** (`LabPages/cdp-detect.html`): logs an `Error` whose `stack` getter has a side effect. Only a DevTools client that serializes console arguments would read it. The page then emits `console.log`, `console.warn`, an uncaught exception and a failing fetch. It is checked with capture off, with Runtime + Log, and with Log only.
|
||||
- **Signed-in apps:**
|
||||
- Discord, Gmail and Spotify run with capture off for 60 s, on for 60 s, then reload with capture on;
|
||||
- separately, signed-in Gmail reloads with capture on.
|
||||
|
||||
## Results
|
||||
|
||||
| Mode | Detected by the page? | Captured |
|
||||
|---|---|---|
|
||||
| off | no | nothing |
|
||||
| Runtime + Log | **no** | `console.debug/log/warn/error`, uncaught exceptions (`Runtime.exceptionThrown`), network errors such as a 404 (`Log.entryAdded`) |
|
||||
| Log only | no | network and browser messages only; **not** `console.*` calls |
|
||||
|
||||
- **DevTools UI:** capture works with it disabled. Turning capture on took 4–24 ms per app (230 ms once, on Spotify).
|
||||
- **Signed-in apps:**
|
||||
- Discord, signed in, reloaded fine with capture on;
|
||||
- Gmail, signed in, reloaded with capture on and stayed signed in, with 12 entries captured;
|
||||
- no captcha or sign-out appeared.
|
||||
- **Cost:**
|
||||
- Across the three apps, committed memory was 1,057 MB with capture off, 1,041 MB with it on, and 988 MB after the reloads. The difference is within noise.
|
||||
- CPU was dominated by the apps themselves.
|
||||
- The buffer itself is at most 200 short strings per app.
|
||||
- **Volume:**
|
||||
- Discord logged 86 entries in about 2 minutes, mostly debug lines styled with `%c` CSS arguments. A 200-entry ring holds about 4–5 minutes of Discord.
|
||||
- Gmail and Spotify were far quieter: interventions, and Tracking Prevention warnings on Spotify's login page.
|
||||
- **Personal data:** console lines carry it. Discord logs the user's numeric ID, for example.
|
||||
- **Not the alternative:** Chromium's own `--enable-logging` also records console messages, but in one global file shared by every app, including personal data. It is a diagnostic switch, not the capture mechanism.
|
||||
|
||||
## Consequences
|
||||
|
||||
- **Always on:** the web runner enables `Runtime` + `Log` for each web app when its view is created, and keeps the DevTools UI disabled. Capture stops with the view when it is disposed.
|
||||
- **Two buffers per app:** a 200-entry ring for everything, and a 50-entry ring for errors and uncaught exceptions only, so debug chatter cannot evict the lines a bug report needs.
|
||||
- **Formatting:** apply `%c` / `%s` format arguments when rendering, and drop the CSS.
|
||||
- **Privacy:** console lines go through the bug-report scrubber (SPEC §6) like the logs do. Nothing is captured to disk until the user starts a report.
|
||||
- **Watch:** this held on runtime 156. If a provider starts flagging `Runtime.enable` (captchas, sign-outs), the fallback is to enable capture only while a bug report is being recorded.
|
||||
|
||||
## Reproduce
|
||||
|
||||
On `spike/p0`:
|
||||
|
||||
```powershell
|
||||
dotnet run --project spikes/WebLab -- --auto # detection and capture modes
|
||||
dotnet run --project spikes/WebLab -- --check-signed-in # signed-in Gmail reload with capture on
|
||||
```
|
||||
@@ -0,0 +1,71 @@
|
||||
# Spike 05 — Runtime preset swap
|
||||
|
||||
**Question:** can the three UI presets (`Od.*` token dictionaries) be swapped at runtime on top of WPF-UI 4.3 without visual artifacts?
|
||||
**Decision:** GO with conditions. Replacing a code-built preset dictionary in place is fast and showed no visual artifacts. Three conditions apply: any size WPF-UI reads through `StaticResource` goes through our own `Od*` styles, motion is driven from code, and the Windows text size is read from the registry rather than through WinRT.
|
||||
**Measured:** 2026-10-30 on `spike/p0` at `840c511` (`spikes/ThemeLab`: an `--auto` run, plus a visual check by the maintainer). Issue [#6](https://github.com/poli0981/OmniDeck/issues/6).
|
||||
|
||||
## Environment
|
||||
|
||||
- Windows Insider build 29648, 32 GB RAM, RTX 5080.
|
||||
- .NET 10.0.14, WPF-UI 4.3.0.
|
||||
- Dark theme with the Mica backdrop; text size 100 %, Windows animation effects on, high contrast off.
|
||||
|
||||
## Method
|
||||
|
||||
ThemeLab is a `FluentWindow` with Mica. It builds each preset's `ResourceDictionary` in code from the [UI-MODES](../UI-MODES.md#2-token-table) table and replaces it in place in `Application.Resources.MergedDictionaries`, after WPF-UI's `ThemesDictionary` and `ControlsDictionary`. The `--auto` run does four things:
|
||||
|
||||
1. Under each preset, probes default `ui:Button`, `ui:TextBox` and `ui:Card` controls next to `Od`-styled ones, recording `ActualHeight`, `Padding`, `FontSize` and the template's `CornerRadius`.
|
||||
2. Times 30 swaps up to `Loaded` dispatcher priority (that is, after layout and render), at 307 and at 3,426 visual elements.
|
||||
3. Switches Light and Dark with `ApplicationThemeManager.Apply` and checks that the preset layer is still merged.
|
||||
4. Applies a style whose storyboard uses `{DynamicResource Od.Motion.Duration}`.
|
||||
|
||||
The maintainer then switched presets and themes by hand and hovered the motion tile, looking for flicker, Mica glitches and layout jumps. Separately, WPF-UI 4.3's control XAML (tag `4.3.0`) was read to see which keys each control uses through `StaticResource` and which through `DynamicResource`.
|
||||
|
||||
## Results
|
||||
|
||||
### Which sizes follow a swap
|
||||
|
||||
| Control | Dynamic | Standard | Comfort | Follows? |
|
||||
|---|---|---|---|---|
|
||||
| default `ui:Button`: padding | 11,5,11,6 | 11,5,11,6 | 11,5,11,6 | no: `ButtonPadding` is a `StaticResource` |
|
||||
| default `ui:Button`: font size / corner | 13.5 / 8 | 15.5 / 6 | 19 / 6 | yes: `ControlContentThemeFontSize` and `ControlCornerRadius` are dynamic |
|
||||
| default `ui:Card`: padding | 14,16,14,16 | 14,16,14,16 | 14,16,14,16 | no: `CardPadding` is a `StaticResource` |
|
||||
| `Od` button (BasedOn `DefaultUiButtonStyle`): height / padding | 32 / 8,4 | 36 / 12,6 | 47 / 20,10 | yes |
|
||||
| `Od` text box (BasedOn `DefaultUiTextBoxStyle`): height / padding | 32 / 8,4 | 36 / 12,6 | 47 / 20,10 | yes |
|
||||
|
||||
The preset layer also redefined `ButtonPadding` and `CardPadding`. WPF-UI's own value won anyway, because those references are resolved inside `ControlsDictionary`. In the 4.3 sources, `ButtonPadding`, `ButtonBorderThemeThickness`, `CardPadding`, `TextBoxBorderThemeThickness` and the text box icon margins are `StaticResource`. `ControlCornerRadius`, `ControlContentThemeFontSize`, `TextControlThemePadding`, `TextControlThemeMinHeight` and `TextControlThemeMinWidth` are `DynamicResource`.
|
||||
|
||||
### Swap time (30 swaps each)
|
||||
|
||||
| Visual elements | min | median | p90 | max |
|
||||
|---|---|---|---|---|
|
||||
| 307 | 6.3 ms | 7.0 ms | 7.8 ms | 18.2 ms |
|
||||
| 3,426 | 51.3 ms | 62.5 ms | 70.2 ms | 73.3 ms |
|
||||
|
||||
The cost is roughly 18 µs per element, so a shell of 1,000–2,000 elements should swap in about 20–40 ms, one or two frames.
|
||||
|
||||
### Theme, motion, text size
|
||||
|
||||
- **Light/Dark:** `ApplicationThemeManager.Apply` took about 125 ms at 3,426 elements. The preset layer stayed merged both ways, so presets and theme really are independent axes.
|
||||
- **Motion:** a `DynamicResource` inside a style storyboard throws `InvalidOperationException: Cannot freeze this Storyboard timeline tree for use across threads.` ThemeLab's `OdMotion` behavior avoids this: it reads `Od.Motion.Duration` when each animation starts, skips the animation when the value is 0 or Windows animation effects are off, and follows a swap from the next hover on.
|
||||
- **Text size:** WPF ignores the Windows text size setting. It can be read from two places, and both returned 1.00 here:
|
||||
- the registry, `HKCU\Software\Microsoft\Accessibility\TextScaleFactor` (a percentage; missing means 100);
|
||||
- WinRT, `UISettings.TextScaleFactor`. This needs a Windows-versioned target framework, which puts `Microsoft.Windows.SDK.NET.dll` (26.3 MB) in the output.
|
||||
- **Visual check (maintainer):** no flicker, Mica glitch or layout jump when switching presets or themes, and the motion tile behaved as expected.
|
||||
|
||||
## Consequences
|
||||
|
||||
- **Theme engine (P1):** build the preset dictionary in code, since it needs the OS text scale and the user's overrides anyway. Swap that one merged dictionary in place, and keep WPF-UI's dictionaries first.
|
||||
- **`Od` styles:** for each control that reads a size through `StaticResource`, ship an implicit style BasedOn the WPF-UI default with `DynamicResource` setters bound to `Od.*` tokens. Dynamic WPF-UI keys can be overridden directly in the preset layer, with a comment on each override ([WPFUI-CONVENTIONS](../WPFUI-CONVENTIONS.md#6-theming-with-od-tokens) §6).
|
||||
- **Motion:** no token-driven storyboards in XAML styles. Animations go through a small behavior that reads `Od.Motion.*` when it starts and honors `SystemParameters.ClientAreaAnimation`.
|
||||
- **Text size:** read the registry value at startup, and read it again on `WM_SETTINGCHANGE` and whenever the window is activated. This needs no Windows-versioned target framework, which saves about 26 MB. This spike did not observe which notification fires on a live change; re-reading on activation covers both cases.
|
||||
- **Budget:** swaps only happen when the user picks a preset, so 20–70 ms is fine; keep the shell's visual tree lean. High Contrast and text sizes above 100 % are checked in the P3 accessibility pass.
|
||||
|
||||
## Reproduce
|
||||
|
||||
On `spike/p0`:
|
||||
|
||||
```powershell
|
||||
dotnet run --project spikes/ThemeLab -- --auto # log in %LocalAppData%\OmniDeck.Spikes\theme\
|
||||
dotnet run --project spikes/ThemeLab # interactive
|
||||
```
|
||||
@@ -0,0 +1,90 @@
|
||||
# Spike 06 — LibVLCSharp in WPF (airspace, fullscreen)
|
||||
|
||||
**Question:** does LibVLCSharp's `VideoView` work inside a WPF-UI `FluentWindow` with overlay controls and a fullscreen toggle?
|
||||
**Decision:** GO with conditions. Inside a Mica `FluentWindow`, `VideoView` plays with hardware decoding, and WPF overlay controls and subtitles draw correctly above the video. Fullscreen works by resizing the shell window over the monitor. FlyleafLib is not needed. Three conditions:
|
||||
- moving a playing player to another window (pop-out) needs a video-output restart plus a seek;
|
||||
- the pop-out's overlay was clipped once;
|
||||
- with the SPEC plugin set, libVLC adds about 39 MB compressed to the installer.
|
||||
|
||||
**Measured:** 2026-10-30 on `spike/p0` at `2a87046` (`spikes/MediaLab`): the `--auto` and `--auto-move` runs on the trimmed plugin build, with every screen capture checked by eye. Issue [#7](https://github.com/poli0981/OmniDeck/issues/7).
|
||||
|
||||
## Environment
|
||||
|
||||
- LibVLCSharp.WPF 3.10.2 and VideoLAN.LibVLC.Windows 3.0.24 (libVLC 3.0.24 "Vetinari"); WPF-UI 4.3.0; .NET 10.0.14.
|
||||
- One 2560×1440 monitor at 100 % scale; RTX 5080 (D3D11VA); Windows Insider build 29648.
|
||||
- Test media, generated locally with ffmpeg so nothing was downloaded:
|
||||
- H.264/AAC 1080p30, 60 s;
|
||||
- H.264/AAC 2160p60, 20 s;
|
||||
- an external `.srt` with Vietnamese and Japanese text.
|
||||
|
||||
## Method
|
||||
|
||||
MediaLab is a `FluentWindow` (Mica, `ui:TitleBar`) holding a `VideoView`. The view's WPF content is a badge in the top-right corner and a control bar (`ui:Button`, `Slider`, time).
|
||||
|
||||
The `--auto` run:
|
||||
1. plays the 1080p clip and adds the `.srt`;
|
||||
2. toggles fullscreen in place;
|
||||
3. opens a fullscreen window and a pop-out, each with and without restarting the video output;
|
||||
4. hides and shows the main window;
|
||||
5. plays the 2160p60 clip.
|
||||
|
||||
At every step it captures the screen as DWM composited it, because the video and the overlay are separate windows and only the screen shows how they combine. It also logs libVLC warnings, frame statistics, CPU and private commit. `--auto-move` repeats the hand-over to another window with a seek, capturing at 0.5 s and 2 s.
|
||||
|
||||
## Results
|
||||
|
||||
| Check | Result |
|
||||
|---|---|
|
||||
| WPF overlay above the video (airspace) | OK. LibVLCSharp's overlay window draws the WPF controls above the video, translucent backgrounds included |
|
||||
| External subtitles (`.srt`, UTF-8, Vietnamese and Japanese) | OK |
|
||||
| Fullscreen in place: shell window resized to the monitor, chrome hidden, corners square | OK, playback never interrupted |
|
||||
| Hand-over to another window, as is | **No.** The video keeps drawing into the original window, and the new window stays black |
|
||||
| … after re-selecting the video track | The new window shows video, corrupted until the next keyframe (several seconds) |
|
||||
| … after re-selecting the track and seeking to the current time | **OK.** A clean picture within 0.5 s, in both directions |
|
||||
| Pop-out into a second `FluentWindow` | Video OK. The overlay button was clipped on its right side once |
|
||||
| Hide and show (tray) | Overlay and playback come back |
|
||||
| Hardware decoding (D3D11VA) | 1080p30 and 2160p60 with 0 lost frames, at under 1 % CPU (of 28 logical cores) |
|
||||
|
||||
**Memory** (private commit; libVLC runs inside the shell process):
|
||||
|
||||
| Moment | Private commit |
|
||||
|---|---|
|
||||
| before libVLC loads | 45 MB |
|
||||
| libVLC loaded | 116 MB |
|
||||
| playing 1080p30 | 284 MB |
|
||||
| playing 2160p60 | 522 MB |
|
||||
| after `Stop` | 324 MB |
|
||||
|
||||
**Size**, x64 only. The package also copies its x86 and ARM64 builds unless `VlcWindowsX86Enabled` and `VlcWindowsArm64Enabled` are set to `false`.
|
||||
|
||||
| Plugin set | Raw | Zip (deflate, level 9) |
|
||||
|---|---|---|
|
||||
| Full (321 plugins) | 106 MB | 48 MB |
|
||||
| SPEC set (267 plugins) | 86 MB | 39 MB |
|
||||
|
||||
The SPEC set keeps the plugin folders access, audio filter, audio mixer, audio output, codec, demux, packetizer, stream filter, text renderer, spu, video chroma, video filter, video output and misc. The largest files are `libavcodec` (18 MB), `access/srt` (4 MB; network streaming only, removable for local files), `libass` (3.4 MB) and `freetype` (3 MB).
|
||||
|
||||
## Consequences
|
||||
|
||||
- **Engine:** LibVLCSharp with libVLC 3.0.x, as [SPEC](../SPEC.md#36-media-player) §3.6 says. FlyleafLib stays unused.
|
||||
- **Fullscreen:** the module's own window (main or pop-out) covers the monitor; the player never moves to a separate fullscreen window. This passes the fullscreen part of [WPFUI-CONVENTIONS](../WPFUI-CONVENTIONS.md#8-hard-rules) §8.
|
||||
- **Pop-out:** move the player to the new `VideoView`, re-select the video track, and seek to the current time. Pop-out ships only after P2 fixes the overlay's sizing in a newly created window and re-tests it, as §8 requires.
|
||||
- **Build:**
|
||||
- set `VlcWindowsX86Enabled` and `VlcWindowsArm64Enabled` to `false` and use the SPEC include list;
|
||||
- consider dropping the network access plugins (srt and others), since playback is local-file only;
|
||||
- libVLC is the largest single component in the installer, at about 39 MB compressed. THIRD-PARTY-NOTICES gets its entry in P2, with approval.
|
||||
- **Governor:** playback holds 280–520 MB committed in the shell process, and `Stop` alone kept 324 MB. `SuspendAsync` therefore stops and disposes the `MediaPlayer`, and `HibernateAsync` disposes the `LibVLC` instance as well.
|
||||
- **Not tested:** a second monitor and per-monitor DPI changes, because only one monitor was available. Check them in P2 once the media module exists.
|
||||
- **Log noise:** filter these harmless libVLC messages out of the app log:
|
||||
- `option quiet does not exist`;
|
||||
- `SetThumbNailClip failed` (a fullscreen window without a taskbar button);
|
||||
- `not enough decoding slices`.
|
||||
|
||||
## Reproduce
|
||||
|
||||
On `spike/p0`, with the test clips from `spikes/README.md`:
|
||||
|
||||
```powershell
|
||||
dotnet build spikes/MediaLab -c Release -p:TrimVlc=true
|
||||
spikes\MediaLab\bin\Release\net10.0-windows\win-x64\MediaLab.exe --auto
|
||||
spikes\MediaLab\bin\Release\net10.0-windows\win-x64\MediaLab.exe --auto-move --seek-on-move
|
||||
```
|
||||
@@ -0,0 +1,143 @@
|
||||
# Spike 07 — Stock data providers
|
||||
|
||||
**Question:** which data sources can the stocks module rely on, and what do their responses look like?
|
||||
**Decision:** GO with conditions. In v1 the only provider is Twelve Data, with the user's own key; Stooq is dropped. The free plan covers US listings (stocks, ETFs and the US listings of foreign companies). Home-market EU listings and indices need a paid Twelve Data plan.
|
||||
**Measured:** 2026-10-30 on `spike/p0` at `6e8694a` (`spikes/ProviderProbe`). Issue [#8](https://github.com/poli0981/OmniDeck/issues/8).
|
||||
|
||||
## Environment
|
||||
|
||||
- **Client:** `ProviderProbe`, a .NET 10 console app using `HttpClient`. Requests are plain, carry a descriptive `User-Agent`, are never retried and solve no challenges.
|
||||
- **Key:** read from the `OD_TWELVEDATA_KEY` environment variable and sent as `Authorization: apikey …`, never in a URL.
|
||||
- **Account:** a free Twelve Data account; `api_usage` reports `plan_category: basic`.
|
||||
- **Network:** a residential connection in Vietnam.
|
||||
|
||||
## Method
|
||||
|
||||
- **Stooq:** one GET each to the daily-history CSV endpoint and the quote CSV endpoint.
|
||||
- **Twelve Data:** 12 calls paced 10 s apart, recording `api-credits-used` / `api-credits-left` from each response:
|
||||
- a quote and a 3-symbol batch quote;
|
||||
- time series for the 1M, 6M and 1Y ranges (daily bars) and 5Y (weekly bars);
|
||||
- symbol search;
|
||||
- quotes for three home-market EU listings and for an index;
|
||||
- `api_usage`.
|
||||
- **Plan check:** one more `symbol_search` with `show_plan=true`.
|
||||
- **Model check:** `ProviderProbe verify-models` deserializes the saved responses with the models below.
|
||||
- **Raw responses:** kept locally under `%LocalAppData%\OmniDeck.Spikes\providers` and not committed, because the provider's terms cover redistribution of its data. Any free key reproduces them.
|
||||
|
||||
## Results
|
||||
|
||||
### Stooq: NO-GO
|
||||
|
||||
| Endpoint | Result |
|
||||
|---|---|
|
||||
| `/q/d/l/?s=aapl.us&i=d` (daily history CSV) | HTTP 200 `text/html`: a JavaScript proof-of-work page ("This site requires JavaScript to verify your browser"), no CSV |
|
||||
| `/q/l/?s=aapl.us&f=sd2t2ohlcv&h&e=csv` (quote CSV) | HTTP 404 "The page you requested does not exist or has been moved" |
|
||||
|
||||
Community reports add that since March 2026 downloads also need a per-user API key, obtained through a captcha ([pandas-datareader #1012](https://github.com/pydata/pandas-datareader/issues/1012)). OmniDeck does not solve bot challenges, so the app cannot use Stooq at all.
|
||||
|
||||
### Twelve Data, free (Basic) plan
|
||||
|
||||
| Call | Credits | Result |
|
||||
|---|---|---|
|
||||
| `quote?symbol=AAPL` | 1 | OK |
|
||||
| `quote?symbol=AAPL,MSFT,SPY` | 3 | OK: a JSON object keyed by symbol |
|
||||
| `time_series`, `1day` × 22 / 126 / 252 (1M / 6M / 1Y) | 1 each | OK |
|
||||
| `time_series`, `1week` × 261 (5Y, back to 2021-11-01) | 1 | OK |
|
||||
| `symbol_search?symbol=SAP` | 0 | OK: 30 listings |
|
||||
| `quote`: SAP on XETR, VOD on LSE, ASML on Euronext | 1 each | 404 "available starting with the Grow or Venture plan" |
|
||||
| `quote?symbol=SPX` (S&P 500 index) | 1 | 404 "available starting with the Pro or Venture plan" |
|
||||
| `api_usage` | 1 | OK: 8 credits per minute, 800 per day |
|
||||
|
||||
What this means for the client:
|
||||
|
||||
- **Credits:**
|
||||
- A quote costs 1 credit per symbol, so a batch of N costs N.
|
||||
- A time series costs 1 credit whatever its length.
|
||||
- Calls that fail still cost a credit.
|
||||
- `symbol_search` costs nothing.
|
||||
- **Limits:** the per-minute quota is restored at the start of each minute, and going over it returns 429 ([API credits](https://support.twelvedata.com/en/articles/5194820-api-credits-limits)). A client-side limiter allowing ≤ 8 credits per rolling 60 s therefore never trips it.
|
||||
- **Plan per listing:** `symbol_search` with `show_plan=true` returns `access: { global, plan }` for each listing. For SAP, the NYSE ADR needs Basic, XETR needs Grow and JSE needs Pro. The app can therefore show which listings a free key can use before spending a credit.
|
||||
- **No key:** a request without a key gets HTTP 401 with a JSON error body.
|
||||
- **Latency:** 280–630 ms per call.
|
||||
- **Budget example:** a watchlist of 20 US symbols refreshed every 15 minutes through a US trading day costs 26 × 20 = 520 credits. That leaves 280 for charts. Because of the per-minute limit, each refresh spreads over three minutes.
|
||||
|
||||
### Response models (frozen for P3)
|
||||
|
||||
Numbers arrive as JSON strings and names are snake_case, so one set of options covers every call. `verify-models` parses all saved responses with these records:
|
||||
|
||||
```csharp
|
||||
static readonly JsonSerializerOptions TwelveDataJson = new(JsonSerializerDefaults.Web)
|
||||
{
|
||||
PropertyNamingPolicy = JsonNamingPolicy.SnakeCaseLower,
|
||||
NumberHandling = JsonNumberHandling.AllowReadingFromString,
|
||||
};
|
||||
|
||||
// GET /quote. The batch form (symbol=A,B,C) returns Dictionary<string, TdQuote>.
|
||||
internal sealed record TdQuote(
|
||||
string Symbol, string Name, string Exchange, string MicCode, string Currency, string Datetime, long Timestamp,
|
||||
long? LastQuoteAt, decimal Open, decimal High, decimal Low, decimal Close, long? Volume, decimal PreviousClose,
|
||||
decimal Change, decimal PercentChange, bool IsMarketOpen, TdFiftyTwoWeek? FiftyTwoWeek);
|
||||
internal sealed record TdFiftyTwoWeek(decimal Low, decimal High, string Range);
|
||||
|
||||
// GET /time_series. Values are newest first; Datetime is a date for 1day/1week bars.
|
||||
internal sealed record TdTimeSeries(TdSeriesMeta Meta, IReadOnlyList<TdBar> Values, string Status);
|
||||
internal sealed record TdSeriesMeta(
|
||||
string Symbol, string Interval, string Currency, string ExchangeTimezone, string Exchange, string MicCode, string Type);
|
||||
internal sealed record TdBar(string Datetime, decimal Open, decimal High, decimal Low, decimal Close, long? Volume);
|
||||
|
||||
// GET /symbol_search?show_plan=true (free).
|
||||
internal sealed record TdSymbolSearch(IReadOnlyList<TdListing> Data, string Status);
|
||||
internal sealed record TdListing(
|
||||
string Symbol, string InstrumentName, string Exchange, string MicCode, string ExchangeTimezone,
|
||||
string InstrumentType, string Country, string Currency, TdAccess? Access);
|
||||
internal sealed record TdAccess(string Global, string Plan);
|
||||
|
||||
// GET /api_usage (1 credit), and any error (Code mirrors the HTTP status: 401, 404, 429).
|
||||
internal sealed record TdApiUsage(string Timestamp, int CurrentUsage, int PlanLimit, int DailyUsage, int PlanDailyLimit, string PlanCategory);
|
||||
internal sealed record TdError(int Code, string Message, string Status);
|
||||
```
|
||||
|
||||
### Alternative considered: Alpha Vantage
|
||||
|
||||
This was desk research only; no account was created.
|
||||
|
||||
- **Limits:** a free key allows 25 requests per day and 5 per minute ([Macroption](https://www.macroption.com/alpha-vantage-api-limits/)).
|
||||
- **Coverage:** the free key does reach home-market EU listings at end of day, such as `TSCO.LON` and `MBG.DEX` ([documentation](https://www.alphavantage.co/documentation/)).
|
||||
- **Limitations:**
|
||||
- a free key returns only the latest 100 daily bars (the "full" output is premium);
|
||||
- each quote call covers a single symbol.
|
||||
|
||||
That is too little to drive a watchlist, and a second key doubles the setup. It stays on the post-v1 list as a possible add-on for EU end-of-day data.
|
||||
|
||||
## Consequences
|
||||
|
||||
- **Provider:** Twelve Data only, with the user's own key on any plan. The key is still stored with DPAPI.
|
||||
- The stocks module now needs setup once. Its first screen explains how to get a free key and where to paste it.
|
||||
- Stocks with zero configuration is gone.
|
||||
- **Coverage:** with a free key, US stocks, ETFs and US-listed ADRs. EU companies are reachable through their US listings, and EU exposure through US-listed ETFs.
|
||||
- Grow unlocks home-market EU listings; Pro unlocks indices.
|
||||
- Search labels each listing with the plan it needs, compared with `api_usage.plan_category`.
|
||||
- The 404 plan error is shown as "not available on your Twelve Data plan", never as a failure.
|
||||
- **Rate limiting:**
|
||||
- ≤ 8 credits per rolling 60 s, plus a daily budget of 800 that counts failed calls;
|
||||
- watchlist refreshes use batch quotes;
|
||||
- daily and weekly bars are cached until the next trading day.
|
||||
- **Docs, at P0 exit:**
|
||||
- SPEC §3.5: providers and coverage;
|
||||
- SECURITY.md: the list of services the app calls;
|
||||
- ROADMAP: the P3 text and the risk register.
|
||||
- **Legal docs, only after the maintainer approves:**
|
||||
- PRIVACY.md: the network list;
|
||||
- THIRD-PARTY-NOTICES.md: the Stooq row;
|
||||
- the Stooq mentions in DISCLAIMER.md and EULA.md.
|
||||
- **Cut order unchanged:** Stocks is still the first thing to move to v1.1 if the schedule slips.
|
||||
|
||||
## Reproduce
|
||||
|
||||
On `spike/p0`, with `OD_TWELVEDATA_KEY` set to a free key:
|
||||
|
||||
```powershell
|
||||
dotnet run --project spikes/ProviderProbe -- stooq
|
||||
dotnet run --project spikes/ProviderProbe -- twelvedata
|
||||
dotnet run --project spikes/ProviderProbe -- verify-models
|
||||
```
|
||||
@@ -0,0 +1,52 @@
|
||||
# OmniDeck — P0 Spikes
|
||||
|
||||
P0 runs from 2 to 15 November 2026 ([ROADMAP](../ROADMAP.md#1-phases)). Its job is to de-risk everything that could invalidate the design before P1 builds on it. Each spike answers one question on real hardware and ends in a note in this folder with an explicit decision. P0 exits when all seven notes are merged. Progress is tracked in the [P0 milestone](https://github.com/poli0981/OmniDeck/milestone/1).
|
||||
|
||||
## 1. Rules
|
||||
|
||||
- **Spike code stays off `main`.** Proof-of-concept projects live on the `spike/p0` branch, which is pushed but never merged. The release SBOM is generated from `main`'s dependency graph ([`release.yml`](../../.github/workflows/release.yml)), and spike-only packages must not show up there, in Dependabot, or in dependency review. Each note names the commit it measured.
|
||||
- **Spike data stays out of the repository.** WebView2 profiles (cookies, sign-ins), logs and measurements live under `%LocalAppData%\OmniDeck.Spikes`. They never go in the working tree, and never in the app's data root `%LocalAppData%\OmniDeck.Data`.
|
||||
- **Secrets come from environment variables** (for example `OD_TWELVEDATA_KEY`). They are never committed, logged, or pasted into a note.
|
||||
- **No circumvention.** No user-agent spoofing to get past sign-in checks, and no solving of bot challenges. If a service blocks an embedded browser or a scripted client, that is the result to record.
|
||||
- **Sign-ins are done by hand** by the maintainer, in the spike app's window.
|
||||
- **Record the environment.** Every note states the Windows build, the WebView2 Runtime version, the package versions and the hardware. The development machine runs a Windows Insider build with 32 GB of RAM, which is not what most users have, so memory numbers are re-measured on a GA build of Windows 11 if they look off.
|
||||
|
||||
## 2. Status
|
||||
|
||||
| # | Spike | Blocks | Decision | Note |
|
||||
|---|---|---|---|---|
|
||||
| 1 | DRM / Widevine in WebView2 | P2: Spotify catalog entry | **GO:** the runtime ships Widevine and Spotify plays, with no flags | [01-drm-widevine.md](01-drm-widevine.md) |
|
||||
| 2 | Google sign-in and SSO popups | P2: `google` profile group, Spotify sign-in | **GO with conditions:** sign-ins work and persist; Google's ccTLD hop needs `navAllow` support; one unexplained session loss is watched in P2 | [02-google-sign-in.md](02-google-sign-in.md) |
|
||||
| 3 | Memory reality check and governor metric | **P1**: RAM governor ([§4](../RAM-GOVERNOR.md#4-cap-enforcement)) | **GO:** the metric is private commit; suspend trims, only hibernate frees memory | [03-memory.md](03-memory.md) |
|
||||
| 4 | CDP console capture | P2: bug-report flow | **GO:** always on, works with the DevTools UI disabled, not detected, no measurable cost | [04-cdp-console.md](04-cdp-console.md) |
|
||||
| 5 | Runtime preset swap | **P1**: theme engine | **GO with conditions:** `Od` styles for WPF-UI's static keys, motion driven from code, text size from the registry | [05-theme-swap.md](05-theme-swap.md) |
|
||||
| 6 | LibVLCSharp in WPF (airspace, fullscreen) | P2: media player | **GO with conditions:** overlay and fullscreen in place work; pop-out needs a vout restart + seek; about 39 MB compressed | [06-libvlcsharp.md](06-libvlcsharp.md) |
|
||||
| 7 | Stock data providers | P3: stocks | **GO with conditions:** Twelve Data with the user's key is the only provider; Stooq NO-GO | [07-providers.md](07-providers.md) |
|
||||
|
||||
The two spikes that block P1 (#3 and #5) go first. A spike that only blocks P2 or P3 may run on into the first weeks of P1, but its note still has to land before the phase it blocks starts.
|
||||
|
||||
## 3. Note template
|
||||
|
||||
Notes are named `NN-<slug>.md`. When a note is merged, its row in the table above links to it and records the decision, and the spike's issue is closed.
|
||||
|
||||
~~~markdown
|
||||
# Spike NN — <title>
|
||||
|
||||
**Question:** the one thing this spike decides.
|
||||
**Decision:** GO | GO with conditions | NO-GO, in one sentence.
|
||||
**Measured:** YYYY-MM-DD on `spike/p0` at `<commit>`.
|
||||
|
||||
## Environment
|
||||
Windows build, WebView2 Runtime, package versions, CPU / RAM / GPU.
|
||||
|
||||
## Method
|
||||
What was run and how, in enough detail to repeat it.
|
||||
|
||||
## Results
|
||||
Raw numbers (tables, or a CSV next to the note) and observations.
|
||||
|
||||
## Consequences
|
||||
What changes in the spec, architecture, governor, catalog or roadmap, and any follow-up issues.
|
||||
Changes to `docs/legal/**` and `catalog/webapps.json` are proposed here and made only after the
|
||||
maintainer approves them.
|
||||
~~~
|
||||
@@ -0,0 +1,93 @@
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Draws OmniDeck's application icon: the monogram "O" on a blue rounded square, as the tray icon
|
||||
draws it (src/OmniDeck.App/Shell/OdTrayIcon.cs), at the sizes Windows asks for.
|
||||
|
||||
.DESCRIPTION
|
||||
Writes src/OmniDeck.App/Assets/OmniDeck.ico, which the executable, its windows and Velopack's
|
||||
Setup use. It stands in until a designed icon exists: replacing that file is enough, and this
|
||||
script need not run again. WPF draws the images, so run it in an STA thread, as pwsh does.
|
||||
|
||||
.EXAMPLE
|
||||
pwsh scripts/make-icon.ps1
|
||||
#>
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
[string]$OutFile = (Join-Path $PSScriptRoot '..\src\OmniDeck.App\Assets\OmniDeck.ico')
|
||||
)
|
||||
|
||||
$ErrorActionPreference = 'Stop'
|
||||
Add-Type -AssemblyName PresentationCore, PresentationFramework, WindowsBase
|
||||
|
||||
# Windows' default accent, which the tray icon also falls back to.
|
||||
$background = [System.Windows.Media.SolidColorBrush]::new([System.Windows.Media.Color]::FromRgb(0x00, 0x67, 0xC0))
|
||||
$foreground = [System.Windows.Media.Brushes]::White
|
||||
$sizes = @(16, 20, 24, 32, 40, 48, 64, 256)
|
||||
|
||||
function New-IconImage([int]$Size) {
|
||||
$visual = [System.Windows.Media.DrawingVisual]::new()
|
||||
$context = $visual.RenderOpen()
|
||||
$corner = $Size / 8.0
|
||||
$context.DrawRoundedRectangle($background, $null, [System.Windows.Rect]::new(0, 0, $Size, $Size), $corner, $corner)
|
||||
|
||||
$typeface = [System.Windows.Media.Typeface]::new(
|
||||
[System.Windows.SystemFonts]::MessageFontFamily,
|
||||
[System.Windows.FontStyles]::Normal,
|
||||
[System.Windows.FontWeights]::Bold,
|
||||
[System.Windows.FontStretches]::Normal)
|
||||
$text = [System.Windows.Media.FormattedText]::new(
|
||||
'O',
|
||||
[Globalization.CultureInfo]::InvariantCulture,
|
||||
[System.Windows.FlowDirection]::LeftToRight,
|
||||
$typeface,
|
||||
$Size * 0.8,
|
||||
$foreground,
|
||||
1.0)
|
||||
$glyph = $text.BuildGeometry([System.Windows.Point]::new(0, 0))
|
||||
$bounds = $glyph.Bounds
|
||||
$context.PushTransform([System.Windows.Media.TranslateTransform]::new((($Size - $bounds.Width) / 2) - $bounds.X, (($Size - $bounds.Height) / 2) - $bounds.Y))
|
||||
$context.DrawGeometry($foreground, $null, $glyph)
|
||||
$context.Pop()
|
||||
$context.Close()
|
||||
|
||||
$bitmap = [System.Windows.Media.Imaging.RenderTargetBitmap]::new($Size, $Size, 96, 96, [System.Windows.Media.PixelFormats]::Pbgra32)
|
||||
$bitmap.Render($visual)
|
||||
$encoder = [System.Windows.Media.Imaging.PngBitmapEncoder]::new()
|
||||
$encoder.Frames.Add([System.Windows.Media.Imaging.BitmapFrame]::Create($bitmap))
|
||||
$png = [IO.MemoryStream]::new()
|
||||
$encoder.Save($png)
|
||||
return , $png.ToArray()
|
||||
}
|
||||
|
||||
$images = foreach ($size in $sizes) { , (New-IconImage $size) }
|
||||
|
||||
# ICO: the directory, one entry per image, then the images, PNG-compressed (Windows reads those).
|
||||
$ico = [IO.MemoryStream]::new()
|
||||
$writer = [IO.BinaryWriter]::new($ico)
|
||||
$writer.Write([uint16]0)
|
||||
$writer.Write([uint16]1)
|
||||
$writer.Write([uint16]$sizes.Count)
|
||||
$offset = 6 + (16 * $sizes.Count)
|
||||
for ($i = 0; $i -lt $sizes.Count; $i++) {
|
||||
# Width and height are one byte each: 0 means 256.
|
||||
$dimension = [byte]($sizes[$i] % 256)
|
||||
$writer.Write($dimension)
|
||||
$writer.Write($dimension)
|
||||
$writer.Write([byte]0)
|
||||
$writer.Write([byte]0)
|
||||
$writer.Write([uint16]1)
|
||||
$writer.Write([uint16]32)
|
||||
$writer.Write([uint32]$images[$i].Length)
|
||||
$writer.Write([uint32]$offset)
|
||||
$offset += $images[$i].Length
|
||||
}
|
||||
|
||||
foreach ($image in $images) {
|
||||
$writer.Write([byte[]]$image)
|
||||
}
|
||||
|
||||
$writer.Flush()
|
||||
$OutFile = [IO.Path]::GetFullPath($OutFile)
|
||||
New-Item -ItemType Directory -Force -Path (Split-Path $OutFile) | Out-Null
|
||||
[IO.File]::WriteAllBytes($OutFile, $ico.ToArray())
|
||||
Write-Host "Wrote $OutFile ($($sizes -join ', ') px)"
|
||||
+2
-1
@@ -94,7 +94,8 @@ try {
|
||||
--packAuthors poli0981 `
|
||||
--packVersion $Version `
|
||||
--packDir $publishDir `
|
||||
--mainExe OmniDeck.exe
|
||||
--mainExe OmniDeck.exe `
|
||||
--icon (Join-Path $repoRoot 'src\OmniDeck.App\Assets\OmniDeck.ico')
|
||||
if ($LASTEXITCODE -ne 0) { throw "vpk pack failed with exit code $LASTEXITCODE" }
|
||||
}
|
||||
finally {
|
||||
|
||||
@@ -8,8 +8,9 @@
|
||||
CI runs this script on every pull request. Checks (docs/WEBAPP-CATALOG.md §1–§2):
|
||||
- the file matches catalog/webapps.schema.json (types, required fields, formats, HTTPS);
|
||||
- app ids and names are unique;
|
||||
- the startUrl host and every popupAllow entry are covered by navAllow, matching whole DNS
|
||||
labels (google.com covers mail.google.com, never evilgoogle.com);
|
||||
- every navAllowSets name an app uses exists, and every set is used;
|
||||
- the startUrl host is covered by navAllow, and every popupAllow entry by navAllow or the app's
|
||||
sets, matching whole DNS labels (google.com covers mail.google.com, never evilgoogle.com);
|
||||
- updated is a real date and not in the future.
|
||||
Exits with code 1 and one line per problem when anything fails.
|
||||
|
||||
@@ -84,6 +85,16 @@ else {
|
||||
$problems.Add("updated: $updatedText is in the future")
|
||||
}
|
||||
|
||||
$sets = @{}
|
||||
$unusedSets = [System.Collections.Generic.HashSet[string]]::new([StringComparer]::Ordinal)
|
||||
$setsProperty = [System.Text.Json.JsonElement]::new()
|
||||
if ($root.TryGetProperty('navAllowSets', [ref] $setsProperty)) {
|
||||
foreach ($set in $setsProperty.EnumerateObject()) {
|
||||
$sets[$set.Name] = [string[]] @($set.Value.EnumerateArray() | ForEach-Object { $_.GetString() })
|
||||
[void] $unusedSets.Add($set.Name)
|
||||
}
|
||||
}
|
||||
|
||||
$ids = [System.Collections.Generic.HashSet[string]]::new([StringComparer]::Ordinal)
|
||||
$names = [System.Collections.Generic.HashSet[string]]::new([StringComparer]::OrdinalIgnoreCase)
|
||||
foreach ($app in $root.GetProperty('apps').EnumerateArray()) {
|
||||
@@ -98,12 +109,30 @@ else {
|
||||
if (-not (Test-DomainCover $startHost $navAllow)) {
|
||||
$problems.Add("apps[$id]: startUrl host '$startHost' is not covered by navAllow")
|
||||
}
|
||||
foreach ($popup in $app.GetProperty('popupAllow').EnumerateArray()) {
|
||||
$popupDomain = $popup.GetString()
|
||||
if (-not (Test-DomainCover $popupDomain $navAllow)) {
|
||||
$problems.Add("apps[$id]: popupAllow '$popupDomain' is not covered by navAllow")
|
||||
|
||||
$allowed = [System.Collections.Generic.List[string]]::new($navAllow)
|
||||
$appSets = [System.Text.Json.JsonElement]::new()
|
||||
if ($app.TryGetProperty('navAllowSets', [ref] $appSets)) {
|
||||
foreach ($setName in @($appSets.EnumerateArray() | ForEach-Object { $_.GetString() })) {
|
||||
if ($sets.ContainsKey($setName)) {
|
||||
$allowed.AddRange($sets[$setName])
|
||||
[void] $unusedSets.Remove($setName)
|
||||
}
|
||||
else {
|
||||
$problems.Add("apps[$id]: navAllowSets '$setName' is not defined")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($popup in $app.GetProperty('popupAllow').EnumerateArray()) {
|
||||
$popupDomain = $popup.GetString()
|
||||
if (-not (Test-DomainCover $popupDomain $allowed.ToArray())) {
|
||||
$problems.Add("apps[$id]: popupAllow '$popupDomain' is not covered by navAllow or its navAllowSets")
|
||||
}
|
||||
}
|
||||
}
|
||||
foreach ($unused in $unusedSets) {
|
||||
$problems.Add("navAllowSets[$unused]: no app uses this set")
|
||||
}
|
||||
}
|
||||
finally {
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 13 KiB |
@@ -0,0 +1,77 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Interop;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using OmniDeck.App.Diagnostics;
|
||||
using OmniDeck.App.Settings;
|
||||
using OmniDeck.App.Shell;
|
||||
using OmniDeck.App.Theming;
|
||||
using OmniDeck.App.Updates;
|
||||
using OmniDeck.Core.Localization;
|
||||
using OmniDeck.Core.Modules;
|
||||
using OmniDeck.Core.Reports;
|
||||
using OmniDeck.Core.Settings;
|
||||
using OmniDeck.Core.Storage;
|
||||
using OmniDeck.Web.Apps;
|
||||
using OmniDeck.Web.Catalog;
|
||||
using OmniDeck.Web.Diagnostics;
|
||||
using OmniDeck.Web.Runtime;
|
||||
using Serilog;
|
||||
using Wpf.Ui;
|
||||
|
||||
namespace OmniDeck.App.Composition;
|
||||
|
||||
/// <summary>Registers the WPF shell's services on top of <c>AddOmniDeckCore</c>.</summary>
|
||||
internal static class OdAppServiceCollectionExtensions
|
||||
{
|
||||
public static IServiceCollection AddOmniDeckApp(this IServiceCollection services)
|
||||
{
|
||||
// WPF-UI's dialog and snackbar services; the main window hands them their hosts.
|
||||
services.AddSingleton<IContentDialogService, ContentDialogService>();
|
||||
services.AddSingleton<ISnackbarService, SnackbarService>();
|
||||
services.AddSingleton<OdDialogs>();
|
||||
|
||||
services.AddSingleton<OdBugReportRequests>();
|
||||
services.AddSingleton<OdBugReports>();
|
||||
services.AddSingleton<OdBugReporter>();
|
||||
services.AddSingleton<OdBugReportFlow>();
|
||||
services.AddSingleton<OdMessageBoxErrorPresenter>();
|
||||
services.AddSingleton<IOdErrorPresenter, OdDialogErrorPresenter>();
|
||||
services.AddSingleton<OdCrashHandler>();
|
||||
services.AddSingleton<OdThemeEngine>();
|
||||
|
||||
services.AddSingleton<OdTrayNotifier>();
|
||||
services.AddSingleton<IOdNotifier>(provider => provider.GetRequiredService<OdTrayNotifier>());
|
||||
services.AddSingleton<IOdAppLifetime, OdAppLifetime>();
|
||||
services.AddSingleton<OdShellViewModel>();
|
||||
services.AddSingleton<OdMemoryViewModel>();
|
||||
services.AddSingleton<IOdUpdateService, OdVelopackUpdateService>();
|
||||
services.AddSingleton<OdUpdateWatcher>();
|
||||
services.AddSingleton<IOdStartupRegistration>(_ => new OdRunKeyStartup());
|
||||
services.AddSingleton(provider => new OdAboutViewModel(provider.GetRequiredService<IOdUpdateService>(), OdExternal.Open));
|
||||
services.AddSingleton(provider => new OdWebAppsViewModel(
|
||||
provider.GetRequiredService<OdCatalogService>(),
|
||||
provider.GetRequiredService<OdWebPreferences>(),
|
||||
provider.GetRequiredService<IOdSettingsService>(),
|
||||
provider.GetRequiredService<OdModuleHost>(),
|
||||
provider.GetRequiredService<OdSignInHealth>(),
|
||||
profile => provider.GetRequiredService<OdWebRuntime>().ClearProfileAsync(profile, MainWindowHandle()),
|
||||
apps => provider.GetRequiredService<OdDialogs>().ConfirmAsync(
|
||||
OdLocalization.Get("WebApps_ClearTitle"),
|
||||
OdLocalization.Format("WebApps_ClearMessage", apps),
|
||||
OdLocalization.Get("WebApps_ClearConfirm")),
|
||||
provider.GetRequiredService<ILogger>()));
|
||||
services.AddSingleton(provider => new OdSettingsViewModel(
|
||||
provider.GetRequiredService<IOdSettingsService>(),
|
||||
provider.GetRequiredService<IOdStartupRegistration>(),
|
||||
provider.GetRequiredService<OdDataRoot>(),
|
||||
provider.GetRequiredService<OdMemoryViewModel>(),
|
||||
provider.GetRequiredService<OdWebAppsViewModel>(),
|
||||
provider.GetRequiredService<OdAboutViewModel>(),
|
||||
OdExternal.OpenFolder));
|
||||
services.AddSingleton<OdMainWindow>();
|
||||
return services;
|
||||
}
|
||||
|
||||
// The hidden browser that clears a profile needs a window; Settings is in the main one.
|
||||
private static nint MainWindowHandle() => new WindowInteropHelper(Application.Current.MainWindow).Handle;
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
namespace OmniDeck.App.Diagnostics;
|
||||
|
||||
/// <summary>
|
||||
/// Shows the user that something failed: an in-window dialog once the main window is up
|
||||
/// (<see cref="OdDialogErrorPresenter"/>), a message box before that.
|
||||
/// </summary>
|
||||
internal interface IOdErrorPresenter
|
||||
{
|
||||
void Show(string message);
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
using System.ComponentModel;
|
||||
using System.IO;
|
||||
using OmniDeck.App.Settings;
|
||||
using OmniDeck.App.Shell;
|
||||
using OmniDeck.Core.Localization;
|
||||
using OmniDeck.Core.Modules;
|
||||
using OmniDeck.Core.Reports;
|
||||
using Serilog;
|
||||
using Wpf.Ui.Controls;
|
||||
|
||||
namespace OmniDeck.App.Diagnostics;
|
||||
|
||||
/// <summary>
|
||||
/// Reporting a bug (docs/legal/PRIVACY.md §3): the report is previewed in a dialog. On the user's
|
||||
/// say-so it is saved as a zip, File Explorer shows it, and the browser opens a new GitHub issue with
|
||||
/// the form's short fields filled in. Nothing is uploaded: the user attaches the zip.
|
||||
/// </summary>
|
||||
public sealed class OdBugReportFlow(OdDialogs dialogs, OdBugReporter reporter, OdBugReports reports, OdModuleHost host, ILogger log)
|
||||
{
|
||||
/// <summary>Where new issues are filed.</summary>
|
||||
public const string NewIssue = OdAboutViewModel.Repository + "/issues/new";
|
||||
|
||||
private readonly ILogger _log = log.ForContext<OdBugReportFlow>();
|
||||
|
||||
/// <summary>The new-issue page with the form's short fields filled in; the long ones are in the zip's issue.md.</summary>
|
||||
public static Uri IssueUrl(OdBugReport report)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(report);
|
||||
return new Uri(NewIssue
|
||||
+ "?template=bug_report.yml"
|
||||
+ "&version=" + Uri.EscapeDataString(report.Version)
|
||||
+ "&os=" + Uri.EscapeDataString(report.Windows)
|
||||
+ "&preset=" + Uri.EscapeDataString(report.Preset)
|
||||
+ "&module=" + Uri.EscapeDataString(report.Subject));
|
||||
}
|
||||
|
||||
/// <summary>Shows the dialog; <paramref name="error"/> is the error OmniDeck showed, when the report comes from it.</summary>
|
||||
public async Task ShowAsync(string? error)
|
||||
{
|
||||
if (!dialogs.CanShow)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var model = new OdBugReportViewModel(reporter, host.Current?.Info.Id ?? "", error);
|
||||
var answer = await dialogs.ShowAsync(new ContentDialog
|
||||
{
|
||||
Title = OdLocalization.Get("Report_Title"),
|
||||
Content = new OdBugReportView { DataContext = model },
|
||||
PrimaryButtonText = OdLocalization.Get("Report_Save"),
|
||||
CloseButtonText = OdLocalization.Get("Dialog_Cancel"),
|
||||
DefaultButton = ContentDialogButton.Primary,
|
||||
DialogMaxWidth = 760,
|
||||
});
|
||||
if (answer != ContentDialogResult.Primary)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var path = reports.Save(model.Report);
|
||||
_log.Information("Saved a bug report as {File}", Path.GetFileName(path));
|
||||
OdExternal.ShowFile(path);
|
||||
OdExternal.Open(IssueUrl(model.Report));
|
||||
}
|
||||
catch (Exception ex) when (ex is IOException or UnauthorizedAccessException or Win32Exception)
|
||||
{
|
||||
_log.Warning(ex, "The bug report could not be saved or shown");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
namespace OmniDeck.App.Diagnostics;
|
||||
|
||||
/// <summary>A bug report was asked for, about <see cref="Error"/> when it came from the error dialog.</summary>
|
||||
public sealed class OdBugReportRequestedEventArgs(string? error) : EventArgs
|
||||
{
|
||||
public string? Error { get; } = error;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
namespace OmniDeck.App.Diagnostics;
|
||||
|
||||
/// <summary>
|
||||
/// Where the error dialog asks for a bug report about the error it showed; the main window, which
|
||||
/// shows the report dialog, answers. It keeps the crash handler free of the report's many services.
|
||||
/// </summary>
|
||||
public sealed class OdBugReportRequests
|
||||
{
|
||||
public event EventHandler<OdBugReportRequestedEventArgs>? Requested;
|
||||
|
||||
public void Request(string? error) => Requested?.Invoke(this, new OdBugReportRequestedEventArgs(error));
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
<UserControl x:Class="OmniDeck.App.Diagnostics.OdBugReportView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:res="clr-namespace:OmniDeck.Core.Localization;assembly=OmniDeck.Core">
|
||||
<StackPanel>
|
||||
<TextBlock Margin="{DynamicResource Od.Margin.Item}"
|
||||
Text="{res:OdLoc Report_Intro}"
|
||||
TextWrapping="Wrap" />
|
||||
<TextBlock Margin="{DynamicResource Od.Padding.Control}" Text="{res:OdLoc Report_Subject}" />
|
||||
<ComboBox Margin="{DynamicResource Od.Margin.Item}"
|
||||
AutomationProperties.Name="{res:OdLoc Report_Subject}"
|
||||
ItemsSource="{Binding Subjects}"
|
||||
SelectedValue="{Binding Subject}"
|
||||
SelectedValuePath="Value" />
|
||||
<TextBlock Margin="{DynamicResource Od.Padding.Control}" Text="{res:OdLoc Report_Preview}" />
|
||||
<TextBox Height="280"
|
||||
AutomationProperties.Name="{res:OdLoc Report_Preview}"
|
||||
FontFamily="Consolas"
|
||||
HorizontalScrollBarVisibility="Auto"
|
||||
IsReadOnly="True"
|
||||
Text="{Binding Preview, Mode=OneWay}"
|
||||
TextWrapping="NoWrap"
|
||||
VerticalScrollBarVisibility="Auto" />
|
||||
</StackPanel>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,10 @@
|
||||
namespace OmniDeck.App.Diagnostics;
|
||||
|
||||
/// <summary>The bug-report dialog's content, bound to <see cref="OdBugReportViewModel"/>.</summary>
|
||||
public partial class OdBugReportView
|
||||
{
|
||||
public OdBugReportView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using OmniDeck.App.Settings;
|
||||
using OmniDeck.Core.Reports;
|
||||
|
||||
namespace OmniDeck.App.Diagnostics;
|
||||
|
||||
/// <summary>The bug-report dialog: what the report is about, and the issue text it will carry.</summary>
|
||||
public sealed partial class OdBugReportViewModel : ObservableObject
|
||||
{
|
||||
private readonly OdBugReporter _reporter;
|
||||
private readonly string? _error;
|
||||
|
||||
[ObservableProperty]
|
||||
private string _subject;
|
||||
|
||||
[ObservableProperty]
|
||||
private string _preview;
|
||||
|
||||
/// <summary>The dialog's model, about <paramref name="subject"/> to begin with.</summary>
|
||||
/// <param name="reporter">Composes the report.</param>
|
||||
/// <param name="subject">The module the report starts out about; empty for OmniDeck in general.</param>
|
||||
/// <param name="error">The error OmniDeck showed, when the report comes from the error dialog.</param>
|
||||
public OdBugReportViewModel(OdBugReporter reporter, string subject, string? error)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(reporter);
|
||||
_reporter = reporter;
|
||||
_error = error;
|
||||
Subjects = reporter.Subjects();
|
||||
_subject = Subjects.Any(choice => string.Equals(choice.Value, subject, StringComparison.Ordinal)) ? subject : "";
|
||||
Report = reporter.Compose(_subject, error);
|
||||
_preview = Report.Issue;
|
||||
}
|
||||
|
||||
public IReadOnlyList<OdChoice<string>> Subjects { get; }
|
||||
|
||||
/// <summary>The report as it stands, for the subject chosen.</summary>
|
||||
public OdBugReport Report { get; private set; }
|
||||
|
||||
partial void OnSubjectChanged(string value)
|
||||
{
|
||||
Report = _reporter.Compose(value, _error);
|
||||
Preview = Report.Issue;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,200 @@
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
using Microsoft.Win32;
|
||||
using OmniDeck.App.Settings;
|
||||
using OmniDeck.Core;
|
||||
using OmniDeck.Core.Governor;
|
||||
using OmniDeck.Core.Localization;
|
||||
using OmniDeck.Core.Modules;
|
||||
using OmniDeck.Core.Reports;
|
||||
using OmniDeck.Core.Settings;
|
||||
using OmniDeck.Core.Storage;
|
||||
using OmniDeck.Web.Apps;
|
||||
using OmniDeck.Web.Catalog;
|
||||
using OmniDeck.Web.Diagnostics;
|
||||
using OmniDeck.Web.Runtime;
|
||||
|
||||
namespace OmniDeck.App.Diagnostics;
|
||||
|
||||
/// <summary>
|
||||
/// Puts a bug report together (docs/legal/PRIVACY.md §3): OmniDeck's version, Windows' build, the UI
|
||||
/// preset, the modules and what they use, the end of the log and, for a web app, its console, each
|
||||
/// passed through <see cref="OdScrubber"/>. Used from the UI thread.
|
||||
/// </summary>
|
||||
public sealed class OdBugReporter(
|
||||
IOdSettingsService settings,
|
||||
OdModuleHost host,
|
||||
OdRamGovernor governor,
|
||||
OdDataRoot dataRoot,
|
||||
OdCatalog catalog,
|
||||
OdSignInHealth health,
|
||||
TimeProvider time)
|
||||
{
|
||||
/// <summary>How many log lines a report carries.</summary>
|
||||
public const int LogLines = 500;
|
||||
|
||||
private static readonly OdVersionInfo Version = OdVersionInfo.FromAssembly(typeof(OdBugReporter).Assembly);
|
||||
|
||||
/// <summary>What a report can be about: OmniDeck in general, then each module.</summary>
|
||||
public IReadOnlyList<OdChoice<string>> Subjects() =>
|
||||
[new("", OdLocalization.Get("Report_General")), .. host.Modules.Select(hosted => new OdChoice<string>(hosted.Info.Id, hosted.Info.Title))];
|
||||
|
||||
/// <summary>A report about the module <paramref name="subjectId"/> (empty: OmniDeck in general), with the error OmniDeck showed, if any.</summary>
|
||||
public OdBugReport Compose(string subjectId, string? error)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(subjectId);
|
||||
var hosted = subjectId.Length > 0 ? host.Find(subjectId) : null;
|
||||
var web = hosted?.Module as OdWebAppModule;
|
||||
var subject = hosted?.Info.Title ?? OdLocalization.Get("Report_General");
|
||||
var windows = WindowsVersion();
|
||||
var preset = settings.Current.Preset;
|
||||
var errors = web is null ? "" : OdConsoleLog.Write(web.Console.Errors);
|
||||
return new OdBugReport
|
||||
{
|
||||
Version = Version.DisplayText,
|
||||
Windows = windows,
|
||||
Preset = preset,
|
||||
Subject = subject,
|
||||
Issue = OdScrubber.Scrub(Issue(windows, preset, subject, errors, error)),
|
||||
SystemInfo = OdScrubber.Scrub(SystemInfo(windows, preset)),
|
||||
Logs = OdScrubber.Scrub(LogTail()),
|
||||
ConsoleLog = web is null ? null : OdScrubber.Scrub(OdConsoleLog.Write(web.Console.All)),
|
||||
ConsoleOf = web?.Info.Id,
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>Windows' version and build, as the bug form asks for them.</summary>
|
||||
internal static string WindowsVersion()
|
||||
{
|
||||
using var key = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows NT\CurrentVersion");
|
||||
var display = key?.GetValue("DisplayVersion") as string;
|
||||
var build = key?.GetValue("CurrentBuild") as string ?? Environment.OSVersion.Version.Build.ToString(CultureInfo.InvariantCulture);
|
||||
var revision = key?.GetValue("UBR") is int ubr ? "." + ubr.ToString(CultureInfo.InvariantCulture) : "";
|
||||
return string.IsNullOrEmpty(display) ? $"Windows 11 ({build}{revision})" : $"Windows 11 {display} ({build}{revision})";
|
||||
}
|
||||
|
||||
private string Issue(string windows, string preset, string subject, string consoleErrors, string? error)
|
||||
{
|
||||
var issue = new StringBuilder();
|
||||
Section(issue, "OmniDeck version", Version.DisplayText);
|
||||
Section(issue, "Windows version / build", windows);
|
||||
Section(issue, "UI preset", preset);
|
||||
Section(issue, "Affected module / web app", subject);
|
||||
Section(issue, "What happened, and what did you expect?", "_What you did, what happened, and what you expected instead._");
|
||||
Section(issue, "Console errors", consoleErrors.Length == 0 ? "_None captured._" : "```text\n" + consoleErrors + "\n```");
|
||||
if (error is not null)
|
||||
{
|
||||
Section(issue, "The error OmniDeck showed", "```text\n" + error + "\n```");
|
||||
}
|
||||
|
||||
var snapshot = governor.Snapshot;
|
||||
var now = time.GetUtcNow();
|
||||
var modules = new StringBuilder("| Module | State | Hidden for | Memory |\n|---|---|---|---|\n");
|
||||
foreach (var module in host.Modules.Where(module => module.State != OdModuleState.Created))
|
||||
{
|
||||
var hidden = module.State == OdModuleState.Active ? "" : ((int)(now - module.LastActive).TotalMinutes).ToString(CultureInfo.InvariantCulture) + " min";
|
||||
var memory = snapshot?.For(module.Info.Id) is { } bytes ? OdBytes.Format(bytes) : "";
|
||||
modules.Append(CultureInfo.InvariantCulture, $"| {module.Info.Title} | {module.State} | {hidden} | {memory} |\n");
|
||||
}
|
||||
|
||||
Section(issue, "Modules", modules.ToString().TrimEnd());
|
||||
return issue.ToString();
|
||||
}
|
||||
|
||||
private static void Section(StringBuilder issue, string heading, string body) =>
|
||||
issue.Append("### ").Append(heading).Append("\n\n").Append(body).Append("\n\n");
|
||||
|
||||
private string SystemInfo(string windows, string preset)
|
||||
{
|
||||
using var stream = new MemoryStream();
|
||||
using (var json = new Utf8JsonWriter(stream, new JsonWriterOptions { Indented = true }))
|
||||
{
|
||||
json.WriteStartObject();
|
||||
json.WriteString("version", Version.Version);
|
||||
json.WriteString("commit", Version.Commit);
|
||||
json.WriteString("windows", windows);
|
||||
json.WriteString("webView2", OdWebRuntime.InstalledVersion());
|
||||
json.WriteString("preset", preset);
|
||||
json.WriteString("language", CultureInfo.CurrentUICulture.Name);
|
||||
json.WriteString("catalog", catalog.Updated);
|
||||
WriteMemory(json);
|
||||
json.WriteStartArray("modules");
|
||||
var now = time.GetUtcNow();
|
||||
foreach (var module in host.Modules)
|
||||
{
|
||||
json.WriteStartObject();
|
||||
json.WriteString("id", module.Info.Id);
|
||||
json.WriteString("state", module.State.ToString());
|
||||
json.WriteNumber("hiddenMinutes", module.State is OdModuleState.Created or OdModuleState.Active ? 0 : (int)(now - module.LastActive).TotalMinutes);
|
||||
if (governor.Snapshot?.For(module.Info.Id) is { } bytes)
|
||||
{
|
||||
json.WriteNumber("memoryBytes", bytes);
|
||||
}
|
||||
|
||||
json.WriteEndObject();
|
||||
}
|
||||
|
||||
json.WriteEndArray();
|
||||
json.WriteStartObject("signInCookies");
|
||||
foreach (var profile in catalog.Apps.Select(app => app.Profile).Distinct(StringComparer.Ordinal))
|
||||
{
|
||||
if (health.Kept(profile) is { } count)
|
||||
{
|
||||
json.WriteNumber(profile, count);
|
||||
}
|
||||
}
|
||||
|
||||
json.WriteEndObject();
|
||||
json.WriteEndObject();
|
||||
}
|
||||
|
||||
return Encoding.UTF8.GetString(stream.ToArray());
|
||||
}
|
||||
|
||||
private void WriteMemory(Utf8JsonWriter json)
|
||||
{
|
||||
var options = governor.Options;
|
||||
json.WriteStartObject("memory");
|
||||
json.WriteNumber("committedBytes", governor.CommittedBytes);
|
||||
if (governor.Snapshot is { } snapshot)
|
||||
{
|
||||
json.WriteNumber("shellBytes", snapshot.ShellBytes);
|
||||
json.WriteNumber("sharedBytes", snapshot.SharedBytes);
|
||||
}
|
||||
|
||||
json.WriteNumber("softCapBytes", options.SoftCapBytes);
|
||||
json.WriteNumber("hardCapBytes", options.HardCapBytes);
|
||||
json.WriteEndObject();
|
||||
}
|
||||
|
||||
/// <summary>The last <see cref="LogLines"/> lines of the logs, newest file last.</summary>
|
||||
private string LogTail()
|
||||
{
|
||||
var lines = new List<string>();
|
||||
var files = Directory.Exists(dataRoot.LogsDirectory)
|
||||
? Directory.GetFiles(dataRoot.LogsDirectory, "omnideck-*.log").OrderByDescending(File.GetLastWriteTimeUtc).ToList()
|
||||
: [];
|
||||
foreach (var file in files.TakeWhile(_ => lines.Count < LogLines))
|
||||
{
|
||||
lines.InsertRange(0, ReadShared(file).TakeLast(LogLines - lines.Count));
|
||||
}
|
||||
|
||||
return string.Join("\n", lines);
|
||||
}
|
||||
|
||||
// The log is open for writing; read it without getting in the way.
|
||||
private static List<string> ReadShared(string path)
|
||||
{
|
||||
using var stream = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.ReadWrite | FileShare.Delete);
|
||||
using var reader = new StreamReader(stream);
|
||||
var lines = new List<string>();
|
||||
while (reader.ReadLine() is { } line)
|
||||
{
|
||||
lines.Add(line);
|
||||
}
|
||||
|
||||
return lines;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,148 @@
|
||||
using System.Globalization;
|
||||
using System.Windows;
|
||||
using OmniDeck.Core.Localization;
|
||||
using Serilog;
|
||||
|
||||
namespace OmniDeck.App.Diagnostics;
|
||||
|
||||
/// <summary>
|
||||
/// Global failure handling (docs/ARCHITECTURE.md §6): every unhandled exception is logged; one on the
|
||||
/// UI thread is shown with a support code that matches the log entry, and OmniDeck keeps running.
|
||||
/// A failure that repeats is reported once per <see cref="RepeatWindow"/> and only counted in between:
|
||||
/// a control stuck in a loop once threw the same exception thousands of times a second, and each one
|
||||
/// was logged in full and wanted a dialog of its own. The bug-report flow (P2) hangs off the same dialog.
|
||||
/// </summary>
|
||||
internal sealed class OdCrashHandler
|
||||
{
|
||||
/// <summary>How long a repeat of a reported failure is only counted.</summary>
|
||||
internal static readonly TimeSpan RepeatWindow = TimeSpan.FromMinutes(1);
|
||||
|
||||
private readonly ILogger _log;
|
||||
private readonly IOdErrorPresenter _presenter;
|
||||
private readonly TimeProvider _time;
|
||||
private readonly Lock _gate = new();
|
||||
private readonly Dictionary<uint, Reported> _reported = [];
|
||||
private int _showing;
|
||||
|
||||
public OdCrashHandler(ILogger log, IOdErrorPresenter presenter, TimeProvider time)
|
||||
{
|
||||
_log = log.ForContext<OdCrashHandler>();
|
||||
_presenter = presenter;
|
||||
_time = time;
|
||||
}
|
||||
|
||||
public void Hook(Application app)
|
||||
{
|
||||
app.DispatcherUnhandledException += (_, e) =>
|
||||
{
|
||||
HandleUiException(e.Exception);
|
||||
e.Handled = true;
|
||||
};
|
||||
AppDomain.CurrentDomain.UnhandledException += (_, e) => HandleFatal(e.ExceptionObject as Exception, e.IsTerminating);
|
||||
TaskScheduler.UnobservedTaskException += (_, e) =>
|
||||
{
|
||||
HandleUnobserved(e.Exception);
|
||||
e.SetObserved();
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>A short code the user can quote; it is logged next to the exception.</summary>
|
||||
internal static string SupportCode(Exception exception, DateTimeOffset when) =>
|
||||
string.Create(CultureInfo.InvariantCulture, $"{when:yyMMdd-HHmm}-{Fingerprint(exception) % 0x10000:X4}");
|
||||
|
||||
/// <summary>A UI-thread failure: logged, shown with its support code; the app keeps running.</summary>
|
||||
/// <returns>The support code.</returns>
|
||||
internal string HandleUiException(Exception exception)
|
||||
{
|
||||
var now = _time.GetLocalNow();
|
||||
var code = SupportCode(exception, now);
|
||||
if (!ShouldReport(exception, now, out var repeats))
|
||||
{
|
||||
return code;
|
||||
}
|
||||
|
||||
if (repeats > 0)
|
||||
{
|
||||
_log.Error(exception, "Unhandled UI exception, support code {SupportCode}; it repeated {Repeats} times since the last report", code, repeats);
|
||||
}
|
||||
else
|
||||
{
|
||||
_log.Error(exception, "Unhandled UI exception, support code {SupportCode}", code);
|
||||
}
|
||||
|
||||
// A failure inside the dialog itself must not stack dialogs.
|
||||
if (Interlocked.Exchange(ref _showing, 1) == 0)
|
||||
{
|
||||
try
|
||||
{
|
||||
_presenter.Show(OdLocalization.Format("Error_UiMessage", code, exception.Message));
|
||||
}
|
||||
finally
|
||||
{
|
||||
Volatile.Write(ref _showing, 0);
|
||||
}
|
||||
}
|
||||
|
||||
return code;
|
||||
}
|
||||
|
||||
internal void HandleFatal(Exception? exception, bool terminating)
|
||||
{
|
||||
_log.Fatal(exception, "Unhandled exception (terminating: {Terminating})", terminating);
|
||||
Log.CloseAndFlush();
|
||||
}
|
||||
|
||||
internal void HandleUnobserved(Exception exception)
|
||||
{
|
||||
if (!ShouldReport(exception, _time.GetLocalNow(), out var repeats))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (repeats > 0)
|
||||
{
|
||||
_log.Error(exception, "Unobserved task exception; it repeated {Repeats} times since the last report", repeats);
|
||||
}
|
||||
else
|
||||
{
|
||||
_log.Error(exception, "Unobserved task exception");
|
||||
}
|
||||
}
|
||||
|
||||
// FNV-1a over the exception type and message: stable for the same failure, cheap, and free of
|
||||
// anything personal.
|
||||
private static uint Fingerprint(Exception exception)
|
||||
{
|
||||
var hash = 2166136261u;
|
||||
foreach (var c in exception.GetType().FullName + exception.Message)
|
||||
{
|
||||
hash = (hash ^ c) * 16777619u;
|
||||
}
|
||||
|
||||
return hash;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Whether to report <paramref name="exception"/> now. A repeat within <see cref="RepeatWindow"/> of
|
||||
/// its last report is only counted; <paramref name="repeats"/> is the count since that report.
|
||||
/// </summary>
|
||||
private bool ShouldReport(Exception exception, DateTimeOffset now, out int repeats)
|
||||
{
|
||||
var fingerprint = Fingerprint(exception);
|
||||
lock (_gate)
|
||||
{
|
||||
if (_reported.TryGetValue(fingerprint, out var last) && now - last.At < RepeatWindow)
|
||||
{
|
||||
_reported[fingerprint] = last with { Repeats = last.Repeats + 1 };
|
||||
repeats = 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
repeats = last?.Repeats ?? 0;
|
||||
_reported[fingerprint] = new Reported(now, 0);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
private sealed record Reported(DateTimeOffset At, int Repeats);
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
using OmniDeck.App.Shell;
|
||||
using OmniDeck.Core.Localization;
|
||||
using Wpf.Ui.Controls;
|
||||
|
||||
namespace OmniDeck.App.Diagnostics;
|
||||
|
||||
/// <summary>Shows errors in an in-window dialog, or in a message box while no dialog can show.</summary>
|
||||
internal sealed class OdDialogErrorPresenter(OdDialogs dialogs, OdMessageBoxErrorPresenter fallback, OdBugReportRequests reports) : IOdErrorPresenter
|
||||
{
|
||||
public void Show(string message)
|
||||
{
|
||||
if (!dialogs.CanShow)
|
||||
{
|
||||
fallback.Show(message);
|
||||
return;
|
||||
}
|
||||
|
||||
_ = ShowAsync(message);
|
||||
}
|
||||
|
||||
private async Task ShowAsync(string message)
|
||||
{
|
||||
var answer = await dialogs.ShowAsync(new ContentDialog
|
||||
{
|
||||
Title = OdLocalization.Get("Error_Title"),
|
||||
Content = message,
|
||||
SecondaryButtonText = OdLocalization.Get("Error_Report"),
|
||||
CloseButtonText = OdLocalization.Get("Dialog_OK"),
|
||||
DefaultButton = ContentDialogButton.Close,
|
||||
});
|
||||
if (answer == ContentDialogResult.Secondary)
|
||||
{
|
||||
reports.Request(message);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
using OmniDeck.Core.Storage;
|
||||
using Serilog;
|
||||
using Serilog.Events;
|
||||
|
||||
namespace OmniDeck.App.Diagnostics;
|
||||
|
||||
/// <summary>
|
||||
/// Serilog to rolling files under the data root's <c>logs\</c> folder, kept for seven days
|
||||
/// (docs/SPEC.md §5). The age limit decides what goes: a count limit alone would let a burst of
|
||||
/// errors, which rolls a new file every 10 MB, push out the week before it. Nothing leaves the
|
||||
/// machine; bug reports attach a tail of these files only when the user asks for one.
|
||||
/// </summary>
|
||||
internal static class OdLogging
|
||||
{
|
||||
private const string Template = "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level:u3}] {SourceContext}: {Message:lj}{NewLine}{Exception}";
|
||||
|
||||
public static ILogger CreateLogger(OdDataRoot dataRoot) =>
|
||||
new LoggerConfiguration()
|
||||
#if DEBUG
|
||||
.MinimumLevel.Debug()
|
||||
#else
|
||||
.MinimumLevel.Information()
|
||||
#endif
|
||||
.MinimumLevel.Override("System", LogEventLevel.Warning)
|
||||
.WriteTo.File(
|
||||
System.IO.Path.Combine(dataRoot.LogsDirectory, "omnideck-.log"),
|
||||
rollingInterval: RollingInterval.Day,
|
||||
retainedFileCountLimit: 31,
|
||||
retainedFileTimeLimit: TimeSpan.FromDays(7),
|
||||
fileSizeLimitBytes: 10 * 1024 * 1024,
|
||||
rollOnFileSizeLimit: true,
|
||||
outputTemplate: Template,
|
||||
formatProvider: System.Globalization.CultureInfo.InvariantCulture)
|
||||
.CreateLogger();
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
using System.Windows;
|
||||
|
||||
namespace OmniDeck.App.Diagnostics;
|
||||
|
||||
/// <summary>The fallback presenter: a plain message box, which works before any window exists.</summary>
|
||||
internal sealed class OdMessageBoxErrorPresenter : IOdErrorPresenter
|
||||
{
|
||||
public void Show(string message) =>
|
||||
MessageBox.Show(message, "OmniDeck", MessageBoxButton.OK, MessageBoxImage.Warning);
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
namespace OmniDeck.App.Legal;
|
||||
|
||||
/// <summary>One legal document as the gate shows it: its title and its Markdown text.</summary>
|
||||
public sealed record OdLegalPage(string Title, string Markdown);
|
||||
@@ -0,0 +1,64 @@
|
||||
using System.IO;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using OmniDeck.Core.Legal;
|
||||
using OmniDeck.Core.Localization;
|
||||
|
||||
namespace OmniDeck.App.Legal;
|
||||
|
||||
/// <summary>
|
||||
/// The legal gate (docs/SPEC.md §2): the shipped documents, a "read them" check, and Continue or
|
||||
/// Quit. Continue records the acknowledgment; it is not a condition of the GPL. With
|
||||
/// <c>readOnly</c>, the same documents open from About, with nothing to acknowledge.
|
||||
/// </summary>
|
||||
public sealed partial class OdLegalViewModel : ObservableObject
|
||||
{
|
||||
private readonly OdLegalGate _gate;
|
||||
|
||||
[ObservableProperty]
|
||||
[NotifyCanExecuteChangedFor(nameof(ContinueCommand))]
|
||||
private bool _hasRead;
|
||||
|
||||
public OdLegalViewModel(OdLegalGate gate, string legalFolder, bool readOnly = false)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(gate);
|
||||
ArgumentNullException.ThrowIfNull(legalFolder);
|
||||
_gate = gate;
|
||||
IsReadOnly = readOnly;
|
||||
Pages = [.. OdLegal.Documents.Select(document => new OdLegalPage(OdLocalization.Get(document.TitleKey), Read(Path.Combine(legalFolder, document.FileName))))];
|
||||
}
|
||||
|
||||
/// <summary>Raised when the user continues or quits; <see cref="Accepted"/> says which.</summary>
|
||||
public event EventHandler? Finished;
|
||||
|
||||
public IReadOnlyList<OdLegalPage> Pages { get; }
|
||||
|
||||
public bool IsReadOnly { get; }
|
||||
|
||||
public bool AsksForAcknowledgment => !IsReadOnly;
|
||||
|
||||
/// <summary>"Quit" at the gate; "Close" when the documents were opened to read them again.</summary>
|
||||
public string QuitText => IsReadOnly ? OdLocalization.Get("Legal_Close") : OdLocalization.Get("Legal_Quit");
|
||||
|
||||
/// <summary>True after Continue, false after Quit, null while undecided.</summary>
|
||||
public bool? Accepted { get; private set; }
|
||||
|
||||
private static string Read(string path) =>
|
||||
File.Exists(path) ? File.ReadAllText(path) : OdLocalization.Format("Legal_Missing", Path.GetFileName(path));
|
||||
|
||||
[RelayCommand(CanExecute = nameof(HasRead))]
|
||||
private void Continue()
|
||||
{
|
||||
_gate.Acknowledge();
|
||||
Finish(accepted: true);
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
private void Quit() => Finish(accepted: false);
|
||||
|
||||
private void Finish(bool accepted)
|
||||
{
|
||||
Accepted = accepted;
|
||||
Finished?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
<ui:FluentWindow x:Class="OmniDeck.App.Legal.OdLegalWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:legal="clr-namespace:OmniDeck.App.Legal"
|
||||
xmlns:res="clr-namespace:OmniDeck.Core.Localization;assembly=OmniDeck.Core"
|
||||
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
|
||||
Title="{res:OdLoc Legal_Title}"
|
||||
Width="860"
|
||||
Height="680"
|
||||
MinWidth="560"
|
||||
MinHeight="420"
|
||||
ExtendsContentIntoTitleBar="True"
|
||||
WindowBackdropType="Mica"
|
||||
WindowStartupLocation="CenterScreen">
|
||||
<ui:FluentWindow.Resources>
|
||||
<legal:OdMarkdownConverter x:Key="Markdown" />
|
||||
<BooleanToVisibilityConverter x:Key="Visible" />
|
||||
</ui:FluentWindow.Resources>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<ui:TitleBar Title="{res:OdLoc Legal_Title}" Grid.Row="0" />
|
||||
<TextBlock Grid.Row="1"
|
||||
Margin="{DynamicResource Od.Padding.Card}"
|
||||
Text="{res:OdLoc Legal_Intro}"
|
||||
TextWrapping="Wrap" />
|
||||
<TabControl Grid.Row="2"
|
||||
Margin="{DynamicResource Od.Padding.Control}"
|
||||
ItemsSource="{Binding Pages}"
|
||||
SelectedIndex="0">
|
||||
<TabControl.ItemTemplate>
|
||||
<DataTemplate DataType="{x:Type legal:OdLegalPage}">
|
||||
<TextBlock Text="{Binding Title}" />
|
||||
</DataTemplate>
|
||||
</TabControl.ItemTemplate>
|
||||
<TabControl.ContentTemplate>
|
||||
<DataTemplate DataType="{x:Type legal:OdLegalPage}">
|
||||
<FlowDocumentScrollViewer Document="{Binding Markdown, Converter={StaticResource Markdown}}"
|
||||
IsToolBarVisible="False"
|
||||
VerticalScrollBarVisibility="Auto" />
|
||||
</DataTemplate>
|
||||
</TabControl.ContentTemplate>
|
||||
</TabControl>
|
||||
<DockPanel Grid.Row="3" Margin="{DynamicResource Od.Padding.Card}">
|
||||
<StackPanel DockPanel.Dock="Right" Orientation="Horizontal">
|
||||
<ui:Button Margin="{DynamicResource Od.Padding.Control}"
|
||||
Appearance="Primary"
|
||||
Command="{Binding ContinueCommand}"
|
||||
Content="{res:OdLoc Legal_Continue}"
|
||||
Visibility="{Binding AsksForAcknowledgment, Converter={StaticResource Visible}}" />
|
||||
<ui:Button Margin="{DynamicResource Od.Padding.Control}"
|
||||
Command="{Binding QuitCommand}"
|
||||
Content="{Binding QuitText}" />
|
||||
</StackPanel>
|
||||
<CheckBox VerticalAlignment="Center"
|
||||
Content="{res:OdLoc Legal_HaveRead}"
|
||||
IsChecked="{Binding HasRead}"
|
||||
Visibility="{Binding AsksForAcknowledgment, Converter={StaticResource Visible}}" />
|
||||
</DockPanel>
|
||||
</Grid>
|
||||
</ui:FluentWindow>
|
||||
@@ -0,0 +1,35 @@
|
||||
namespace OmniDeck.App.Legal;
|
||||
|
||||
/// <summary>
|
||||
/// Shows the legal documents: as the gate before the main window (first run, and after each legal
|
||||
/// update), or opened again from About to read them.
|
||||
/// </summary>
|
||||
public partial class OdLegalWindow
|
||||
{
|
||||
private bool _isGate;
|
||||
|
||||
public OdLegalWindow(OdLegalViewModel viewModel)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(viewModel);
|
||||
InitializeComponent();
|
||||
DataContext = viewModel;
|
||||
viewModel.Finished += (_, _) =>
|
||||
{
|
||||
if (_isGate)
|
||||
{
|
||||
DialogResult = viewModel.Accepted;
|
||||
}
|
||||
else
|
||||
{
|
||||
Close();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>Shows the gate and waits: true once the user continued; closing the window counts as Quit.</summary>
|
||||
public bool ShowGate()
|
||||
{
|
||||
_isGate = true;
|
||||
return ShowDialog() == true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
using System.Globalization;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using OmniDeck.App.Shell;
|
||||
|
||||
namespace OmniDeck.App.Legal;
|
||||
|
||||
/// <summary>Binds Markdown text to a <c>FlowDocumentScrollViewer</c>; links open in the default browser.</summary>
|
||||
[ValueConversion(typeof(string), typeof(FlowDocument))]
|
||||
public sealed class OdMarkdownConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture) =>
|
||||
OdMarkdownRenderer.Render(value as string ?? "", OdExternal.Open);
|
||||
|
||||
public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture) => Binding.DoNothing;
|
||||
}
|
||||
@@ -0,0 +1,241 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Media;
|
||||
using Markdig;
|
||||
using Markdig.Syntax;
|
||||
using Markdig.Syntax.Inlines;
|
||||
using OmniDeck.Core.Theming;
|
||||
using MdBlock = Markdig.Syntax.Block;
|
||||
using MdInline = Markdig.Syntax.Inlines.Inline;
|
||||
using MdTable = Markdig.Extensions.Tables.Table;
|
||||
using MdTableCell = Markdig.Extensions.Tables.TableCell;
|
||||
using MdTableRow = Markdig.Extensions.Tables.TableRow;
|
||||
using WpfBlock = System.Windows.Documents.Block;
|
||||
using WpfInline = System.Windows.Documents.Inline;
|
||||
using WpfTable = System.Windows.Documents.Table;
|
||||
|
||||
namespace OmniDeck.App.Legal;
|
||||
|
||||
/// <summary>
|
||||
/// Turns the legal documents' Markdown into a <see cref="FlowDocument"/>. It covers what docs/legal
|
||||
/// uses: headings, paragraphs, emphasis, inline code, links, lists, pipe tables, quotes, code blocks
|
||||
/// and rules. Text sizes follow the <c>Od.*</c> font tokens; links go to the caller, which opens them.
|
||||
/// </summary>
|
||||
internal static class OdMarkdownRenderer
|
||||
{
|
||||
private static readonly MarkdownPipeline Pipeline = new MarkdownPipelineBuilder().UsePipeTables().Build();
|
||||
private static readonly FontFamily Monospace = new("Cascadia Mono, Consolas, Courier New");
|
||||
|
||||
// Theme brushes rather than fixed colors, so lines follow light, dark and High Contrast.
|
||||
private const string DividerBrush = "DividerStrokeColorDefaultBrush";
|
||||
private const string QuoteBrush = "ControlStrongStrokeColorDefaultBrush";
|
||||
|
||||
public static FlowDocument Render(string markdown, Action<Uri> openLink)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(markdown);
|
||||
ArgumentNullException.ThrowIfNull(openLink);
|
||||
// A FlowDocument defaults to a serif reading font and justified text; the app's own font reads better here.
|
||||
var document = new FlowDocument
|
||||
{
|
||||
PagePadding = new Thickness(0),
|
||||
FontFamily = SystemFonts.MessageFontFamily,
|
||||
TextAlignment = TextAlignment.Left,
|
||||
};
|
||||
document.SetResourceReference(FlowDocument.FontSizeProperty, OdTokenKeys.FontBase);
|
||||
document.SetResourceReference(FlowDocument.ForegroundProperty, "TextFillColorPrimaryBrush");
|
||||
foreach (var block in Markdown.Parse(markdown, Pipeline))
|
||||
{
|
||||
if (RenderBlock(block, openLink) is { } rendered)
|
||||
{
|
||||
document.Blocks.Add(rendered);
|
||||
}
|
||||
}
|
||||
|
||||
return document;
|
||||
}
|
||||
|
||||
private static WpfBlock? RenderBlock(MdBlock block, Action<Uri> openLink) => block switch
|
||||
{
|
||||
HeadingBlock heading => Heading(heading, openLink),
|
||||
ParagraphBlock paragraph => Paragraph(paragraph.Inline, openLink),
|
||||
ListBlock list => List(list, openLink),
|
||||
MdTable table => Table(table, openLink),
|
||||
QuoteBlock quote => Quote(quote, openLink),
|
||||
CodeBlock code => Code(code),
|
||||
ThematicBreakBlock => Bordered(new Paragraph(), new Thickness(0, 0, 0, 1), DividerBrush),
|
||||
_ => null,
|
||||
};
|
||||
|
||||
private static Paragraph Heading(HeadingBlock heading, Action<Uri> openLink)
|
||||
{
|
||||
var paragraph = Paragraph(heading.Inline, openLink);
|
||||
paragraph.FontWeight = FontWeights.SemiBold;
|
||||
paragraph.Margin = new Thickness(0, heading.Level == 1 ? 0 : 12, 0, 4);
|
||||
paragraph.SetResourceReference(
|
||||
TextElement.FontSizeProperty,
|
||||
heading.Level switch
|
||||
{
|
||||
1 => OdTokenKeys.FontH1,
|
||||
2 => OdTokenKeys.FontH2,
|
||||
_ => OdTokenKeys.FontBase,
|
||||
});
|
||||
return paragraph;
|
||||
}
|
||||
|
||||
private static Paragraph Paragraph(ContainerInline? inlines, Action<Uri> openLink)
|
||||
{
|
||||
var paragraph = new Paragraph { Margin = new Thickness(0, 0, 0, 8) };
|
||||
AddInlines(paragraph.Inlines, inlines, openLink);
|
||||
return paragraph;
|
||||
}
|
||||
|
||||
private static List List(ListBlock list, Action<Uri> openLink)
|
||||
{
|
||||
var rendered = new List
|
||||
{
|
||||
MarkerStyle = list.IsOrdered ? TextMarkerStyle.Decimal : TextMarkerStyle.Disc,
|
||||
Margin = new Thickness(0, 0, 0, 8),
|
||||
};
|
||||
foreach (var item in list.OfType<ListItemBlock>())
|
||||
{
|
||||
var listItem = new ListItem();
|
||||
foreach (var child in item)
|
||||
{
|
||||
if (RenderBlock(child, openLink) is { } block)
|
||||
{
|
||||
block.Margin = new Thickness(0);
|
||||
listItem.Blocks.Add(block);
|
||||
}
|
||||
}
|
||||
|
||||
rendered.ListItems.Add(listItem);
|
||||
}
|
||||
|
||||
return rendered;
|
||||
}
|
||||
|
||||
private static WpfTable Table(MdTable table, Action<Uri> openLink)
|
||||
{
|
||||
var rendered = new WpfTable { CellSpacing = 0, Margin = new Thickness(0, 0, 0, 8) };
|
||||
var rows = new TableRowGroup();
|
||||
foreach (var row in table.OfType<MdTableRow>())
|
||||
{
|
||||
var renderedRow = new TableRow();
|
||||
foreach (var cell in row.OfType<MdTableCell>())
|
||||
{
|
||||
var renderedCell = new TableCell { BorderThickness = new Thickness(0, 0, 0, 1), Padding = new Thickness(4, 2, 8, 2) };
|
||||
renderedCell.SetResourceReference(TableCell.BorderBrushProperty, DividerBrush);
|
||||
foreach (var block in cell)
|
||||
{
|
||||
if (RenderBlock(block, openLink) is { } content)
|
||||
{
|
||||
content.Margin = new Thickness(0);
|
||||
renderedCell.Blocks.Add(content);
|
||||
}
|
||||
}
|
||||
|
||||
if (row.IsHeader)
|
||||
{
|
||||
renderedCell.FontWeight = FontWeights.SemiBold;
|
||||
}
|
||||
|
||||
renderedRow.Cells.Add(renderedCell);
|
||||
}
|
||||
|
||||
rows.Rows.Add(renderedRow);
|
||||
}
|
||||
|
||||
rendered.RowGroups.Add(rows);
|
||||
return rendered;
|
||||
}
|
||||
|
||||
private static T Bordered<T>(T block, Thickness thickness, string brushKey)
|
||||
where T : WpfBlock
|
||||
{
|
||||
block.BorderThickness = thickness;
|
||||
block.SetResourceReference(WpfBlock.BorderBrushProperty, brushKey);
|
||||
return block;
|
||||
}
|
||||
|
||||
private static Section Quote(QuoteBlock quote, Action<Uri> openLink)
|
||||
{
|
||||
var section = Bordered(new Section { Padding = new Thickness(8, 0, 0, 0) }, new Thickness(3, 0, 0, 0), QuoteBrush);
|
||||
foreach (var child in quote)
|
||||
{
|
||||
if (RenderBlock(child, openLink) is { } block)
|
||||
{
|
||||
section.Blocks.Add(block);
|
||||
}
|
||||
}
|
||||
|
||||
return section;
|
||||
}
|
||||
|
||||
private static Paragraph Code(CodeBlock code) =>
|
||||
new(new Run(code.Lines.ToString())) { FontFamily = Monospace, Margin = new Thickness(0, 0, 0, 8) };
|
||||
|
||||
private static void AddInlines(InlineCollection target, ContainerInline? container, Action<Uri> openLink)
|
||||
{
|
||||
for (var inline = container?.FirstChild; inline is not null; inline = inline.NextSibling)
|
||||
{
|
||||
if (RenderInline(inline, openLink) is { } rendered)
|
||||
{
|
||||
target.Add(rendered);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static WpfInline? RenderInline(MdInline inline, Action<Uri> openLink)
|
||||
{
|
||||
switch (inline)
|
||||
{
|
||||
case LiteralInline literal:
|
||||
return new Run(literal.Content.ToString());
|
||||
case CodeInline code:
|
||||
return new Run(code.Content) { FontFamily = Monospace };
|
||||
case LineBreakInline lineBreak:
|
||||
return lineBreak.IsHard ? new LineBreak() : new Run(" ");
|
||||
case LinkInline { IsImage: false } link:
|
||||
return Link(link.Url, link, openLink);
|
||||
case AutolinkInline autolink:
|
||||
return Link(autolink.Url, null, openLink, autolink.Url);
|
||||
case EmphasisInline emphasis:
|
||||
Span span = emphasis.DelimiterCount >= 2 ? new Bold() : new Italic();
|
||||
AddInlines(span.Inlines, emphasis, openLink);
|
||||
return span;
|
||||
case ContainerInline container:
|
||||
var group = new Span();
|
||||
AddInlines(group.Inlines, container, openLink);
|
||||
return group;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private static WpfInline Link(string? url, ContainerInline? content, Action<Uri> openLink, string? text = null)
|
||||
{
|
||||
var span = new Span();
|
||||
if (content is not null)
|
||||
{
|
||||
AddInlines(span.Inlines, content, openLink);
|
||||
}
|
||||
else
|
||||
{
|
||||
span.Inlines.Add(new Run(text ?? url ?? ""));
|
||||
}
|
||||
|
||||
// Only absolute web and mail links open; relative links point into the source repository.
|
||||
if (!Uri.TryCreate(url, UriKind.Absolute, out var uri) || uri.Scheme is not ("https" or "http" or "mailto"))
|
||||
{
|
||||
return span;
|
||||
}
|
||||
|
||||
var hyperlink = new Hyperlink(span) { NavigateUri = uri };
|
||||
hyperlink.RequestNavigate += (_, e) =>
|
||||
{
|
||||
openLink(e.Uri);
|
||||
e.Handled = true;
|
||||
};
|
||||
return hyperlink;
|
||||
}
|
||||
}
|
||||
@@ -1,14 +1,14 @@
|
||||
<Application x:Class="OmniDeck.App.OdApp"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
|
||||
StartupUri="OdMainWindow.xaml">
|
||||
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml">
|
||||
<Application.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<!-- WPF-UI dictionaries first; the Od.* preset layer goes on top in P1 (docs/UI-MODES.md). -->
|
||||
<!-- WPF-UI dictionaries first, then our implicit styles; OdThemeEngine adds the Od.* preset layer last (docs/UI-MODES.md). -->
|
||||
<ui:ThemesDictionary Theme="Dark" />
|
||||
<ui:ControlsDictionary />
|
||||
<ResourceDictionary Source="Theming/OdStyles.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
</Application.Resources>
|
||||
|
||||
@@ -0,0 +1,160 @@
|
||||
using System.IO;
|
||||
using System.Windows;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using OmniDeck.App.Composition;
|
||||
using OmniDeck.App.Diagnostics;
|
||||
using OmniDeck.App.Legal;
|
||||
using OmniDeck.App.Resources;
|
||||
using OmniDeck.App.Settings;
|
||||
using OmniDeck.App.Shell;
|
||||
using OmniDeck.App.Theming;
|
||||
using OmniDeck.App.Updates;
|
||||
using OmniDeck.Core;
|
||||
using OmniDeck.Core.Governor;
|
||||
using OmniDeck.Core.Legal;
|
||||
using OmniDeck.Core.Localization;
|
||||
using OmniDeck.Core.Runtime;
|
||||
using OmniDeck.Core.Settings;
|
||||
using OmniDeck.Core.Storage;
|
||||
using OmniDeck.Modules;
|
||||
using OmniDeck.Modules.Calendar;
|
||||
using OmniDeck.Modules.Resources;
|
||||
using OmniDeck.Web;
|
||||
using OmniDeck.Web.Catalog;
|
||||
using OmniDeck.Web.Resources;
|
||||
using OmniDeck.Web.Runtime;
|
||||
using Serilog;
|
||||
|
||||
namespace OmniDeck.App;
|
||||
|
||||
/// <summary>
|
||||
/// The WPF application: builds the data root, the logger and the service container, hooks crash
|
||||
/// handling, then shows the main window. Shutdown is explicit because the tray keeps OmniDeck
|
||||
/// running after its window closes.
|
||||
/// </summary>
|
||||
public partial class OdApp
|
||||
{
|
||||
private readonly OdSingleInstanceGuard _guard;
|
||||
private readonly OdDataRoot _dataRoot;
|
||||
private ServiceProvider? _services;
|
||||
|
||||
internal OdApp(OdSingleInstanceGuard guard, OdDataRoot dataRoot)
|
||||
{
|
||||
_guard = guard;
|
||||
_dataRoot = dataRoot;
|
||||
}
|
||||
|
||||
/// <summary>The legal documents that ship next to the executable.</summary>
|
||||
public static string LegalFolder => Path.Combine(AppContext.BaseDirectory, "legal");
|
||||
|
||||
protected override void OnStartup(StartupEventArgs e)
|
||||
{
|
||||
base.OnStartup(e);
|
||||
ShutdownMode = ShutdownMode.OnExplicitShutdown;
|
||||
OdLocalization.Instance.Register(OdAppStrings.Resources);
|
||||
OdLocalization.Instance.Register(OdModuleStrings.Resources);
|
||||
OdLocalization.Instance.Register(OdWebStrings.Resources);
|
||||
try
|
||||
{
|
||||
Start(e.Args);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.ForContext<OdApp>().Fatal(ex, "OmniDeck could not start");
|
||||
MessageBox.Show(OdLocalization.Format("Error_StartFailed", ex.Message), OdLocalization.Get("App_Name"), MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
Shutdown(1);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnExit(ExitEventArgs e)
|
||||
{
|
||||
Log.ForContext<OdApp>().Information("OmniDeck exiting with code {ExitCode}", e.ApplicationExitCode);
|
||||
_services?.Dispose();
|
||||
OdDatabase.ReleaseAll();
|
||||
Log.CloseAndFlush();
|
||||
base.OnExit(e);
|
||||
}
|
||||
|
||||
private void Start(string[] args)
|
||||
{
|
||||
var startMinimized = args.Contains(OdRunKeyStartup.MinimizedArgument, StringComparer.OrdinalIgnoreCase);
|
||||
var dataRoot = _dataRoot;
|
||||
dataRoot.EnsureCreated();
|
||||
Log.Logger = OdLogging.CreateLogger(dataRoot);
|
||||
Log.ForContext<OdApp>().Information("OmniDeck {Version} starting", OdVersionInfo.FromAssembly(typeof(OdApp).Assembly).DisplayText);
|
||||
if (!dataRoot.IsDefault)
|
||||
{
|
||||
Log.ForContext<OdApp>().Warning("Development data root in use: {DataRoot}", dataRoot.Root);
|
||||
}
|
||||
|
||||
// The catalog decides which web-app modules exist, so it loads before the container is built.
|
||||
var catalog = OdCatalogService.LoadInstalled(dataRoot, TimeProvider.System, Log.Logger);
|
||||
var webOptions = new OdWebOptions(ChromiumLogging: args.Contains(OdWebOptions.LoggingSwitch, StringComparer.OrdinalIgnoreCase));
|
||||
_services = new ServiceCollection()
|
||||
.AddOmniDeckCore(dataRoot, Log.Logger)
|
||||
.AddOmniDeckModules()
|
||||
.AddOmniDeckWeb(catalog, webOptions)
|
||||
.AddOmniDeckApp()
|
||||
.BuildServiceProvider(new ServiceProviderOptions { ValidateOnBuild = true, ValidateScopes = true });
|
||||
_services.GetRequiredService<OdCrashHandler>().Hook(this);
|
||||
var applied = _services.GetRequiredService<OdDatabase>().Migrate(OdCoreMigrations.All);
|
||||
Log.ForContext<OdApp>().Information("Database ready ({Applied} migrations applied)", applied);
|
||||
|
||||
var settings = _services.GetRequiredService<IOdSettingsService>();
|
||||
OdLocalization.Instance.SetCulture(OdLocalization.Instance.ResolveCulture(settings.Current.Language));
|
||||
OdLocalization.Instance.TrackWindowLanguage();
|
||||
settings.Changed += (_, e) => Dispatcher.Invoke(() => OdLocalization.Instance.SetCulture(OdLocalization.Instance.ResolveCulture(e.Settings.Language)));
|
||||
|
||||
_services.GetRequiredService<OdThemeEngine>().Start(this);
|
||||
|
||||
// The legal gate comes first, on the first run and after each legal update; Quit ends here.
|
||||
var legal = _services.GetRequiredService<OdLegalGate>();
|
||||
if (!legal.IsAcknowledged && !new OdLegalWindow(new OdLegalViewModel(legal, LegalFolder)).ShowGate())
|
||||
{
|
||||
Log.ForContext<OdApp>().Information("Legal documents not acknowledged; quitting");
|
||||
Shutdown(0);
|
||||
return;
|
||||
}
|
||||
|
||||
var meta = _services.GetRequiredService<IOdAppMeta>();
|
||||
if (OdOnboardingViewModel.IsNeeded(meta))
|
||||
{
|
||||
new OdOnboardingWindow(new OdOnboardingViewModel(settings, meta)).ShowDialog();
|
||||
}
|
||||
|
||||
// Only now may a second launch bring the window up: never past the gate.
|
||||
_guard.StartListening(() => _ = Dispatcher.InvokeAsync(() => MainShell().Present()));
|
||||
var window = MainShell();
|
||||
if (!startMinimized)
|
||||
{
|
||||
window.Present();
|
||||
}
|
||||
|
||||
_services.GetRequiredService<OdRamGovernor>().Start();
|
||||
_services.GetRequiredService<OdUpdateWatcher>().Start();
|
||||
_services.GetRequiredService<OdReminderService>().Start();
|
||||
_services.GetRequiredService<OdCatalogService>().Start();
|
||||
}
|
||||
|
||||
/// <summary>The main window, created once. It owns the tray icon, so it exists even while hidden.</summary>
|
||||
private OdMainWindow MainShell()
|
||||
{
|
||||
if (MainWindow is not OdMainWindow window)
|
||||
{
|
||||
window = _services!.GetRequiredService<OdMainWindow>();
|
||||
MainWindow = window;
|
||||
|
||||
// A real close (tray off, or Quit) ends the app; otherwise closing only hides the window.
|
||||
var lifetime = _services!.GetRequiredService<IOdAppLifetime>();
|
||||
window.Closed += (_, _) =>
|
||||
{
|
||||
if (!lifetime.IsQuitting)
|
||||
{
|
||||
_ = lifetime.QuitAsync();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
return window;
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,17 @@
|
||||
<ui:FluentWindow x:Class="OmniDeck.App.OdMainWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:res="clr-namespace:OmniDeck.Core.Localization;assembly=OmniDeck.Core"
|
||||
xmlns:tb="clr-namespace:H.NotifyIcon;assembly=H.NotifyIcon.Wpf"
|
||||
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
|
||||
Title="OmniDeck"
|
||||
Width="960"
|
||||
Height="600"
|
||||
Title="{res:OdLoc App_Name}"
|
||||
Width="1100"
|
||||
Height="720"
|
||||
MinWidth="640"
|
||||
MinHeight="420"
|
||||
Closing="OnClosing"
|
||||
ExtendsContentIntoTitleBar="True"
|
||||
PreviewKeyDown="OnPreviewKeyDown"
|
||||
WindowBackdropType="Mica"
|
||||
WindowStartupLocation="CenterScreen">
|
||||
<Grid>
|
||||
@@ -13,18 +19,86 @@
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<ui:TitleBar Title="OmniDeck" Grid.Row="0" />
|
||||
<!-- Kickoff placeholder: the real shell (navigation, module host) arrives in P1. -->
|
||||
<StackPanel Grid.Row="1"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center">
|
||||
<ui:TextBlock HorizontalAlignment="Center"
|
||||
FontTypography="Title"
|
||||
Text="OmniDeck" />
|
||||
<ui:TextBlock x:Name="VersionText"
|
||||
Margin="0,8,0,0"
|
||||
HorizontalAlignment="Center"
|
||||
Appearance="Secondary" />
|
||||
</StackPanel>
|
||||
|
||||
<ui:TitleBar x:Name="AppTitleBar"
|
||||
Title="{res:OdLoc App_Name}"
|
||||
Grid.Row="0">
|
||||
<!-- Looks like a search box; opens the command palette, as Ctrl+K does. -->
|
||||
<ui:TitleBar.CenterContent>
|
||||
<ui:Button Width="360"
|
||||
Margin="16,0,0,0"
|
||||
HorizontalContentAlignment="Left"
|
||||
AutomationProperties.Name="{res:OdLoc Shell_Search}"
|
||||
Click="OnSearchClick"
|
||||
ToolTip="Ctrl+K">
|
||||
<DockPanel>
|
||||
<ui:SymbolIcon Margin="0,0,8,0"
|
||||
DockPanel.Dock="Left"
|
||||
Symbol="Search24" />
|
||||
<TextBlock VerticalAlignment="Center"
|
||||
Foreground="{DynamicResource TextFillColorSecondaryBrush}"
|
||||
Text="{res:OdLoc Shell_Search}"
|
||||
TextTrimming="CharacterEllipsis" />
|
||||
</DockPanel>
|
||||
</ui:Button>
|
||||
</ui:TitleBar.CenterContent>
|
||||
</ui:TitleBar>
|
||||
|
||||
<!-- Chrome only: items are built in code from OdShellViewModel.Sidebar and every navigation goes through it. -->
|
||||
<ui:NavigationView x:Name="RootNavigation"
|
||||
Grid.Row="1"
|
||||
FrameMargin="0"
|
||||
IsBackButtonVisible="Collapsed"
|
||||
IsPaneToggleVisible="True"
|
||||
OpenPaneLength="240"
|
||||
PaneDisplayMode="Left"
|
||||
TitleBar="{Binding ElementName=AppTitleBar, Mode=OneWay}">
|
||||
<ui:NavigationView.ContentOverlay>
|
||||
<Grid>
|
||||
<ui:SnackbarPresenter x:Name="RootSnackbar" VerticalAlignment="Bottom" />
|
||||
</Grid>
|
||||
</ui:NavigationView.ContentOverlay>
|
||||
</ui:NavigationView>
|
||||
|
||||
<!-- In-window dialogs cover the whole window, title bar included. -->
|
||||
<ui:ContentDialogHost x:Name="RootDialogHost"
|
||||
Grid.Row="0"
|
||||
Grid.RowSpan="2" />
|
||||
|
||||
<!--
|
||||
The tray icon lives as long as this window, which closing only hides (docs/SPEC.md §2).
|
||||
Its image is drawn in code (OdTrayIcon), never with GeneratedIconSource.
|
||||
-->
|
||||
<tb:TaskbarIcon x:Name="TrayIcon"
|
||||
Grid.Row="0"
|
||||
NoLeftClickDelay="True"
|
||||
ToolTipText="{res:OdLoc App_Name}"
|
||||
TrayBalloonTipClicked="OnTrayNotificationClicked"
|
||||
TrayLeftMouseUp="OnTrayOpen">
|
||||
<tb:TaskbarIcon.ContextMenu>
|
||||
<ContextMenu Opened="OnTrayMenuOpened">
|
||||
<MenuItem Click="OnTrayOpen" Header="{res:OdLoc Tray_Open}" />
|
||||
<MenuItem Click="OnTrayQuickTimer" Header="{res:OdLoc Tray_QuickTimer}" />
|
||||
<!-- Shown while a media module has something loaded (docs/SPEC.md §2). -->
|
||||
<Separator x:Name="TrayMediaSeparator" Visibility="Collapsed" />
|
||||
<MenuItem x:Name="TrayNowPlaying"
|
||||
IsEnabled="False"
|
||||
Visibility="Collapsed" />
|
||||
<MenuItem x:Name="TrayPlayPause"
|
||||
Click="OnTrayPlayPause"
|
||||
Visibility="Collapsed" />
|
||||
<MenuItem x:Name="TrayNext"
|
||||
Click="OnTrayNext"
|
||||
Header="{res:OdLoc Tray_Next}"
|
||||
Visibility="Collapsed" />
|
||||
<MenuItem x:Name="TrayPrevious"
|
||||
Click="OnTrayPrevious"
|
||||
Header="{res:OdLoc Tray_Previous}"
|
||||
Visibility="Collapsed" />
|
||||
<Separator />
|
||||
<MenuItem Click="OnTrayQuit" Header="{res:OdLoc Tray_Quit}" />
|
||||
</ContextMenu>
|
||||
</tb:TaskbarIcon.ContextMenu>
|
||||
</tb:TaskbarIcon>
|
||||
</Grid>
|
||||
</ui:FluentWindow>
|
||||
@@ -1,13 +1,568 @@
|
||||
using OmniDeck.Core;
|
||||
using System.ComponentModel;
|
||||
using System.Windows;
|
||||
using System.Windows.Automation;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Interop;
|
||||
using System.Windows.Media;
|
||||
using H.NotifyIcon.Core;
|
||||
using OmniDeck.App.Diagnostics;
|
||||
using OmniDeck.App.Legal;
|
||||
using OmniDeck.App.Settings;
|
||||
using OmniDeck.App.Shell;
|
||||
using OmniDeck.App.Theming;
|
||||
using OmniDeck.Core.Legal;
|
||||
using OmniDeck.Core.Localization;
|
||||
using OmniDeck.Core.Modules;
|
||||
using OmniDeck.Core.Runtime;
|
||||
using OmniDeck.Core.Settings;
|
||||
using OmniDeck.Core.Storage;
|
||||
using OmniDeck.Core.Theming;
|
||||
using OmniDeck.Modules.Timer;
|
||||
using Wpf.Ui;
|
||||
using Wpf.Ui.Abstractions;
|
||||
using Wpf.Ui.Controls;
|
||||
using MenuItem = System.Windows.Controls.MenuItem;
|
||||
|
||||
namespace OmniDeck.App;
|
||||
|
||||
/// <summary>Placeholder shell window of the kickoff build; the real shell arrives in P1.</summary>
|
||||
public partial class OdMainWindow
|
||||
/// <summary>
|
||||
/// The shell window: the title bar with the palette button, the navigation view as sidebar chrome,
|
||||
/// the module stage, in-window dialogs and snackbars, and the tray icon. Closing hides it into the
|
||||
/// tray unless the user turned that off or is quitting.
|
||||
/// </summary>
|
||||
public partial class OdMainWindow : INavigationViewPageProvider
|
||||
{
|
||||
public OdMainWindow()
|
||||
private const int WmSettingChange = 0x001A;
|
||||
|
||||
// How far below and right of this window's corner a module's own window first opens.
|
||||
private const double PopOutOffset = 48;
|
||||
|
||||
private readonly OdShellViewModel _shell;
|
||||
private readonly OdDialogs _dialogs;
|
||||
private readonly OdTrayNotifier _notifier;
|
||||
private readonly IOdSettingsService _settings;
|
||||
private readonly IOdAppLifetime _lifetime;
|
||||
private readonly IOdAppMeta _meta;
|
||||
private readonly IOdQuickTimer _quickTimer;
|
||||
private readonly OdLibraryPage _library;
|
||||
private readonly OdSettingsPage _settingsPage;
|
||||
private readonly OdModuleStage _stage;
|
||||
private readonly OdModuleHost _host;
|
||||
private readonly OdWindowCover _cover;
|
||||
private readonly Dictionary<string, OdPopOutWindow> _popOuts = new(StringComparer.Ordinal);
|
||||
private readonly Dictionary<string, Rect> _popOutBounds = new(StringComparer.Ordinal);
|
||||
private OdPanePlacement? _paneBeforeFullscreen;
|
||||
private readonly Dictionary<string, NavigationViewItem> _moduleItems = new(StringComparer.Ordinal);
|
||||
private readonly NavigationViewItemSeparator _pinnedSeparator = new();
|
||||
private readonly OdTrayIcon _trayIcon = new();
|
||||
private bool? _navLabels;
|
||||
private int _navMax = -1;
|
||||
|
||||
public OdMainWindow(
|
||||
OdThemeEngine theme,
|
||||
OdShellViewModel shell,
|
||||
OdSettingsViewModel settingsPage,
|
||||
OdLegalGate legalGate,
|
||||
OdDialogs dialogs,
|
||||
ISnackbarService snackbars,
|
||||
OdTrayNotifier notifier,
|
||||
IOdSettingsService settings,
|
||||
IOdAppLifetime lifetime,
|
||||
IOdAppMeta meta,
|
||||
IOdQuickTimer quickTimer,
|
||||
OdBugReportFlow bugReports,
|
||||
OdBugReportRequests bugReportRequests,
|
||||
OdModuleHost host)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(theme);
|
||||
ArgumentNullException.ThrowIfNull(settingsPage);
|
||||
ArgumentNullException.ThrowIfNull(snackbars);
|
||||
InitializeComponent();
|
||||
VersionText.Text = OdVersionInfo.FromAssembly(typeof(OdMainWindow).Assembly).DisplayText;
|
||||
_shell = shell;
|
||||
_dialogs = dialogs;
|
||||
_notifier = notifier;
|
||||
_settings = settings;
|
||||
_lifetime = lifetime;
|
||||
_meta = meta;
|
||||
_quickTimer = quickTimer;
|
||||
DataContext = shell;
|
||||
_library = new OdLibraryPage { DataContext = shell };
|
||||
_settingsPage = new OdSettingsPage { DataContext = settingsPage };
|
||||
shell.SettingsSectionRequested += (_, e) => settingsPage.ShowSection(e.Section);
|
||||
settingsPage.About.LegalRequested += (_, _) =>
|
||||
new OdLegalWindow(new OdLegalViewModel(legalGate, OdApp.LegalFolder, readOnly: true)) { Owner = this }.Show();
|
||||
settingsPage.About.BugReportRequested += (sender, args) => _ = bugReports.ShowAsync(error: null);
|
||||
bugReportRequests.Requested += (sender, args) => _ = bugReports.ShowAsync(args.Error);
|
||||
_stage = new OdModuleStage { DataContext = shell };
|
||||
_host = host;
|
||||
_cover = new OdWindowCover(this);
|
||||
ListenForFullscreen(shell);
|
||||
ListenForPopOuts(shell);
|
||||
|
||||
// A web app's browser is a native window over the stage that no dialog can cover: hide it meanwhile.
|
||||
dialogs.OpenChanged += (_, _) => _stage.Visibility = dialogs.IsOpen ? Visibility.Hidden : Visibility.Visible;
|
||||
|
||||
dialogs.SetHost(RootDialogHost);
|
||||
snackbars.SetSnackbarPresenter(RootSnackbar);
|
||||
|
||||
// Created now, so the icon exists even if the window never shows; no Efficiency Mode, which
|
||||
// would throttle the whole process while timers run in the background. The image comes first,
|
||||
// so the icon never appears blank.
|
||||
UpdateTrayIcon();
|
||||
TrayIcon.ForceCreate(enablesEfficiencyMode: false);
|
||||
notifier.Attach((title, message) => _ = Dispatcher.InvokeAsync(() => TrayIcon.ShowNotification(title, message, NotificationIcon.Info)));
|
||||
notifier.Clicked += OnNotificationClicked;
|
||||
Closed += (_, _) =>
|
||||
{
|
||||
notifier.Clicked -= OnNotificationClicked;
|
||||
TrayIcon.Dispose();
|
||||
};
|
||||
|
||||
SetUpNavigation(theme);
|
||||
|
||||
// WPF ignores the Windows text size; re-read it when it may have changed (docs/UI-MODES.md §4).
|
||||
Activated += (_, _) => theme.RefreshTextScale();
|
||||
SourceInitialized += (_, _) => HwndSource.FromHwnd(new WindowInteropHelper(this).Handle)?.AddHook(
|
||||
(IntPtr _, int msg, IntPtr _, IntPtr _, ref bool _) =>
|
||||
{
|
||||
if (msg == WmSettingChange)
|
||||
{
|
||||
theme.RefreshTextScale();
|
||||
}
|
||||
|
||||
return IntPtr.Zero;
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>Shows the window from the tray or the taskbar, restored and in front.</summary>
|
||||
public void Present()
|
||||
{
|
||||
Show();
|
||||
if (WindowState == WindowState.Minimized)
|
||||
{
|
||||
WindowState = WindowState.Normal;
|
||||
}
|
||||
|
||||
Activate();
|
||||
}
|
||||
|
||||
object? INavigationViewPageProvider.GetPage(Type pageType)
|
||||
{
|
||||
if (pageType == typeof(OdLibraryPage))
|
||||
{
|
||||
return _library;
|
||||
}
|
||||
|
||||
if (pageType == typeof(OdSettingsPage))
|
||||
{
|
||||
return _settingsPage;
|
||||
}
|
||||
|
||||
return pageType == typeof(OdModuleStage) ? _stage : null;
|
||||
}
|
||||
|
||||
private void SetUpNavigation(OdThemeEngine theme)
|
||||
{
|
||||
RootNavigation.SetPageProviderService(this);
|
||||
RootNavigation.FooterMenuItems.Add(ShellItem(OdShellViewModel.SettingsTarget, Localized("Settings_Nav"), SymbolRegular.Settings24, typeof(OdSettingsPage)));
|
||||
RootNavigation.FooterMenuItems.Add(ShellItem(OdShellViewModel.LibraryTarget, Localized("Shell_Library"), SymbolRegular.Apps24, typeof(OdLibraryPage)));
|
||||
SyncSidebar();
|
||||
_shell.Sidebar.CollectionChanged += (_, _) => SyncSidebar();
|
||||
_shell.PropertyChanged += OnShellPropertyChanged;
|
||||
RootNavigation.SelectionChanged += OnNavigationSelectionChanged;
|
||||
RootNavigation.Navigating += (_, _) => RootNavigation.TransitionDuration = (int)OdMotion.DurationFor(this).TotalMilliseconds;
|
||||
RootNavigation.PaneOpened += (_, _) => UpdateToolTips();
|
||||
RootNavigation.PaneClosed += (_, _) => UpdateToolTips();
|
||||
theme.Applied += OnThemeApplied;
|
||||
Closed += (_, _) => theme.Applied -= OnThemeApplied;
|
||||
Loaded += (_, _) =>
|
||||
{
|
||||
ApplyNavTokens();
|
||||
UpdateToolTips();
|
||||
RootNavigation.Navigate(_shell.CurrentTarget);
|
||||
};
|
||||
}
|
||||
|
||||
private static Binding Localized(string key) => new($"[{key}]") { Source = OdLocalization.Instance, Mode = BindingMode.OneWay };
|
||||
|
||||
private static NavigationViewItem ShellItem(string target, Binding title, SymbolRegular icon, Type pageType)
|
||||
{
|
||||
var item = new NavigationViewItem
|
||||
{
|
||||
Icon = new SymbolIcon { Symbol = icon },
|
||||
TargetPageTag = target,
|
||||
TargetPageType = pageType,
|
||||
};
|
||||
item.SetBinding(ContentControl.ContentProperty, title);
|
||||
item.SetBinding(AutomationProperties.NameProperty, title);
|
||||
item.SetBinding(ToolTipProperty, title);
|
||||
return item;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Mirrors the sidebar, with a separator between pinned and merely open modules. Each module keeps
|
||||
/// one item for the window's lifetime: the navigation view never forgets an item's tag, so a
|
||||
/// re-added module must come back as the same item.
|
||||
/// </summary>
|
||||
private void SyncSidebar()
|
||||
{
|
||||
RootNavigation.MenuItems.Clear();
|
||||
var previousPinned = false;
|
||||
foreach (var module in _shell.VisibleSidebar(NavMaxVisibleItems))
|
||||
{
|
||||
if (previousPinned && !module.IsPinned)
|
||||
{
|
||||
RootNavigation.MenuItems.Add(_pinnedSeparator);
|
||||
}
|
||||
|
||||
if (!_moduleItems.TryGetValue(module.Id, out var item))
|
||||
{
|
||||
item = ModuleItem(module);
|
||||
_moduleItems[module.Id] = item;
|
||||
}
|
||||
|
||||
RootNavigation.MenuItems.Add(item);
|
||||
previousPinned = module.IsPinned;
|
||||
}
|
||||
|
||||
UpdateToolTips();
|
||||
}
|
||||
|
||||
private int NavMaxVisibleItems => TryFindResource(OdTokenKeys.NavMaxVisibleItems) is int max ? max : 0;
|
||||
|
||||
private void OnThemeApplied(object? sender, EventArgs e)
|
||||
{
|
||||
ApplyNavTokens();
|
||||
UpdateTrayIcon();
|
||||
}
|
||||
|
||||
/// <summary>Redraws the tray icon when the accent changed; the taskbar icon disposes the one it replaces.</summary>
|
||||
private void UpdateTrayIcon()
|
||||
{
|
||||
if (_trayIcon.Update(TryFindResource("AccentFillColorDefaultBrush") as Brush, TryFindResource("TextOnAccentFillColorPrimaryBrush") as Brush) is { } icon)
|
||||
{
|
||||
TrayIcon.Icon = icon;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Follows the preset's sidebar tokens (docs/UI-MODES.md §2): labels or icons only, and how many modules
|
||||
/// it shows. Only a change of preset opens or closes the pane; otherwise the user's own toggle stands.
|
||||
/// </summary>
|
||||
private void ApplyNavTokens()
|
||||
{
|
||||
var labels = TryFindResource(OdTokenKeys.NavShowLabels) is not false;
|
||||
if (_navLabels != labels)
|
||||
{
|
||||
_navLabels = labels;
|
||||
RootNavigation.IsPaneOpen = labels;
|
||||
}
|
||||
|
||||
var max = NavMaxVisibleItems;
|
||||
if (_navMax != max)
|
||||
{
|
||||
_navMax = max;
|
||||
SyncSidebar();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>With the pane closed the sidebar shows icons only, so each item's label moves into its tooltip.</summary>
|
||||
private void UpdateToolTips()
|
||||
{
|
||||
var show = !RootNavigation.IsPaneOpen;
|
||||
foreach (var item in RootNavigation.MenuItems.OfType<NavigationViewItem>().Concat(RootNavigation.FooterMenuItems.OfType<NavigationViewItem>()))
|
||||
{
|
||||
ToolTipService.SetIsEnabled(item, show);
|
||||
}
|
||||
}
|
||||
|
||||
private NavigationViewItem ModuleItem(OdModuleItemViewModel module)
|
||||
{
|
||||
var pin = new MenuItem { Command = _shell.TogglePinCommand, CommandParameter = module };
|
||||
var popOut = new MenuItem { CommandParameter = module };
|
||||
var close = new MenuItem { Command = _shell.CloseCommand, CommandParameter = module };
|
||||
close.SetBinding(HeaderedItemsControl.HeaderProperty, Localized("Shell_Close"));
|
||||
var menu = new ContextMenu { Items = { pin, popOut, close } };
|
||||
menu.Opened += (_, _) =>
|
||||
{
|
||||
pin.Header = OdLocalization.Get(module.IsPinned ? "Shell_Unpin" : "Shell_Pin");
|
||||
popOut.Header = module.IsPoppedOut ? OdLocalization.Get("Shell_PopIn") : OdLocalization.Get("Shell_PopOut");
|
||||
popOut.Command = module.IsPoppedOut ? _shell.PopInCommand : _shell.PopOutCommand;
|
||||
};
|
||||
|
||||
var item = new NavigationViewItem
|
||||
{
|
||||
Icon = new SymbolIcon { Symbol = OdSymbolConverter.Parse(module.Info.Icon) },
|
||||
TargetPageTag = module.Id,
|
||||
TargetPageType = typeof(OdModuleStage),
|
||||
ContextMenu = menu,
|
||||
};
|
||||
item.SetBinding(ContentControl.ContentProperty, new Binding(nameof(OdModuleItemViewModel.Title)) { Source = module });
|
||||
item.SetBinding(AutomationProperties.NameProperty, new Binding(nameof(OdModuleItemViewModel.Title)) { Source = module });
|
||||
item.SetBinding(ToolTipProperty, new Binding(nameof(OdModuleItemViewModel.Title)) { Source = module });
|
||||
return item;
|
||||
}
|
||||
|
||||
private async void OnNavigationSelectionChanged(NavigationView sender, RoutedEventArgs args)
|
||||
{
|
||||
if (sender.SelectedItem is NavigationViewItem { TargetPageTag: { Length: > 0 } target })
|
||||
{
|
||||
await _shell.NavigateAsync(target);
|
||||
|
||||
// A module in a window of its own stays there: the selection goes back to what this window shows.
|
||||
if (!string.Equals(target, _shell.CurrentTarget, StringComparison.Ordinal))
|
||||
{
|
||||
RootNavigation.Navigate(_shell.CurrentTarget);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void OnShellPropertyChanged(object? sender, PropertyChangedEventArgs e)
|
||||
{
|
||||
if (!string.Equals(e.PropertyName, nameof(OdShellViewModel.CurrentTarget), StringComparison.Ordinal))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// A capped sidebar must make room for the module now on screen before it can be selected.
|
||||
var max = NavMaxVisibleItems;
|
||||
if (max > 0 && _shell.Sidebar.Count > max)
|
||||
{
|
||||
SyncSidebar();
|
||||
}
|
||||
|
||||
var selected = (RootNavigation.SelectedItem as NavigationViewItem)?.TargetPageTag;
|
||||
if (!string.Equals(selected, _shell.CurrentTarget, StringComparison.Ordinal))
|
||||
{
|
||||
RootNavigation.Navigate(_shell.CurrentTarget);
|
||||
}
|
||||
}
|
||||
|
||||
private async void OnPreviewKeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.Key == Key.Escape && _cover.IsCovering)
|
||||
{
|
||||
e.Handled = true;
|
||||
SetFullscreen(on: false);
|
||||
return;
|
||||
}
|
||||
|
||||
// Exactly Ctrl: AltGr arrives as Ctrl+Alt, and must type its character rather than run a shortcut.
|
||||
if (Keyboard.Modifiers != ModifierKeys.Control || _dialogs.IsOpen)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (e.Key == Key.K)
|
||||
{
|
||||
e.Handled = true;
|
||||
await OpenPaletteAsync();
|
||||
}
|
||||
else if (_shell.ShortcutTarget(e.Key, NavMaxVisibleItems) is { } target)
|
||||
{
|
||||
e.Handled = true;
|
||||
await _shell.NavigateAsync(target);
|
||||
}
|
||||
}
|
||||
|
||||
private async void OnSearchClick(object sender, RoutedEventArgs e) => await OpenPaletteAsync();
|
||||
|
||||
private async Task OpenPaletteAsync()
|
||||
{
|
||||
var palette = new OdCommandPaletteViewModel(_shell.PaletteEntries());
|
||||
new OdCommandPaletteWindow(palette, this).ShowDialog();
|
||||
if (palette.Chosen is { } chosen)
|
||||
{
|
||||
await chosen.RunAsync();
|
||||
}
|
||||
}
|
||||
|
||||
private void OnClosing(object? sender, CancelEventArgs e)
|
||||
{
|
||||
if (_lifetime.IsQuitting || !_settings.Current.CloseToTray)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
e.Cancel = true;
|
||||
SetFullscreen(on: false);
|
||||
Hide();
|
||||
|
||||
// Say once, ever, where the window went.
|
||||
if (_meta.Get(OdAppMetaKeys.TrayHintShown) is null)
|
||||
{
|
||||
_meta.Set(OdAppMetaKeys.TrayHintShown, "1");
|
||||
_notifier.Notify(OdLocalization.Get("Tray_StillRunningTitle"), OdLocalization.Get("Tray_StillRunningMessage"));
|
||||
}
|
||||
}
|
||||
|
||||
private void OnTrayOpen(object sender, RoutedEventArgs e) => Present();
|
||||
|
||||
private void OnTrayNotificationClicked(object sender, RoutedEventArgs e) => _notifier.OnClicked();
|
||||
|
||||
/// <summary>A click on a notification brings the window up, on the module that raised it.</summary>
|
||||
private async void OnNotificationClicked(object? sender, OdNotificationClickedEventArgs e)
|
||||
{
|
||||
Present();
|
||||
if (e.Target is { } target)
|
||||
{
|
||||
await _shell.NavigateAsync(target);
|
||||
}
|
||||
}
|
||||
|
||||
private async void OnTrayQuit(object sender, RoutedEventArgs e) => await _lifetime.QuitAsync();
|
||||
|
||||
private void OnTrayQuickTimer(object sender, RoutedEventArgs e) => _quickTimer.StartQuick(TimeSpan.FromMinutes(5));
|
||||
|
||||
private IOdMediaControls? LoadedMedia() =>
|
||||
_host.Modules.Select(hosted => hosted.Module).OfType<IOdMediaControls>().FirstOrDefault(media => media.NowPlaying is not null);
|
||||
|
||||
/// <summary>The media items show only while a media module has something loaded.</summary>
|
||||
private void OnTrayMenuOpened(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var media = LoadedMedia();
|
||||
var visibility = media is null ? Visibility.Collapsed : Visibility.Visible;
|
||||
foreach (var item in new FrameworkElement[] { TrayMediaSeparator, TrayNowPlaying, TrayPlayPause, TrayNext, TrayPrevious })
|
||||
{
|
||||
item.Visibility = visibility;
|
||||
}
|
||||
|
||||
if (media is not null)
|
||||
{
|
||||
TrayNowPlaying.Header = media.NowPlaying;
|
||||
TrayPlayPause.Header = media.IsPlaying ? OdLocalization.Get("Tray_Pause") : OdLocalization.Get("Tray_Play");
|
||||
}
|
||||
}
|
||||
|
||||
private void OnTrayPlayPause(object sender, RoutedEventArgs e) => LoadedMedia()?.PlayPause();
|
||||
|
||||
private void OnTrayNext(object sender, RoutedEventArgs e) => LoadedMedia()?.Next();
|
||||
|
||||
private void OnTrayPrevious(object sender, RoutedEventArgs e) => LoadedMedia()?.Previous();
|
||||
|
||||
private void ListenForFullscreen(OdShellViewModel shell)
|
||||
{
|
||||
AddHandler(OdFullscreen.RequestedEvent, new EventHandler<OdFullscreenRequestedEventArgs>(OnFullscreenRequested));
|
||||
shell.PropertyChanged += (_, e) =>
|
||||
{
|
||||
// Full screen belongs to the module on screen: showing another one ends it.
|
||||
if (string.Equals(e.PropertyName, nameof(OdShellViewModel.CurrentView), StringComparison.Ordinal))
|
||||
{
|
||||
SetFullscreen(on: false);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private void ListenForPopOuts(OdShellViewModel shell)
|
||||
{
|
||||
shell.PopOutOpened += (_, e) => OpenPopOut(e.Item, e.View!);
|
||||
shell.PopOutActivationRequested += (_, e) => _popOuts.GetValueOrDefault(e.Item.Id)?.Present();
|
||||
shell.PopOutCloseRequested += (_, e) =>
|
||||
{
|
||||
if (_popOuts.Remove(e.Item.Id, out var window))
|
||||
{
|
||||
window.Release();
|
||||
_popOutBounds[e.Item.Id] = window.LastBounds;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>Opens a module's own window where it was last in this session, or beside this window.</summary>
|
||||
private void OpenPopOut(OdModuleItemViewModel item, FrameworkElement view)
|
||||
{
|
||||
var window = new OdPopOutWindow(item, view, this);
|
||||
if (_popOutBounds.TryGetValue(item.Id, out var bounds))
|
||||
{
|
||||
window.Left = bounds.Left;
|
||||
window.Top = bounds.Top;
|
||||
window.Width = bounds.Width;
|
||||
window.Height = bounds.Height;
|
||||
}
|
||||
else if (IsVisible && WindowState == WindowState.Normal)
|
||||
{
|
||||
window.Left = Left + PopOutOffset;
|
||||
window.Top = Top + PopOutOffset;
|
||||
}
|
||||
else
|
||||
{
|
||||
window.WindowStartupLocation = WindowStartupLocation.CenterScreen;
|
||||
}
|
||||
|
||||
window.Returned += async (_, _) =>
|
||||
{
|
||||
_popOuts.Remove(item.Id);
|
||||
_popOutBounds[item.Id] = window.LastBounds;
|
||||
await _shell.DockAsync(item);
|
||||
};
|
||||
_popOuts[item.Id] = window;
|
||||
window.Show();
|
||||
}
|
||||
|
||||
private void OnFullscreenRequested(object? sender, OdFullscreenRequestedEventArgs e)
|
||||
{
|
||||
e.Handled = true;
|
||||
SetFullscreen(e.On);
|
||||
}
|
||||
|
||||
/// <summary>Covers the monitor the window is on, chrome hidden, or puts the window back where it was.</summary>
|
||||
private void SetFullscreen(bool on)
|
||||
{
|
||||
if (on == _cover.IsCovering)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (on)
|
||||
{
|
||||
if (!_cover.Cover(OdMonitors.BoundsOf(new WindowInteropHelper(this).Handle)))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
FoldChrome();
|
||||
}
|
||||
else
|
||||
{
|
||||
_cover.Uncover();
|
||||
UnfoldChrome();
|
||||
}
|
||||
|
||||
OdFullscreen.SetIsActive(_stage, on);
|
||||
}
|
||||
|
||||
private void FoldChrome()
|
||||
{
|
||||
_paneBeforeFullscreen = new OdPanePlacement(RootNavigation.OpenPaneLength, RootNavigation.CompactPaneLength, RootNavigation.IsPaneToggleVisible, RootNavigation.FrameMargin);
|
||||
AppTitleBar.Visibility = Visibility.Collapsed;
|
||||
RootNavigation.TitleBar = null;
|
||||
|
||||
// The pane folds to nothing: changing its display mode would re-template the navigation view and
|
||||
// re-create the stage, and with it a player's video window.
|
||||
RootNavigation.IsPaneToggleVisible = false;
|
||||
RootNavigation.OpenPaneLength = 0;
|
||||
RootNavigation.CompactPaneLength = 0;
|
||||
|
||||
// The folded pane's template still keeps a few pixels (its margins, the frame's border): the frame
|
||||
// overlaps them. Clearing the title bar has just reset the frame's margin, so it is read only now.
|
||||
UpdateLayout();
|
||||
var offset = _stage.TranslatePoint(default, this);
|
||||
var frame = RootNavigation.FrameMargin;
|
||||
RootNavigation.FrameMargin = new Thickness(frame.Left - offset.X, frame.Top - offset.Y, frame.Right, frame.Bottom);
|
||||
}
|
||||
|
||||
private void UnfoldChrome()
|
||||
{
|
||||
AppTitleBar.Visibility = Visibility.Visible;
|
||||
RootNavigation.TitleBar = AppTitleBar;
|
||||
if (_paneBeforeFullscreen is { } pane)
|
||||
{
|
||||
_paneBeforeFullscreen = null;
|
||||
RootNavigation.OpenPaneLength = pane.OpenLength;
|
||||
RootNavigation.CompactPaneLength = pane.CompactLength;
|
||||
RootNavigation.IsPaneToggleVisible = pane.ToggleVisible;
|
||||
RootNavigation.FrameMargin = pane.FrameMargin;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,28 +8,60 @@
|
||||
<AssemblyName>OmniDeck</AssemblyName>
|
||||
<RootNamespace>OmniDeck.App</RootNamespace>
|
||||
<ApplicationManifest>app.manifest</ApplicationManifest>
|
||||
<!-- The executable's icon, which its windows, shortcuts and Explorer show (scripts/make-icon.ps1). -->
|
||||
<ApplicationIcon>Assets\OmniDeck.ico</ApplicationIcon>
|
||||
<!-- Custom entry point: Velopack's hooks must run before WPF loads OdApp.xaml resources. -->
|
||||
<StartupObject>OmniDeck.App.Program</StartupObject>
|
||||
<!-- Ship only the UI languages OmniDeck supports (EN neutral, VI, JA). -->
|
||||
<SatelliteResourceLanguages>en;vi;ja</SatelliteResourceLanguages>
|
||||
<!-- Resources/Strings.resx is English; the resource manager never probes for an "en" satellite. -->
|
||||
<NeutralLanguage>en</NeutralLanguage>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<!-- The application class is OdApp, not App: types carry the Od prefix, and Meziantou MA0049
|
||||
rejects a type named like its namespace. -->
|
||||
<Page Remove="OdApp.xaml" />
|
||||
<ApplicationDefinition Include="OdApp.xaml" />
|
||||
</ItemGroup>
|
||||
<!-- The application class is OdApp, not App: types carry the Od prefix, and Meziantou MA0049
|
||||
rejects a type named like its namespace. OdApp.xaml stays a plain Page (no ApplicationDefinition),
|
||||
so WPF generates no Main of its own: Program.Main creates OdApp with the single-instance guard. -->
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\OmniDeck.Core\OmniDeck.Core.csproj" />
|
||||
<ProjectReference Include="..\OmniDeck.Modules\OmniDeck.Modules.csproj" />
|
||||
<ProjectReference Include="..\OmniDeck.Web\OmniDeck.Web.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<InternalsVisibleTo Include="OmniDeck.Tests" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.2" />
|
||||
<PackageReference Include="H.NotifyIcon.Wpf" Version="2.4.1" />
|
||||
<PackageReference Include="Markdig" Version="1.5.1" />
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="10.0.14" />
|
||||
<PackageReference Include="Serilog.Sinks.File" Version="7.0.0" />
|
||||
<PackageReference Include="Velopack" Version="1.2.161" />
|
||||
<PackageReference Include="WPF-UI" Version="4.3.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<!-- libVLC for the media player (docs/SPEC.md §3.6), copied to libvlc\win-x64 next to OmniDeck.exe:
|
||||
x64 only, and only the plugins the player needs (docs/spikes/06-libvlcsharp.md). -->
|
||||
<PropertyGroup>
|
||||
<VlcWindowsX86Enabled>false</VlcWindowsX86Enabled>
|
||||
<VlcWindowsArm64Enabled>false</VlcWindowsArm64Enabled>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="VideoLAN.LibVLC.Windows" Version="3.0.24" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<VlcWindowsX64IncludeFiles Include="libvlc.dll;libvlccore.dll" />
|
||||
<VlcWindowsX64IncludeFiles Include="plugins\access\%2A;plugins\audio_filter\%2A;plugins\audio_mixer\%2A;plugins\audio_output\%2A" />
|
||||
<VlcWindowsX64IncludeFiles Include="plugins\codec\%2A;plugins\demux\%2A;plugins\packetizer\%2A;plugins\stream_filter\%2A" />
|
||||
<VlcWindowsX64IncludeFiles Include="plugins\text_renderer\%2A;plugins\spu\%2A;plugins\video_chroma\%2A;plugins\video_filter\%2A;plugins\video_output\%2A;plugins\misc\%2A" />
|
||||
<!-- The player opens local files: no network streaming. -->
|
||||
<VlcWindowsX64ExcludeFiles Include="plugins\access\libaccess_srt_plugin.dll;plugins\access\libftp_plugin.dll;plugins\access\libhttp_plugin.dll;plugins\access\libhttps_plugin.dll;plugins\access\librtp_plugin.dll;plugins\access\libsftp_plugin.dll;plugins\access\libsmb_plugin.dll" />
|
||||
</ItemGroup>
|
||||
|
||||
<!-- The license and legal documents travel with every build: the self-contained app
|
||||
redistributes MIT/BSD code whose notices must ship with it, and the P1 legal gate shows them. -->
|
||||
<ItemGroup>
|
||||
@@ -37,6 +69,11 @@
|
||||
<None Include="..\..\docs\legal\*.md" Link="legal\%(Filename)%(Extension)" CopyToOutputDirectory="PreserveNewest" CopyToPublishDirectory="PreserveNewest" />
|
||||
</ItemGroup>
|
||||
|
||||
<!-- The web-app catalog as of this build; a newer one fetched from main replaces it (docs/WEBAPP-CATALOG.md). -->
|
||||
<ItemGroup>
|
||||
<None Include="..\..\catalog\webapps.json" Link="catalog\webapps.json" CopyToOutputDirectory="PreserveNewest" CopyToPublishDirectory="PreserveNewest" />
|
||||
</ItemGroup>
|
||||
|
||||
<!-- A self-contained publish redistributes the .NET and Windows Desktop runtimes: their license
|
||||
and third-party notices ship too, under legal\<framework>\ (THIRD-PARTY-NOTICES.md points there). -->
|
||||
<Target Name="OdCopyRuntimeNotices" AfterTargets="Publish" Condition="'$(SelfContained)' == 'true'">
|
||||
|
||||
@@ -1,21 +1,48 @@
|
||||
using OmniDeck.Core.Runtime;
|
||||
using OmniDeck.Core.Storage;
|
||||
using Velopack;
|
||||
|
||||
namespace OmniDeck.App;
|
||||
|
||||
/// <summary>
|
||||
/// Process entry point. Velopack's install/update/uninstall hooks run first (they may exit the
|
||||
/// process and must not wait for WPF to load OdApp.xaml resources); only then is the WPF
|
||||
/// <see cref="OdApp"/> created.
|
||||
/// process and must not wait for WPF to load OdApp.xaml resources); then a second OmniDeck hands off
|
||||
/// to the first one and exits; only then is the WPF <see cref="OdApp"/> created.
|
||||
/// </summary>
|
||||
internal static class Program
|
||||
{
|
||||
[STAThread]
|
||||
private static int Main()
|
||||
{
|
||||
VelopackApp.Build().Run();
|
||||
VelopackApp.Build()
|
||||
// The privacy policy promises that uninstalling removes everything OmniDeck stored.
|
||||
.OnBeforeUninstallFastCallback(_ => OdDataRoot.Default.TryDelete())
|
||||
.Run();
|
||||
|
||||
var app = new OdApp();
|
||||
var dataRoot = DataRoot();
|
||||
using var guard = new OdSingleInstanceGuard(dataRoot.InstanceSuffix);
|
||||
if (!guard.IsPrimaryInstance)
|
||||
{
|
||||
guard.SignalPrimaryInstance();
|
||||
return 0;
|
||||
}
|
||||
|
||||
var app = new OdApp(guard, dataRoot);
|
||||
app.InitializeComponent();
|
||||
return app.Run();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The signed-in user's data root. A Debug build can be pointed elsewhere with
|
||||
/// <see cref="OdDataRoot.OverrideVariable"/>, so it runs beside an installed OmniDeck without
|
||||
/// touching its data; a Release build never reads the variable.
|
||||
/// </summary>
|
||||
private static OdDataRoot DataRoot()
|
||||
{
|
||||
#if DEBUG
|
||||
return OdDataRoot.Choose(Environment.GetEnvironmentVariable(OdDataRoot.OverrideVariable));
|
||||
#else
|
||||
return OdDataRoot.Default;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
using System.Resources;
|
||||
|
||||
namespace OmniDeck.App.Resources;
|
||||
|
||||
/// <summary>The shell's string table, <c>Resources/Strings.resx</c>; <c>OdApp</c> registers it with <c>OdLocalization</c>.</summary>
|
||||
internal static class OdAppStrings
|
||||
{
|
||||
public static ResourceManager Resources { get; } = new("OmniDeck.App.Resources.Strings", typeof(OdAppStrings).Assembly);
|
||||
}
|
||||
@@ -0,0 +1,475 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!-- The shell's UI strings, English (neutral). Vietnamese and Japanese satellites arrive in P3. -->
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="App_Name" xml:space="preserve">
|
||||
<value>OmniDeck</value>
|
||||
</data>
|
||||
<data name="Shell_Search" xml:space="preserve">
|
||||
<value>Search modules and commands</value>
|
||||
</data>
|
||||
<data name="Shell_Library" xml:space="preserve">
|
||||
<value>Library</value>
|
||||
</data>
|
||||
<data name="Shell_LibraryTitle" xml:space="preserve">
|
||||
<value>Module library</value>
|
||||
</data>
|
||||
<data name="Shell_LibraryIntro" xml:space="preserve">
|
||||
<value>Open a module, or pin it to keep it in the sidebar.</value>
|
||||
</data>
|
||||
<data name="Shell_LibraryEmpty" xml:space="preserve">
|
||||
<value>No modules are available yet.</value>
|
||||
</data>
|
||||
<data name="Shell_Open" xml:space="preserve">
|
||||
<value>Open</value>
|
||||
</data>
|
||||
<data name="Shell_Pin" xml:space="preserve">
|
||||
<value>Pin to sidebar</value>
|
||||
</data>
|
||||
<data name="Shell_Unpin" xml:space="preserve">
|
||||
<value>Unpin from sidebar</value>
|
||||
</data>
|
||||
<data name="Shell_Close" xml:space="preserve">
|
||||
<value>Close</value>
|
||||
</data>
|
||||
<data name="Shell_PopOut" xml:space="preserve">
|
||||
<value>Open in new window</value>
|
||||
</data>
|
||||
<data name="Shell_PopIn" xml:space="preserve">
|
||||
<value>Return to main window</value>
|
||||
</data>
|
||||
<data name="Shell_PaletteCommand" xml:space="preserve">
|
||||
<value>Command</value>
|
||||
</data>
|
||||
<data name="Shell_Quit" xml:space="preserve">
|
||||
<value>Quit OmniDeck</value>
|
||||
</data>
|
||||
<data name="Tray_Open" xml:space="preserve">
|
||||
<value>Open OmniDeck</value>
|
||||
</data>
|
||||
<data name="Tray_QuickTimer" xml:space="preserve">
|
||||
<value>Start a 5-minute timer</value>
|
||||
</data>
|
||||
<data name="Tray_Quit" xml:space="preserve">
|
||||
<value>Quit</value>
|
||||
</data>
|
||||
<data name="Tray_StillRunningTitle" xml:space="preserve">
|
||||
<value>OmniDeck is still running</value>
|
||||
</data>
|
||||
<data name="Tray_StillRunningMessage" xml:space="preserve">
|
||||
<value>It keeps running in the notification area. To exit, choose Quit from its icon's menu.</value>
|
||||
</data>
|
||||
<data name="Error_Title" xml:space="preserve">
|
||||
<value>Something went wrong</value>
|
||||
</data>
|
||||
<data name="Error_UiMessage" xml:space="preserve">
|
||||
<value>Something went wrong, but OmniDeck is still running.
|
||||
|
||||
Support code: {0}
|
||||
|
||||
{1}</value>
|
||||
</data>
|
||||
<data name="Error_StartFailed" xml:space="preserve">
|
||||
<value>OmniDeck could not start.
|
||||
|
||||
{0}</value>
|
||||
</data>
|
||||
<data name="Memory_Title" xml:space="preserve">
|
||||
<value>Running modules</value>
|
||||
</data>
|
||||
<data name="Memory_Intro" xml:space="preserve">
|
||||
<value>Hidden modules step down over time to save memory: idle, then suspended, then hibernated. Keep a module running to exempt it.</value>
|
||||
</data>
|
||||
<data name="Memory_InUse" xml:space="preserve">
|
||||
<value>In use: {0}</value>
|
||||
</data>
|
||||
<data name="Memory_Limits" xml:space="preserve">
|
||||
<value>Soft limit {0} · hard limit {1}</value>
|
||||
</data>
|
||||
<data name="Memory_SharedNote" xml:space="preserve">
|
||||
<value>Built-in modules share OmniDeck's own process, so only web apps have a figure of their own.</value>
|
||||
</data>
|
||||
<data name="Memory_SharedTitle" xml:space="preserve">
|
||||
<value>Shared web processes</value>
|
||||
</data>
|
||||
<data name="Memory_SharedDescription" xml:space="preserve">
|
||||
<value>The browser, graphics and helper processes every web app uses. They close with the last web app.</value>
|
||||
</data>
|
||||
<data name="Memory_KeepRunning" xml:space="preserve">
|
||||
<value>Keep running</value>
|
||||
</data>
|
||||
<data name="Memory_Suspend" xml:space="preserve">
|
||||
<value>Suspend</value>
|
||||
</data>
|
||||
<data name="Memory_Hibernate" xml:space="preserve">
|
||||
<value>Hibernate</value>
|
||||
</data>
|
||||
<data name="Memory_UsedNow" xml:space="preserve">
|
||||
<value>On screen</value>
|
||||
</data>
|
||||
<data name="Memory_UsedJustNow" xml:space="preserve">
|
||||
<value>Used just now</value>
|
||||
</data>
|
||||
<data name="Memory_UsedMinutesAgo" xml:space="preserve">
|
||||
<value>Used {0} min ago</value>
|
||||
</data>
|
||||
<data name="Memory_UsedHoursAgo" xml:space="preserve">
|
||||
<value>Used {0} h ago</value>
|
||||
</data>
|
||||
<data name="State_Created" xml:space="preserve">
|
||||
<value>Not started</value>
|
||||
</data>
|
||||
<data name="State_Active" xml:space="preserve">
|
||||
<value>Active</value>
|
||||
</data>
|
||||
<data name="State_Idle" xml:space="preserve">
|
||||
<value>Idle</value>
|
||||
</data>
|
||||
<data name="State_Suspended" xml:space="preserve">
|
||||
<value>Suspended</value>
|
||||
</data>
|
||||
<data name="State_Hibernated" xml:space="preserve">
|
||||
<value>Hibernated</value>
|
||||
</data>
|
||||
<data name="State_Closed" xml:space="preserve">
|
||||
<value>Closed</value>
|
||||
</data>
|
||||
<data name="Governor_HardCapTitle" xml:space="preserve">
|
||||
<value>OmniDeck is using a lot of memory</value>
|
||||
</data>
|
||||
<data name="Governor_HardCapHibernatedOne" xml:space="preserve">
|
||||
<value>It hibernated a module to stay under its {0} limit.</value>
|
||||
</data>
|
||||
<data name="Governor_HardCapHibernated" xml:space="preserve">
|
||||
<value>It hibernated {0} modules to stay under its {1} limit.</value>
|
||||
</data>
|
||||
<data name="Governor_HardCapKept" xml:space="preserve">
|
||||
<value>It is above its {0} limit, and nothing more can be hibernated: the open modules are in use or kept running.</value>
|
||||
</data>
|
||||
<data name="Governor_HardCapShared" xml:space="preserve">
|
||||
<value>It is above its {0} limit because the processes the open web apps share use {1}, mostly for graphics. Hibernating other modules would not bring that down.</value>
|
||||
</data>
|
||||
<data name="Governor_ResidentHibernatedTitle" xml:space="preserve">
|
||||
<value>{0} was hibernated to save memory</value>
|
||||
</data>
|
||||
<data name="Governor_ResidentHibernated" xml:space="preserve">
|
||||
<value>It shows no notifications until you open it again. Click here to open it.</value>
|
||||
</data>
|
||||
<data name="Settings_Nav" xml:space="preserve">
|
||||
<value>Settings</value>
|
||||
</data>
|
||||
<data name="Settings_Title" xml:space="preserve">
|
||||
<value>Settings</value>
|
||||
</data>
|
||||
<data name="Settings_General" xml:space="preserve">
|
||||
<value>General</value>
|
||||
</data>
|
||||
<data name="Settings_Appearance" xml:space="preserve">
|
||||
<value>Appearance</value>
|
||||
</data>
|
||||
<data name="Settings_Memory" xml:space="preserve">
|
||||
<value>Memory</value>
|
||||
</data>
|
||||
<data name="Settings_Data" xml:space="preserve">
|
||||
<value>Data</value>
|
||||
</data>
|
||||
<data name="Settings_About" xml:space="preserve">
|
||||
<value>About</value>
|
||||
</data>
|
||||
<data name="Settings_Language" xml:space="preserve">
|
||||
<value>Language</value>
|
||||
</data>
|
||||
<data name="Settings_CloseToTray" xml:space="preserve">
|
||||
<value>Keep running in the notification area when the window closes</value>
|
||||
</data>
|
||||
<data name="Settings_StartWithWindows" xml:space="preserve">
|
||||
<value>Start OmniDeck when I sign in to Windows</value>
|
||||
</data>
|
||||
<data name="Settings_Theme" xml:space="preserve">
|
||||
<value>Theme</value>
|
||||
</data>
|
||||
<data name="Settings_Preset" xml:space="preserve">
|
||||
<value>Layout</value>
|
||||
</data>
|
||||
<data name="Settings_FontScale" xml:space="preserve">
|
||||
<value>Text size</value>
|
||||
</data>
|
||||
<data name="Settings_Motion" xml:space="preserve">
|
||||
<value>Animations</value>
|
||||
</data>
|
||||
<data name="Settings_AccentSystem" xml:space="preserve">
|
||||
<value>Use the Windows accent color</value>
|
||||
</data>
|
||||
<data name="Settings_IdleAfter" xml:space="preserve">
|
||||
<value>Suspend hidden modules after (minutes)</value>
|
||||
</data>
|
||||
<data name="Settings_HibernateAfter" xml:space="preserve">
|
||||
<value>Hibernate hidden modules after (minutes)</value>
|
||||
</data>
|
||||
<data name="Settings_SoftCap" xml:space="preserve">
|
||||
<value>Soft memory limit in MB (0: automatic)</value>
|
||||
</data>
|
||||
<data name="Settings_HardCap" xml:space="preserve">
|
||||
<value>Hard memory limit in MB (0: automatic)</value>
|
||||
</data>
|
||||
<data name="Settings_DataFolder" xml:space="preserve">
|
||||
<value>Data folder</value>
|
||||
</data>
|
||||
<data name="Settings_OpenDataFolder" xml:space="preserve">
|
||||
<value>Open</value>
|
||||
</data>
|
||||
<data name="Settings_Export" xml:space="preserve">
|
||||
<value>Export settings…</value>
|
||||
</data>
|
||||
<data name="Settings_Import" xml:space="preserve">
|
||||
<value>Import settings…</value>
|
||||
</data>
|
||||
<data name="Settings_FileFilter" xml:space="preserve">
|
||||
<value>OmniDeck settings (*.json)|*.json</value>
|
||||
</data>
|
||||
<data name="Settings_Exported" xml:space="preserve">
|
||||
<value>Settings exported.</value>
|
||||
</data>
|
||||
<data name="Settings_Imported" xml:space="preserve">
|
||||
<value>Settings imported.</value>
|
||||
</data>
|
||||
<data name="Settings_ImportFailed" xml:space="preserve">
|
||||
<value>That file is not an OmniDeck settings file.</value>
|
||||
</data>
|
||||
<data name="Language_System" xml:space="preserve">
|
||||
<value>Follow Windows</value>
|
||||
</data>
|
||||
<data name="Language_English" xml:space="preserve">
|
||||
<value>English</value>
|
||||
</data>
|
||||
<data name="Theme_System" xml:space="preserve">
|
||||
<value>Follow Windows</value>
|
||||
</data>
|
||||
<data name="Theme_Light" xml:space="preserve">
|
||||
<value>Light</value>
|
||||
</data>
|
||||
<data name="Theme_Dark" xml:space="preserve">
|
||||
<value>Dark</value>
|
||||
</data>
|
||||
<data name="Preset_Dynamic" xml:space="preserve">
|
||||
<value>Dynamic</value>
|
||||
</data>
|
||||
<data name="Preset_DynamicHint" xml:space="preserve">
|
||||
<value>Compact and lively: smaller text, more motion.</value>
|
||||
</data>
|
||||
<data name="Preset_Standard" xml:space="preserve">
|
||||
<value>Standard</value>
|
||||
</data>
|
||||
<data name="Preset_StandardHint" xml:space="preserve">
|
||||
<value>Balanced, for most people.</value>
|
||||
</data>
|
||||
<data name="Preset_Comfort" xml:space="preserve">
|
||||
<value>Comfort</value>
|
||||
</data>
|
||||
<data name="Preset_ComfortHint" xml:space="preserve">
|
||||
<value>Larger text and targets, no motion.</value>
|
||||
</data>
|
||||
<data name="Onboarding_Title" xml:space="preserve">
|
||||
<value>Welcome to OmniDeck</value>
|
||||
</data>
|
||||
<data name="Onboarding_Intro" xml:space="preserve">
|
||||
<value>Pick a language and a layout. The layout applies as you choose it.</value>
|
||||
</data>
|
||||
<data name="Onboarding_Later" xml:space="preserve">
|
||||
<value>You can change both later in Settings.</value>
|
||||
</data>
|
||||
<data name="Onboarding_Done" xml:space="preserve">
|
||||
<value>Get started</value>
|
||||
</data>
|
||||
<data name="Legal_Title" xml:space="preserve">
|
||||
<value>Before you start</value>
|
||||
</data>
|
||||
<data name="Legal_Intro" xml:space="preserve">
|
||||
<value>OmniDeck is free software under the GNU General Public License v3. Please read these documents: continuing records that you have read them. It is not a condition of the license.</value>
|
||||
</data>
|
||||
<data name="Legal_Eula" xml:space="preserve">
|
||||
<value>License agreement</value>
|
||||
</data>
|
||||
<data name="Legal_Disclaimer" xml:space="preserve">
|
||||
<value>Disclaimer</value>
|
||||
</data>
|
||||
<data name="Legal_Privacy" xml:space="preserve">
|
||||
<value>Privacy policy</value>
|
||||
</data>
|
||||
<data name="Legal_Notices" xml:space="preserve">
|
||||
<value>Third-party notices</value>
|
||||
</data>
|
||||
<data name="Legal_HaveRead" xml:space="preserve">
|
||||
<value>I have read these documents</value>
|
||||
</data>
|
||||
<data name="Legal_Continue" xml:space="preserve">
|
||||
<value>Continue</value>
|
||||
</data>
|
||||
<data name="Legal_Quit" xml:space="preserve">
|
||||
<value>Quit</value>
|
||||
</data>
|
||||
<data name="Legal_Close" xml:space="preserve">
|
||||
<value>Close</value>
|
||||
</data>
|
||||
<data name="Legal_Missing" xml:space="preserve">
|
||||
<value>{0} is missing from this copy of OmniDeck.</value>
|
||||
</data>
|
||||
<data name="About_Version" xml:space="preserve">
|
||||
<value>Version {0}</value>
|
||||
</data>
|
||||
<data name="About_CheckUpdates" xml:space="preserve">
|
||||
<value>Check for updates</value>
|
||||
</data>
|
||||
<data name="About_Checking" xml:space="preserve">
|
||||
<value>Checking for updates…</value>
|
||||
</data>
|
||||
<data name="About_UpToDate" xml:space="preserve">
|
||||
<value>OmniDeck is up to date.</value>
|
||||
</data>
|
||||
<data name="About_Available" xml:space="preserve">
|
||||
<value>Version {0} is available.</value>
|
||||
</data>
|
||||
<data name="About_Download" xml:space="preserve">
|
||||
<value>Download and restart</value>
|
||||
</data>
|
||||
<data name="About_Downloading" xml:space="preserve">
|
||||
<value>Downloading the update: {0} %</value>
|
||||
</data>
|
||||
<data name="About_Failed" xml:space="preserve">
|
||||
<value>Could not update: {0}</value>
|
||||
</data>
|
||||
<data name="About_NotInstalled" xml:space="preserve">
|
||||
<value>Updates work in installed copies of OmniDeck, not in development builds.</value>
|
||||
</data>
|
||||
<data name="About_Links" xml:space="preserve">
|
||||
<value>Links</value>
|
||||
</data>
|
||||
<data name="About_GitHub" xml:space="preserve">
|
||||
<value>Source code on GitHub</value>
|
||||
</data>
|
||||
<data name="About_Discussions" xml:space="preserve">
|
||||
<value>Discussions</value>
|
||||
</data>
|
||||
<data name="About_Discord" xml:space="preserve">
|
||||
<value>Discord</value>
|
||||
</data>
|
||||
<data name="About_Legal" xml:space="preserve">
|
||||
<value>License and legal documents</value>
|
||||
</data>
|
||||
<data name="About_Credits" xml:space="preserve">
|
||||
<value>OmniDeck is built with .NET, WPF-UI, Velopack, CommunityToolkit.Mvvm, H.NotifyIcon, Serilog, Dapper, SQLite and Markdig. The third-party notices list them all.</value>
|
||||
</data>
|
||||
<data name="Update_AvailableTitle" xml:space="preserve">
|
||||
<value>OmniDeck {0} is available</value>
|
||||
</data>
|
||||
<data name="Update_AvailableMessage" xml:space="preserve">
|
||||
<value>Open Settings → About to install it.</value>
|
||||
</data>
|
||||
<data name="Dialog_OK" xml:space="preserve">
|
||||
<value>OK</value>
|
||||
</data>
|
||||
<data name="Dialog_Cancel" xml:space="preserve">
|
||||
<value>Cancel</value>
|
||||
</data>
|
||||
<data name="Settings_WebApps" xml:space="preserve">
|
||||
<value>Web apps</value>
|
||||
</data>
|
||||
<data name="WebApps_Intro" xml:space="preserve">
|
||||
<value>Choose which web apps may show notifications. An app with notifications on keeps running while hidden, so that it can notify you; it is closed only when OmniDeck runs short of memory.</value>
|
||||
</data>
|
||||
<data name="WebApps_Notifications" xml:space="preserve">
|
||||
<value>Notifications</value>
|
||||
</data>
|
||||
<data name="WebApps_NoPermissions" xml:space="preserve">
|
||||
<value>No permissions asked yet</value>
|
||||
</data>
|
||||
<data name="WebApps_Allowed" xml:space="preserve">
|
||||
<value>{0} allowed</value>
|
||||
</data>
|
||||
<data name="WebApps_Blocked" xml:space="preserve">
|
||||
<value>{0} blocked</value>
|
||||
</data>
|
||||
<data name="WebApps_ResetPermissions" xml:space="preserve">
|
||||
<value>Ask again</value>
|
||||
</data>
|
||||
<data name="WebApps_DataTitle" xml:space="preserve">
|
||||
<value>Sign-in data</value>
|
||||
</data>
|
||||
<data name="WebApps_DataIntro" xml:space="preserve">
|
||||
<value>The apps in a group share one sign-in. Clearing a group's data signs you out of all of them and closes them.</value>
|
||||
</data>
|
||||
<data name="WebApps_ClearData" xml:space="preserve">
|
||||
<value>Clear data</value>
|
||||
</data>
|
||||
<data name="WebApps_ClearTitle" xml:space="preserve">
|
||||
<value>Clear sign-in data?</value>
|
||||
</data>
|
||||
<data name="WebApps_ClearMessage" xml:space="preserve">
|
||||
<value>You will be signed out of {0}. Their cookies, site data and cached pages are deleted.</value>
|
||||
</data>
|
||||
<data name="WebApps_ClearConfirm" xml:space="preserve">
|
||||
<value>Clear data</value>
|
||||
</data>
|
||||
<data name="WebApps_Cleared" xml:space="preserve">
|
||||
<value>Cleared the data of {0}.</value>
|
||||
</data>
|
||||
<data name="WebApps_ClearFailed" xml:space="preserve">
|
||||
<value>The data could not be cleared. Try again after restarting OmniDeck.</value>
|
||||
</data>
|
||||
<data name="WebApps_Catalog" xml:space="preserve">
|
||||
<value>Web app catalog of {0}, with {1} apps.</value>
|
||||
</data>
|
||||
<data name="WebApps_Checked" xml:space="preserve">
|
||||
<value>Last checked for a newer catalog on {0}.</value>
|
||||
</data>
|
||||
<data name="WebApps_NotChecked" xml:space="preserve">
|
||||
<value>Not checked for a newer catalog yet.</value>
|
||||
</data>
|
||||
<data name="About_ReportBug" xml:space="preserve">
|
||||
<value>Report a bug</value>
|
||||
</data>
|
||||
<data name="Error_Report" xml:space="preserve">
|
||||
<value>Report bug</value>
|
||||
</data>
|
||||
<data name="Report_Title" xml:space="preserve">
|
||||
<value>Report a bug</value>
|
||||
</data>
|
||||
<data name="Report_Intro" xml:space="preserve">
|
||||
<value>OmniDeck saves a report on this PC and opens a new GitHub issue in your browser, with the short fields filled in. Nothing is sent: attach the report to the issue yourself. Web addresses keep no query, and tokens, cookies, email addresses, long ids and your user name are taken out first.</value>
|
||||
</data>
|
||||
<data name="Report_Subject" xml:space="preserve">
|
||||
<value>What is it about?</value>
|
||||
</data>
|
||||
<data name="Report_General" xml:space="preserve">
|
||||
<value>OmniDeck in general</value>
|
||||
</data>
|
||||
<data name="Report_Preview" xml:space="preserve">
|
||||
<value>The issue text, also in the report as issue.md</value>
|
||||
</data>
|
||||
<data name="Report_Save" xml:space="preserve">
|
||||
<value>Save and open GitHub</value>
|
||||
</data>
|
||||
<data name="Tray_Play" xml:space="preserve">
|
||||
<value>Play</value>
|
||||
</data>
|
||||
<data name="Tray_Pause" xml:space="preserve">
|
||||
<value>Pause</value>
|
||||
</data>
|
||||
<data name="Tray_Next" xml:space="preserve">
|
||||
<value>Next</value>
|
||||
</data>
|
||||
<data name="Tray_Previous" xml:space="preserve">
|
||||
<value>Previous</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -0,0 +1,9 @@
|
||||
namespace OmniDeck.App.Settings;
|
||||
|
||||
/// <summary>Starting OmniDeck when the user signs in to Windows, quietly in the tray.</summary>
|
||||
public interface IOdStartupRegistration
|
||||
{
|
||||
bool IsEnabled { get; }
|
||||
|
||||
void Set(bool enabled);
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using OmniDeck.App.Updates;
|
||||
using OmniDeck.Core;
|
||||
using OmniDeck.Core.Localization;
|
||||
|
||||
namespace OmniDeck.App.Settings;
|
||||
|
||||
/// <summary>
|
||||
/// Settings → About (docs/SPEC.md §2): version and commit, the update check (Velopack against GitHub
|
||||
/// releases), and the project's links. Used from the UI thread.
|
||||
/// </summary>
|
||||
public sealed partial class OdAboutViewModel(IOdUpdateService updates, Action<Uri> open) : ObservableObject
|
||||
{
|
||||
public const string Repository = "https://github.com/poli0981/OmniDeck";
|
||||
public const string Discussions = Repository + "/discussions";
|
||||
public const string Discord = "https://discord.gg/u8tn3YypyX";
|
||||
|
||||
[ObservableProperty]
|
||||
[NotifyPropertyChangedFor(nameof(CanDownload))]
|
||||
private OdUpdateState _state = OdUpdateState.Idle;
|
||||
|
||||
[ObservableProperty]
|
||||
private string _statusText = "";
|
||||
|
||||
public string VersionText { get; } = OdLocalization.Format("About_Version", OdVersionInfo.FromAssembly(typeof(OdAboutViewModel).Assembly).DisplayText);
|
||||
|
||||
public bool CanDownload => State == OdUpdateState.Available;
|
||||
|
||||
/// <summary>Raised when the user asks to report a bug.</summary>
|
||||
public event EventHandler? BugReportRequested;
|
||||
|
||||
/// <summary>Raised when the user asks to read the legal documents again.</summary>
|
||||
public event EventHandler? LegalRequested;
|
||||
|
||||
/// <summary>Opening About checks for updates (docs/ARCHITECTURE.md §7), unless a check already ran.</summary>
|
||||
public Task CheckOnOpenAsync() => State == OdUpdateState.Idle ? CheckCommand.ExecuteAsync(null) : Task.CompletedTask;
|
||||
|
||||
[RelayCommand]
|
||||
private async Task CheckAsync()
|
||||
{
|
||||
if (!updates.IsInstalled)
|
||||
{
|
||||
Show(OdUpdateState.NotInstalled, OdLocalization.Get("About_NotInstalled"));
|
||||
return;
|
||||
}
|
||||
|
||||
Show(OdUpdateState.Checking, OdLocalization.Get("About_Checking"));
|
||||
try
|
||||
{
|
||||
var version = await updates.CheckAsync(CancellationToken.None);
|
||||
if (version is null)
|
||||
{
|
||||
Show(OdUpdateState.UpToDate, OdLocalization.Get("About_UpToDate"));
|
||||
}
|
||||
else
|
||||
{
|
||||
Show(OdUpdateState.Available, OdLocalization.Format("About_Available", version));
|
||||
}
|
||||
}
|
||||
catch (Exception ex) when (ex is not OperationCanceledException)
|
||||
{
|
||||
// Offline, rate-limited or a broken release: say so and let the user try again.
|
||||
Show(OdUpdateState.Failed, OdLocalization.Format("About_Failed", ex.Message));
|
||||
}
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
private async Task DownloadAsync()
|
||||
{
|
||||
Show(OdUpdateState.Downloading, OdLocalization.Format("About_Downloading", 0));
|
||||
try
|
||||
{
|
||||
await updates.DownloadAsync(new Progress<int>(percent => StatusText = OdLocalization.Format("About_Downloading", percent)), CancellationToken.None);
|
||||
updates.ApplyAndRestart();
|
||||
}
|
||||
catch (Exception ex) when (ex is not OperationCanceledException)
|
||||
{
|
||||
Show(OdUpdateState.Failed, OdLocalization.Format("About_Failed", ex.Message));
|
||||
}
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
private void OpenLink(string link) => open(new Uri(link, UriKind.Absolute));
|
||||
|
||||
[RelayCommand]
|
||||
private void ShowLegal() => LegalRequested?.Invoke(this, EventArgs.Empty);
|
||||
|
||||
[RelayCommand]
|
||||
private void ReportBug() => BugReportRequested?.Invoke(this, EventArgs.Empty);
|
||||
|
||||
private void Show(OdUpdateState state, string text)
|
||||
{
|
||||
State = state;
|
||||
StatusText = text;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
namespace OmniDeck.App.Settings;
|
||||
|
||||
/// <summary>One entry of a settings choice: the value stored and the text shown.</summary>
|
||||
public sealed record OdChoice<T>(T Value, string Title)
|
||||
{
|
||||
/// <summary>The text shown: screen readers name a list item after its data.</summary>
|
||||
public override string ToString() => Title;
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using OmniDeck.Core.Settings;
|
||||
using OmniDeck.Core.Storage;
|
||||
|
||||
namespace OmniDeck.App.Settings;
|
||||
|
||||
/// <summary>
|
||||
/// First-run setup, right after the legal gate: the language and the UI preset. A preset applies as
|
||||
/// soon as it is picked, so the window itself is the preview. Get started records that setup is done.
|
||||
/// </summary>
|
||||
public sealed partial class OdOnboardingViewModel : ObservableObject
|
||||
{
|
||||
private readonly IOdSettingsService _settings;
|
||||
private readonly IOdAppMeta _meta;
|
||||
|
||||
[ObservableProperty]
|
||||
private string _language;
|
||||
|
||||
[ObservableProperty]
|
||||
private string _preset;
|
||||
|
||||
public OdOnboardingViewModel(IOdSettingsService settings, IOdAppMeta meta)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(settings);
|
||||
_settings = settings;
|
||||
_meta = meta;
|
||||
_language = settings.Current.Language;
|
||||
_preset = settings.Current.Preset;
|
||||
}
|
||||
|
||||
/// <summary>Raised once the user is done.</summary>
|
||||
public event EventHandler? Finished;
|
||||
|
||||
public IReadOnlyList<OdChoice<string>> Languages { get; } = OdSettingsViewModel.LanguageChoices();
|
||||
|
||||
public IReadOnlyList<OdPresetOption> Presets { get; } = OdPresetOption.All();
|
||||
|
||||
/// <summary>Whether this is the first run, so setup still has to happen.</summary>
|
||||
public static bool IsNeeded(IOdAppMeta meta)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(meta);
|
||||
return meta.Get(OdAppMetaKeys.OnboardingDone) is null;
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
private void Finish()
|
||||
{
|
||||
_meta.Set(OdAppMetaKeys.OnboardingDone, "1");
|
||||
Finished?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
|
||||
partial void OnLanguageChanged(string value) => _settings.Update(s => s with { Language = value });
|
||||
|
||||
partial void OnPresetChanged(string value) => _settings.Update(s => s with { Preset = value });
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
<ui:FluentWindow x:Class="OmniDeck.App.Settings.OdOnboardingWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:res="clr-namespace:OmniDeck.Core.Localization;assembly=OmniDeck.Core"
|
||||
xmlns:settings="clr-namespace:OmniDeck.App.Settings"
|
||||
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
|
||||
Title="{res:OdLoc Onboarding_Title}"
|
||||
Width="760"
|
||||
Height="560"
|
||||
MinWidth="520"
|
||||
MinHeight="420"
|
||||
ExtendsContentIntoTitleBar="True"
|
||||
WindowBackdropType="Mica"
|
||||
WindowStartupLocation="CenterScreen">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<ui:TitleBar Title="{res:OdLoc Onboarding_Title}" Grid.Row="0" />
|
||||
<ScrollViewer Grid.Row="1" VerticalScrollBarVisibility="Auto">
|
||||
<StackPanel Margin="{DynamicResource Od.Padding.Card}">
|
||||
<TextBlock FontSize="{DynamicResource Od.Font.H1}"
|
||||
FontWeight="SemiBold"
|
||||
Text="{res:OdLoc Onboarding_Title}" />
|
||||
<TextBlock Margin="{DynamicResource Od.Margin.Item}"
|
||||
Foreground="{DynamicResource TextFillColorSecondaryBrush}"
|
||||
Text="{res:OdLoc Onboarding_Intro}"
|
||||
TextWrapping="Wrap" />
|
||||
<TextBlock FontWeight="SemiBold" Text="{res:OdLoc Settings_Language}" />
|
||||
<ComboBox Width="260"
|
||||
Margin="{DynamicResource Od.Margin.Item}"
|
||||
HorizontalAlignment="Left"
|
||||
AutomationProperties.Name="{res:OdLoc Settings_Language}"
|
||||
DisplayMemberPath="Title"
|
||||
ItemsSource="{Binding Languages}"
|
||||
SelectedValue="{Binding Language}"
|
||||
SelectedValuePath="Value" />
|
||||
<TextBlock FontWeight="SemiBold" Text="{res:OdLoc Settings_Preset}" />
|
||||
<ListBox Margin="{DynamicResource Od.Margin.Item}"
|
||||
AutomationProperties.Name="{res:OdLoc Settings_Preset}"
|
||||
Background="Transparent"
|
||||
BorderThickness="0"
|
||||
ItemsSource="{Binding Presets}"
|
||||
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
|
||||
SelectedValue="{Binding Preset}"
|
||||
SelectedValuePath="Name">
|
||||
<ListBox.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<WrapPanel />
|
||||
</ItemsPanelTemplate>
|
||||
</ListBox.ItemsPanel>
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate DataType="{x:Type settings:OdPresetOption}">
|
||||
<StackPanel Width="200" Margin="{DynamicResource Od.Padding.Control}">
|
||||
<TextBlock FontSize="{DynamicResource Od.Font.H2}"
|
||||
FontWeight="SemiBold"
|
||||
Text="{Binding Title}" />
|
||||
<TextBlock Foreground="{DynamicResource TextFillColorSecondaryBrush}"
|
||||
Text="{Binding Hint}"
|
||||
TextWrapping="Wrap" />
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
<TextBlock Foreground="{DynamicResource TextFillColorTertiaryBrush}"
|
||||
Text="{res:OdLoc Onboarding_Later}"
|
||||
TextWrapping="Wrap" />
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
<ui:Button Grid.Row="2"
|
||||
Margin="{DynamicResource Od.Padding.Card}"
|
||||
HorizontalAlignment="Right"
|
||||
Appearance="Primary"
|
||||
Command="{Binding FinishCommand}"
|
||||
Content="{res:OdLoc Onboarding_Done}" />
|
||||
</Grid>
|
||||
</ui:FluentWindow>
|
||||
@@ -0,0 +1,13 @@
|
||||
namespace OmniDeck.App.Settings;
|
||||
|
||||
/// <summary>First-run setup, between the legal gate and the main window; closing it keeps the defaults.</summary>
|
||||
public partial class OdOnboardingWindow
|
||||
{
|
||||
public OdOnboardingWindow(OdOnboardingViewModel viewModel)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(viewModel);
|
||||
InitializeComponent();
|
||||
DataContext = viewModel;
|
||||
viewModel.Finished += (_, _) => Close();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using OmniDeck.Core.Localization;
|
||||
using OmniDeck.Core.Theming;
|
||||
|
||||
namespace OmniDeck.App.Settings;
|
||||
|
||||
/// <summary>A UI preset as the preset cards show it (docs/UI-MODES.md).</summary>
|
||||
public sealed record OdPresetOption(string Name, string Title, string Hint)
|
||||
{
|
||||
/// <summary>The three presets, in the order the cards show them.</summary>
|
||||
public static IReadOnlyList<OdPresetOption> All() =>
|
||||
[.. OdPreset.All.Select(preset => new OdPresetOption(preset.Name, OdLocalization.Get("Preset_" + preset.Name), OdLocalization.Get("Preset_" + preset.Name + "Hint")))];
|
||||
|
||||
/// <summary>The card's title: screen readers name a list item after its data.</summary>
|
||||
public override string ToString() => Title;
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
using Microsoft.Win32;
|
||||
|
||||
namespace OmniDeck.App.Settings;
|
||||
|
||||
/// <summary>
|
||||
/// <see cref="IOdStartupRegistration"/> through the per-user Run key: no admin rights, and removed
|
||||
/// with the value. The command starts OmniDeck with <see cref="MinimizedArgument"/>, straight to the tray.
|
||||
/// </summary>
|
||||
public sealed class OdRunKeyStartup(string keyPath, string valueName, string executable) : IOdStartupRegistration
|
||||
{
|
||||
public const string MinimizedArgument = "--minimized";
|
||||
|
||||
public const string RunKey = @"Software\Microsoft\Windows\CurrentVersion\Run";
|
||||
|
||||
/// <summary>The registration for this process's executable under the real Run key.</summary>
|
||||
public OdRunKeyStartup()
|
||||
: this(RunKey, "OmniDeck", Environment.ProcessPath ?? "OmniDeck.exe")
|
||||
{
|
||||
}
|
||||
|
||||
public string Command => $"\"{executable}\" {MinimizedArgument}";
|
||||
|
||||
public bool IsEnabled
|
||||
{
|
||||
get
|
||||
{
|
||||
using var key = Registry.CurrentUser.OpenSubKey(keyPath);
|
||||
return string.Equals(key?.GetValue(valueName) as string, Command, StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
}
|
||||
|
||||
public void Set(bool enabled)
|
||||
{
|
||||
using var key = Registry.CurrentUser.CreateSubKey(keyPath, writable: true);
|
||||
if (enabled)
|
||||
{
|
||||
key.SetValue(valueName, Command, RegistryValueKind.String);
|
||||
}
|
||||
else
|
||||
{
|
||||
key.DeleteValue(valueName, throwOnMissingValue: false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,324 @@
|
||||
<UserControl x:Class="OmniDeck.App.Settings.OdSettingsPage"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:res="clr-namespace:OmniDeck.Core.Localization;assembly=OmniDeck.Core"
|
||||
xmlns:settings="clr-namespace:OmniDeck.App.Settings"
|
||||
xmlns:shell="clr-namespace:OmniDeck.App.Shell"
|
||||
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
|
||||
Foreground="{DynamicResource TextFillColorPrimaryBrush}">
|
||||
<!-- The navigation view's frame does not pass the window's text color down: pages set their own. -->
|
||||
<UserControl.Resources>
|
||||
<BooleanToVisibilityConverter x:Key="Visible" />
|
||||
</UserControl.Resources>
|
||||
<DockPanel Margin="{DynamicResource Od.Padding.Card}">
|
||||
<TextBlock Margin="{DynamicResource Od.Margin.Item}"
|
||||
DockPanel.Dock="Top"
|
||||
FontSize="{DynamicResource Od.Font.H1}"
|
||||
FontWeight="SemiBold"
|
||||
Text="{res:OdLoc Settings_Title}" />
|
||||
<TabControl SelectedIndex="{Binding SectionIndex}">
|
||||
<TabItem Header="{res:OdLoc Settings_General}">
|
||||
<ScrollViewer VerticalScrollBarVisibility="Auto">
|
||||
<StackPanel Margin="{DynamicResource Od.Padding.Control}">
|
||||
<ui:CardControl Margin="{DynamicResource Od.Margin.Item}" Header="{res:OdLoc Settings_Language}">
|
||||
<ComboBox MinWidth="200"
|
||||
AutomationProperties.Name="{res:OdLoc Settings_Language}"
|
||||
DisplayMemberPath="Title"
|
||||
ItemsSource="{Binding Languages}"
|
||||
SelectedValue="{Binding Language}"
|
||||
SelectedValuePath="Value" />
|
||||
</ui:CardControl>
|
||||
<ui:CardControl Margin="{DynamicResource Od.Margin.Item}" Header="{res:OdLoc Settings_CloseToTray}">
|
||||
<ui:ToggleSwitch AutomationProperties.Name="{res:OdLoc Settings_CloseToTray}" IsChecked="{Binding CloseToTray}" />
|
||||
</ui:CardControl>
|
||||
<ui:CardControl Margin="{DynamicResource Od.Margin.Item}" Header="{res:OdLoc Settings_StartWithWindows}">
|
||||
<ui:ToggleSwitch AutomationProperties.Name="{res:OdLoc Settings_StartWithWindows}" IsChecked="{Binding StartWithWindows}" />
|
||||
</ui:CardControl>
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
</TabItem>
|
||||
|
||||
<TabItem Header="{res:OdLoc Settings_Appearance}">
|
||||
<ScrollViewer VerticalScrollBarVisibility="Auto">
|
||||
<StackPanel Margin="{DynamicResource Od.Padding.Control}">
|
||||
<ui:CardControl Margin="{DynamicResource Od.Margin.Item}" Header="{res:OdLoc Settings_Theme}">
|
||||
<ComboBox MinWidth="200"
|
||||
AutomationProperties.Name="{res:OdLoc Settings_Theme}"
|
||||
DisplayMemberPath="Title"
|
||||
ItemsSource="{Binding Themes}"
|
||||
SelectedValue="{Binding Theme}"
|
||||
SelectedValuePath="Value" />
|
||||
</ui:CardControl>
|
||||
<TextBlock Margin="{DynamicResource Od.Padding.Control}"
|
||||
FontWeight="SemiBold"
|
||||
Text="{res:OdLoc Settings_Preset}" />
|
||||
<ListBox Margin="{DynamicResource Od.Margin.Item}"
|
||||
AutomationProperties.Name="{res:OdLoc Settings_Preset}"
|
||||
Background="Transparent"
|
||||
BorderThickness="0"
|
||||
ItemsSource="{Binding Presets}"
|
||||
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
|
||||
SelectedValue="{Binding Preset}"
|
||||
SelectedValuePath="Name">
|
||||
<ListBox.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<WrapPanel />
|
||||
</ItemsPanelTemplate>
|
||||
</ListBox.ItemsPanel>
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate DataType="{x:Type settings:OdPresetOption}">
|
||||
<StackPanel Width="220" Margin="{DynamicResource Od.Padding.Control}">
|
||||
<TextBlock FontSize="{DynamicResource Od.Font.H2}"
|
||||
FontWeight="SemiBold"
|
||||
Text="{Binding Title}" />
|
||||
<TextBlock Foreground="{DynamicResource TextFillColorSecondaryBrush}"
|
||||
Text="{Binding Hint}"
|
||||
TextWrapping="Wrap" />
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
<ui:CardControl Margin="{DynamicResource Od.Margin.Item}" Header="{res:OdLoc Settings_FontScale}">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Slider Width="220"
|
||||
VerticalAlignment="Center"
|
||||
AutomationProperties.Name="{res:OdLoc Settings_FontScale}"
|
||||
IsSnapToTickEnabled="True"
|
||||
Maximum="1.4"
|
||||
Minimum="0.85"
|
||||
TickFrequency="0.05"
|
||||
Value="{Binding FontScale}" />
|
||||
<TextBlock Margin="{DynamicResource Od.Padding.Control}"
|
||||
VerticalAlignment="Center"
|
||||
Text="{Binding FontScale, StringFormat={}{0:P0}}" />
|
||||
</StackPanel>
|
||||
</ui:CardControl>
|
||||
<ui:CardControl Margin="{DynamicResource Od.Margin.Item}" Header="{res:OdLoc Settings_Motion}">
|
||||
<ui:ToggleSwitch AutomationProperties.Name="{res:OdLoc Settings_Motion}" IsChecked="{Binding MotionEnabled}" />
|
||||
</ui:CardControl>
|
||||
<ui:CardControl Margin="{DynamicResource Od.Margin.Item}" Header="{res:OdLoc Settings_AccentSystem}">
|
||||
<ui:ToggleSwitch AutomationProperties.Name="{res:OdLoc Settings_AccentSystem}" IsChecked="{Binding UseSystemAccent}" />
|
||||
</ui:CardControl>
|
||||
<ItemsControl Margin="{DynamicResource Od.Margin.Item}"
|
||||
Focusable="False"
|
||||
ItemsSource="{Binding AccentSwatches}">
|
||||
<ItemsControl.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<StackPanel Orientation="Horizontal" />
|
||||
</ItemsPanelTemplate>
|
||||
</ItemsControl.ItemsPanel>
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Button Width="{DynamicResource Od.HitTarget.Min}"
|
||||
Height="{DynamicResource Od.HitTarget.Min}"
|
||||
Margin="{DynamicResource Od.Padding.Control}"
|
||||
AutomationProperties.Name="{Binding}"
|
||||
Background="{Binding}"
|
||||
Command="{Binding DataContext.ChooseAccentCommand, RelativeSource={RelativeSource AncestorType=UserControl}}"
|
||||
CommandParameter="{Binding}"
|
||||
ToolTip="{Binding}" />
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
</TabItem>
|
||||
|
||||
<TabItem Header="{res:OdLoc Settings_Memory}">
|
||||
<DockPanel>
|
||||
<WrapPanel Margin="{DynamicResource Od.Padding.Control}" DockPanel.Dock="Top">
|
||||
<StackPanel Margin="{DynamicResource Od.Padding.Control}">
|
||||
<TextBlock Text="{res:OdLoc Settings_IdleAfter}" />
|
||||
<ui:NumberBox Width="180"
|
||||
AutomationProperties.Name="{res:OdLoc Settings_IdleAfter}"
|
||||
MaxDecimalPlaces="0"
|
||||
Maximum="10080"
|
||||
Minimum="1"
|
||||
Value="{Binding IdleAfterMinutes}" />
|
||||
</StackPanel>
|
||||
<StackPanel Margin="{DynamicResource Od.Padding.Control}">
|
||||
<TextBlock Text="{res:OdLoc Settings_HibernateAfter}" />
|
||||
<ui:NumberBox Width="180"
|
||||
AutomationProperties.Name="{res:OdLoc Settings_HibernateAfter}"
|
||||
MaxDecimalPlaces="0"
|
||||
Maximum="10080"
|
||||
Minimum="1"
|
||||
Value="{Binding HibernateAfterMinutes}" />
|
||||
</StackPanel>
|
||||
<StackPanel Margin="{DynamicResource Od.Padding.Control}">
|
||||
<TextBlock Text="{res:OdLoc Settings_SoftCap}" />
|
||||
<ui:NumberBox Width="180"
|
||||
AutomationProperties.Name="{res:OdLoc Settings_SoftCap}"
|
||||
MaxDecimalPlaces="0"
|
||||
Minimum="0"
|
||||
Value="{Binding SoftCapMegabytes}" />
|
||||
</StackPanel>
|
||||
<StackPanel Margin="{DynamicResource Od.Padding.Control}">
|
||||
<TextBlock Text="{res:OdLoc Settings_HardCap}" />
|
||||
<ui:NumberBox Width="180"
|
||||
AutomationProperties.Name="{res:OdLoc Settings_HardCap}"
|
||||
MaxDecimalPlaces="0"
|
||||
Minimum="0"
|
||||
Value="{Binding HardCapMegabytes}" />
|
||||
</StackPanel>
|
||||
</WrapPanel>
|
||||
<shell:OdMemoryPage DataContext="{Binding Memory}" />
|
||||
</DockPanel>
|
||||
</TabItem>
|
||||
|
||||
<TabItem Header="{res:OdLoc Settings_WebApps}">
|
||||
<ScrollViewer DataContext="{Binding WebApps}" VerticalScrollBarVisibility="Auto">
|
||||
<StackPanel Margin="{DynamicResource Od.Padding.Control}">
|
||||
<TextBlock Margin="{DynamicResource Od.Margin.Item}"
|
||||
Foreground="{DynamicResource TextFillColorSecondaryBrush}"
|
||||
Text="{res:OdLoc WebApps_Intro}"
|
||||
TextWrapping="Wrap" />
|
||||
<ItemsControl Focusable="False"
|
||||
Grid.IsSharedSizeScope="True"
|
||||
ItemsSource="{Binding Apps}">
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate DataType="{x:Type settings:OdWebAppRowViewModel}">
|
||||
<ui:Card Margin="{DynamicResource Od.Margin.Item}">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" SharedSizeGroup="Reset" />
|
||||
<ColumnDefinition Width="Auto" SharedSizeGroup="Notify" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel Grid.Column="0" VerticalAlignment="Center">
|
||||
<TextBlock FontWeight="SemiBold"
|
||||
Text="{Binding Name}"
|
||||
TextTrimming="CharacterEllipsis" />
|
||||
<TextBlock Foreground="{DynamicResource TextFillColorSecondaryBrush}"
|
||||
Text="{Binding PermissionsText}"
|
||||
TextWrapping="Wrap" />
|
||||
</StackPanel>
|
||||
<ui:Button Grid.Column="1"
|
||||
Margin="{DynamicResource Od.Padding.Control}"
|
||||
VerticalAlignment="Center"
|
||||
Command="{Binding DataContext.ResetPermissionsCommand, RelativeSource={RelativeSource AncestorType=ItemsControl}}"
|
||||
CommandParameter="{Binding}"
|
||||
Content="{res:OdLoc WebApps_ResetPermissions}"
|
||||
IsEnabled="{Binding HasPermissions}" />
|
||||
<ui:ToggleSwitch Grid.Column="2"
|
||||
Margin="{DynamicResource Od.Padding.Control}"
|
||||
VerticalAlignment="Center"
|
||||
Command="{Binding DataContext.ToggleNotificationsCommand, RelativeSource={RelativeSource AncestorType=ItemsControl}}"
|
||||
CommandParameter="{Binding}"
|
||||
Content="{res:OdLoc WebApps_Notifications}"
|
||||
IsChecked="{Binding Notifications, Mode=OneWay}" />
|
||||
</Grid>
|
||||
</ui:Card>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
|
||||
<TextBlock Margin="{DynamicResource Od.Margin.Item}"
|
||||
FontSize="{DynamicResource Od.Font.H2}"
|
||||
FontWeight="SemiBold"
|
||||
Text="{res:OdLoc WebApps_DataTitle}" />
|
||||
<TextBlock Margin="{DynamicResource Od.Margin.Item}"
|
||||
Foreground="{DynamicResource TextFillColorSecondaryBrush}"
|
||||
Text="{res:OdLoc WebApps_DataIntro}"
|
||||
TextWrapping="Wrap" />
|
||||
<ItemsControl Focusable="False" ItemsSource="{Binding Profiles}">
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate DataType="{x:Type settings:OdWebProfileGroup}">
|
||||
<ui:Card Margin="{DynamicResource Od.Margin.Item}">
|
||||
<DockPanel>
|
||||
<ui:Button Margin="{DynamicResource Od.Padding.Control}"
|
||||
VerticalAlignment="Center"
|
||||
Command="{Binding DataContext.ClearDataCommand, RelativeSource={RelativeSource AncestorType=ItemsControl}}"
|
||||
CommandParameter="{Binding}"
|
||||
Content="{res:OdLoc WebApps_ClearData}"
|
||||
DockPanel.Dock="Right" />
|
||||
<TextBlock VerticalAlignment="Center"
|
||||
Text="{Binding AppNames}"
|
||||
TextWrapping="Wrap" />
|
||||
</DockPanel>
|
||||
</ui:Card>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
<TextBlock Margin="{DynamicResource Od.Padding.Control}"
|
||||
Text="{Binding Message}"
|
||||
TextWrapping="Wrap" />
|
||||
|
||||
<TextBlock Margin="{DynamicResource Od.Padding.Control}"
|
||||
Foreground="{DynamicResource TextFillColorSecondaryBrush}"
|
||||
Text="{Binding CatalogText}" />
|
||||
<TextBlock Margin="{DynamicResource Od.Padding.Control}"
|
||||
Foreground="{DynamicResource TextFillColorSecondaryBrush}"
|
||||
Text="{Binding CheckedText}" />
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
</TabItem>
|
||||
|
||||
<TabItem Header="{res:OdLoc Settings_Data}">
|
||||
<StackPanel Margin="{DynamicResource Od.Padding.Control}">
|
||||
<ui:CardControl Margin="{DynamicResource Od.Margin.Item}" Header="{res:OdLoc Settings_DataFolder}">
|
||||
<ui:Button Command="{Binding OpenDataFolderCommand}" Content="{res:OdLoc Settings_OpenDataFolder}" />
|
||||
</ui:CardControl>
|
||||
<TextBlock Margin="{DynamicResource Od.Padding.Control}"
|
||||
Foreground="{DynamicResource TextFillColorSecondaryBrush}"
|
||||
Text="{Binding DataFolder}" />
|
||||
<StackPanel Margin="{DynamicResource Od.Margin.Item}" Orientation="Horizontal">
|
||||
<ui:Button Margin="{DynamicResource Od.Padding.Control}"
|
||||
Click="OnExportClick"
|
||||
Content="{res:OdLoc Settings_Export}" />
|
||||
<ui:Button Margin="{DynamicResource Od.Padding.Control}"
|
||||
Click="OnImportClick"
|
||||
Content="{res:OdLoc Settings_Import}" />
|
||||
</StackPanel>
|
||||
<TextBlock Margin="{DynamicResource Od.Padding.Control}" Text="{Binding DataMessage}" />
|
||||
</StackPanel>
|
||||
</TabItem>
|
||||
|
||||
<TabItem Header="{res:OdLoc Settings_About}">
|
||||
<ScrollViewer VerticalScrollBarVisibility="Auto">
|
||||
<StackPanel Margin="{DynamicResource Od.Padding.Control}" DataContext="{Binding About}">
|
||||
<TextBlock FontSize="{DynamicResource Od.Font.H2}"
|
||||
FontWeight="SemiBold"
|
||||
Text="{res:OdLoc App_Name}" />
|
||||
<TextBlock Margin="{DynamicResource Od.Margin.Item}" Text="{Binding VersionText}" />
|
||||
<StackPanel Margin="{DynamicResource Od.Margin.Item}" Orientation="Horizontal">
|
||||
<ui:Button Margin="{DynamicResource Od.Padding.Control}"
|
||||
Command="{Binding CheckCommand}"
|
||||
Content="{res:OdLoc About_CheckUpdates}" />
|
||||
<ui:Button Margin="{DynamicResource Od.Padding.Control}"
|
||||
Appearance="Primary"
|
||||
Command="{Binding DownloadCommand}"
|
||||
Content="{res:OdLoc About_Download}"
|
||||
Visibility="{Binding CanDownload, Converter={StaticResource Visible}}" />
|
||||
<ui:Button Margin="{DynamicResource Od.Padding.Control}"
|
||||
Command="{Binding ReportBugCommand}"
|
||||
Content="{res:OdLoc About_ReportBug}" />
|
||||
</StackPanel>
|
||||
<TextBlock Margin="{DynamicResource Od.Margin.Item}"
|
||||
AutomationProperties.LiveSetting="Polite"
|
||||
Text="{Binding StatusText}"
|
||||
TextWrapping="Wrap" />
|
||||
<TextBlock Margin="{DynamicResource Od.Padding.Control}"
|
||||
FontWeight="SemiBold"
|
||||
Text="{res:OdLoc About_Links}" />
|
||||
<WrapPanel Margin="{DynamicResource Od.Margin.Item}">
|
||||
<ui:HyperlinkButton Command="{Binding OpenLinkCommand}"
|
||||
CommandParameter="{x:Static settings:OdAboutViewModel.Repository}"
|
||||
Content="{res:OdLoc About_GitHub}" />
|
||||
<ui:HyperlinkButton Command="{Binding OpenLinkCommand}"
|
||||
CommandParameter="{x:Static settings:OdAboutViewModel.Discussions}"
|
||||
Content="{res:OdLoc About_Discussions}" />
|
||||
<ui:HyperlinkButton Command="{Binding OpenLinkCommand}"
|
||||
CommandParameter="{x:Static settings:OdAboutViewModel.Discord}"
|
||||
Content="{res:OdLoc About_Discord}" />
|
||||
<ui:HyperlinkButton Command="{Binding ShowLegalCommand}" Content="{res:OdLoc About_Legal}" />
|
||||
</WrapPanel>
|
||||
<TextBlock Foreground="{DynamicResource TextFillColorSecondaryBrush}"
|
||||
Text="{res:OdLoc About_Credits}"
|
||||
TextWrapping="Wrap" />
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
</TabItem>
|
||||
</TabControl>
|
||||
</DockPanel>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,34 @@
|
||||
using System.Windows;
|
||||
using Microsoft.Win32;
|
||||
using OmniDeck.Core.Localization;
|
||||
|
||||
namespace OmniDeck.App.Settings;
|
||||
|
||||
/// <summary>The settings page, bound to <see cref="OdSettingsViewModel"/>; the file dialogs live here.</summary>
|
||||
public partial class OdSettingsPage
|
||||
{
|
||||
public OdSettingsPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private OdSettingsViewModel? ViewModel => DataContext as OdSettingsViewModel;
|
||||
|
||||
private void OnExportClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var dialog = new SaveFileDialog { FileName = "omnideck-settings.json", Filter = OdLocalization.Get("Settings_FileFilter") };
|
||||
if (dialog.ShowDialog(Window.GetWindow(this)) == true)
|
||||
{
|
||||
ViewModel?.ExportTo(dialog.FileName);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnImportClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var dialog = new OpenFileDialog { Filter = OdLocalization.Get("Settings_FileFilter") };
|
||||
if (dialog.ShowDialog(Window.GetWindow(this)) == true)
|
||||
{
|
||||
ViewModel?.ImportFrom(dialog.FileName);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
namespace OmniDeck.App.Settings;
|
||||
|
||||
/// <summary>The tabs of the settings page (docs/SPEC.md §2), in order.</summary>
|
||||
public enum OdSettingsSection
|
||||
{
|
||||
General,
|
||||
Appearance,
|
||||
Memory,
|
||||
WebApps,
|
||||
Data,
|
||||
About,
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
namespace OmniDeck.App.Settings;
|
||||
|
||||
/// <summary>Something asked for a settings tab, such as the palette's "Running modules".</summary>
|
||||
public sealed class OdSettingsSectionEventArgs(OdSettingsSection section) : EventArgs
|
||||
{
|
||||
public OdSettingsSection Section { get; } = section;
|
||||
}
|
||||
@@ -0,0 +1,235 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using OmniDeck.App.Shell;
|
||||
using OmniDeck.Core.Localization;
|
||||
using OmniDeck.Core.Settings;
|
||||
using OmniDeck.Core.Storage;
|
||||
|
||||
namespace OmniDeck.App.Settings;
|
||||
|
||||
/// <summary>
|
||||
/// The settings page (docs/SPEC.md §2): General, Appearance, Memory, Web apps, Data and About. Every change is
|
||||
/// saved at once through <see cref="IOdSettingsService"/>, and the page follows changes made
|
||||
/// elsewhere (the tray, an import). Used from the UI thread.
|
||||
/// </summary>
|
||||
public sealed partial class OdSettingsViewModel : ObservableObject, IDisposable
|
||||
{
|
||||
private readonly IOdSettingsService _settings;
|
||||
private readonly IOdStartupRegistration _startup;
|
||||
private readonly Action<string> _openFolder;
|
||||
private bool _loading;
|
||||
|
||||
/// <summary>The selected tab, as an <see cref="OdSettingsSection"/> index.</summary>
|
||||
[ObservableProperty]
|
||||
private int _sectionIndex;
|
||||
|
||||
[ObservableProperty]
|
||||
private string _language = "";
|
||||
|
||||
[ObservableProperty]
|
||||
private bool _closeToTray;
|
||||
|
||||
[ObservableProperty]
|
||||
private bool _startWithWindows;
|
||||
|
||||
[ObservableProperty]
|
||||
private OdThemeMode _theme;
|
||||
|
||||
[ObservableProperty]
|
||||
private string _preset = "";
|
||||
|
||||
[ObservableProperty]
|
||||
private double _fontScale = 1;
|
||||
|
||||
[ObservableProperty]
|
||||
private bool _motionEnabled;
|
||||
|
||||
[ObservableProperty]
|
||||
private bool _useSystemAccent;
|
||||
|
||||
[ObservableProperty]
|
||||
private string _accentColor = "";
|
||||
|
||||
// Doubles because WPF-UI's NumberBox edits a double?.
|
||||
[ObservableProperty]
|
||||
private double? _idleAfterMinutes;
|
||||
|
||||
[ObservableProperty]
|
||||
private double? _hibernateAfterMinutes;
|
||||
|
||||
[ObservableProperty]
|
||||
private double? _softCapMegabytes;
|
||||
|
||||
[ObservableProperty]
|
||||
private double? _hardCapMegabytes;
|
||||
|
||||
[ObservableProperty]
|
||||
private string _dataMessage = "";
|
||||
|
||||
public OdSettingsViewModel(
|
||||
IOdSettingsService settings,
|
||||
IOdStartupRegistration startup,
|
||||
OdDataRoot dataRoot,
|
||||
OdMemoryViewModel memory,
|
||||
OdWebAppsViewModel webApps,
|
||||
OdAboutViewModel about,
|
||||
Action<string> openFolder)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(settings);
|
||||
ArgumentNullException.ThrowIfNull(dataRoot);
|
||||
_settings = settings;
|
||||
_startup = startup;
|
||||
_openFolder = openFolder;
|
||||
Memory = memory;
|
||||
WebApps = webApps;
|
||||
About = about;
|
||||
DataFolder = dataRoot.Root;
|
||||
Load(settings.Current);
|
||||
settings.Changed += OnSettingsChanged;
|
||||
}
|
||||
|
||||
public IReadOnlyList<OdChoice<string>> Languages { get; } = LanguageChoices();
|
||||
|
||||
public IReadOnlyList<OdChoice<OdThemeMode>> Themes { get; } =
|
||||
[
|
||||
new(OdThemeMode.System, OdLocalization.Get("Theme_System")),
|
||||
new(OdThemeMode.Light, OdLocalization.Get("Theme_Light")),
|
||||
new(OdThemeMode.Dark, OdLocalization.Get("Theme_Dark")),
|
||||
];
|
||||
|
||||
public IReadOnlyList<OdPresetOption> Presets { get; } = OdPresetOption.All();
|
||||
|
||||
/// <summary>Accent colors to pick from when the Windows accent is not used.</summary>
|
||||
public IReadOnlyList<string> AccentSwatches { get; } = ["#0067C0", "#8764B8", "#C239B3", "#E74856", "#CA5010", "#10893E"];
|
||||
|
||||
public OdMemoryViewModel Memory { get; }
|
||||
|
||||
public OdWebAppsViewModel WebApps { get; }
|
||||
|
||||
public OdAboutViewModel About { get; }
|
||||
|
||||
public string DataFolder { get; }
|
||||
|
||||
/// <summary>The language choices: Windows' display language, then the languages OmniDeck ships.</summary>
|
||||
public static IReadOnlyList<OdChoice<string>> LanguageChoices() =>
|
||||
[
|
||||
new("", OdLocalization.Get("Language_System")),
|
||||
new("en", OdLocalization.Get("Language_English")),
|
||||
];
|
||||
|
||||
public void ShowSection(OdSettingsSection section) => SectionIndex = (int)section;
|
||||
|
||||
public void ExportTo(string path)
|
||||
{
|
||||
_settings.Export(path);
|
||||
DataMessage = OdLocalization.Get("Settings_Exported");
|
||||
}
|
||||
|
||||
public void ImportFrom(string path) =>
|
||||
DataMessage = _settings.Import(path) ? OdLocalization.Get("Settings_Imported") : OdLocalization.Get("Settings_ImportFailed");
|
||||
|
||||
public void Dispose() => _settings.Changed -= OnSettingsChanged;
|
||||
|
||||
[RelayCommand]
|
||||
private void OpenDataFolder() => _openFolder(DataFolder);
|
||||
|
||||
[RelayCommand]
|
||||
private void ChooseAccent(string color)
|
||||
{
|
||||
AccentColor = color;
|
||||
UseSystemAccent = false;
|
||||
}
|
||||
|
||||
partial void OnSectionIndexChanged(int value)
|
||||
{
|
||||
if (value == (int)OdSettingsSection.About)
|
||||
{
|
||||
_ = About.CheckOnOpenAsync();
|
||||
}
|
||||
else if (value == (int)OdSettingsSection.WebApps)
|
||||
{
|
||||
WebApps.Refresh();
|
||||
}
|
||||
}
|
||||
|
||||
partial void OnLanguageChanged(string value) => Apply(s => s with { Language = value });
|
||||
|
||||
partial void OnCloseToTrayChanged(bool value) => Apply(s => s with { CloseToTray = value });
|
||||
|
||||
partial void OnStartWithWindowsChanged(bool value)
|
||||
{
|
||||
if (!_loading)
|
||||
{
|
||||
_startup.Set(value);
|
||||
Apply(s => s with { StartWithWindows = value });
|
||||
}
|
||||
}
|
||||
|
||||
partial void OnThemeChanged(OdThemeMode value) => Apply(s => s with { Theme = value });
|
||||
|
||||
partial void OnPresetChanged(string value) => Apply(s => s with { Preset = value });
|
||||
|
||||
partial void OnFontScaleChanged(double value) => Apply(s => s with { FontScale = value });
|
||||
|
||||
partial void OnMotionEnabledChanged(bool value) => Apply(s => s with { MotionEnabled = value });
|
||||
|
||||
partial void OnUseSystemAccentChanged(bool value)
|
||||
{
|
||||
// Leaving the Windows accent keeps the color already picked, or starts from the first swatch.
|
||||
var custom = AccentColor.Length > 0 ? AccentColor : AccentSwatches[0];
|
||||
Apply(s => s with { AccentColor = value ? "" : custom });
|
||||
}
|
||||
|
||||
partial void OnAccentColorChanged(string value) => Apply(s => s with { AccentColor = UseSystemAccent ? "" : value });
|
||||
|
||||
partial void OnIdleAfterMinutesChanged(double? value) =>
|
||||
Apply(s => s with { Memory = s.Memory with { IdleAfterMinutes = WholeNumber(value, s.Memory.IdleAfterMinutes) } });
|
||||
|
||||
partial void OnHibernateAfterMinutesChanged(double? value) =>
|
||||
Apply(s => s with { Memory = s.Memory with { HibernateAfterMinutes = WholeNumber(value, s.Memory.HibernateAfterMinutes) } });
|
||||
|
||||
partial void OnSoftCapMegabytesChanged(double? value) =>
|
||||
Apply(s => s with { Memory = s.Memory with { SoftCapMegabytes = WholeNumber(value, 0) } });
|
||||
|
||||
partial void OnHardCapMegabytesChanged(double? value) =>
|
||||
Apply(s => s with { Memory = s.Memory with { HardCapMegabytes = WholeNumber(value, 0) } });
|
||||
|
||||
private static int WholeNumber(double? value, int fallback) =>
|
||||
value is { } number && double.IsFinite(number) ? (int)Math.Clamp(Math.Floor(number), 0, int.MaxValue) : fallback;
|
||||
|
||||
private void Apply(Func<OdSettings, OdSettings> change)
|
||||
{
|
||||
if (!_loading)
|
||||
{
|
||||
_settings.Update(change);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnSettingsChanged(object? sender, OdSettingsChangedEventArgs e) => Load(e.Settings);
|
||||
|
||||
/// <summary>Shows <paramref name="settings"/> without writing anything back.</summary>
|
||||
private void Load(OdSettings settings)
|
||||
{
|
||||
_loading = true;
|
||||
try
|
||||
{
|
||||
Language = settings.Language;
|
||||
CloseToTray = settings.CloseToTray;
|
||||
StartWithWindows = _startup.IsEnabled;
|
||||
Theme = settings.Theme;
|
||||
Preset = settings.Preset;
|
||||
FontScale = settings.FontScale;
|
||||
MotionEnabled = settings.MotionEnabled;
|
||||
UseSystemAccent = settings.AccentColor.Length == 0;
|
||||
AccentColor = settings.AccentColor;
|
||||
IdleAfterMinutes = settings.Memory.IdleAfterMinutes;
|
||||
HibernateAfterMinutes = settings.Memory.HibernateAfterMinutes;
|
||||
SoftCapMegabytes = settings.Memory.SoftCapMegabytes;
|
||||
HardCapMegabytes = settings.Memory.HardCapMegabytes;
|
||||
}
|
||||
finally
|
||||
{
|
||||
_loading = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using OmniDeck.Core.Localization;
|
||||
using OmniDeck.Web.Apps;
|
||||
using OmniDeck.Web.Catalog;
|
||||
|
||||
namespace OmniDeck.App.Settings;
|
||||
|
||||
/// <summary>One web app in Settings → Web apps: its notifications switch and the permissions it was answered.</summary>
|
||||
public sealed partial class OdWebAppRowViewModel(OdCatalogEntry entry) : ObservableObject
|
||||
{
|
||||
[ObservableProperty]
|
||||
private bool _notifications;
|
||||
|
||||
[ObservableProperty]
|
||||
private bool _hasPermissions;
|
||||
|
||||
[ObservableProperty]
|
||||
private string _permissionsText = "";
|
||||
|
||||
public OdCatalogEntry Entry => entry;
|
||||
|
||||
public string Name => entry.Name;
|
||||
|
||||
public void Refresh(bool notifications, IReadOnlyDictionary<string, bool> permissions)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(permissions);
|
||||
Notifications = notifications;
|
||||
HasPermissions = permissions.Count > 0;
|
||||
PermissionsText = permissions.Count == 0
|
||||
? OdLocalization.Get("WebApps_NoPermissions")
|
||||
: string.Join(" · ", permissions.OrderBy(pair => pair.Key, StringComparer.Ordinal).Select(pair => Answer(pair.Key, pair.Value)));
|
||||
}
|
||||
|
||||
public override string ToString() => Name;
|
||||
|
||||
private static string Answer(string kind, bool allowed) => allowed
|
||||
? OdLocalization.Format("WebApps_Allowed", OdWebPermissions.Name(kind))
|
||||
: OdLocalization.Format("WebApps_Blocked", OdWebPermissions.Name(kind));
|
||||
}
|
||||
@@ -0,0 +1,136 @@
|
||||
using System.Globalization;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using OmniDeck.Core.Localization;
|
||||
using OmniDeck.Core.Modules;
|
||||
using OmniDeck.Core.Settings;
|
||||
using OmniDeck.Web.Apps;
|
||||
using OmniDeck.Web.Catalog;
|
||||
using OmniDeck.Web.Diagnostics;
|
||||
using Serilog;
|
||||
|
||||
namespace OmniDeck.App.Settings;
|
||||
|
||||
/// <summary>
|
||||
/// Settings → Web apps: each catalog app's notifications switch and the permissions it was answered,
|
||||
/// the sign-in data each profile group keeps, and the catalog this session runs. Used from the UI thread.
|
||||
/// </summary>
|
||||
public sealed partial class OdWebAppsViewModel : ObservableObject, IDisposable
|
||||
{
|
||||
private readonly OdCatalogService _catalog;
|
||||
private readonly OdWebPreferences _preferences;
|
||||
private readonly IOdSettingsService _settings;
|
||||
private readonly OdModuleHost _host;
|
||||
private readonly OdSignInHealth _health;
|
||||
private readonly Func<string, Task> _clearProfile;
|
||||
private readonly Func<string, Task<bool>> _confirmClear;
|
||||
private readonly ILogger _log;
|
||||
|
||||
[ObservableProperty]
|
||||
private string _catalogText = "";
|
||||
|
||||
[ObservableProperty]
|
||||
private string _checkedText = "";
|
||||
|
||||
[ObservableProperty]
|
||||
private string _message = "";
|
||||
|
||||
/// <summary>The page over the session's catalog.</summary>
|
||||
/// <param name="catalog">The session's catalog, and when main's copy was last checked.</param>
|
||||
/// <param name="preferences">The user's choices for each app.</param>
|
||||
/// <param name="settings">Where those choices are kept, to follow changes made in the apps.</param>
|
||||
/// <param name="host">Closes a group's apps before their data is cleared.</param>
|
||||
/// <param name="health">Told that a cleared profile comes back empty on purpose.</param>
|
||||
/// <param name="clearProfile">Deletes a catalog profile's data.</param>
|
||||
/// <param name="confirmClear">Asks before clearing, with the group's app names; false to stop.</param>
|
||||
/// <param name="log">The app log.</param>
|
||||
public OdWebAppsViewModel(
|
||||
OdCatalogService catalog,
|
||||
OdWebPreferences preferences,
|
||||
IOdSettingsService settings,
|
||||
OdModuleHost host,
|
||||
OdSignInHealth health,
|
||||
Func<string, Task> clearProfile,
|
||||
Func<string, Task<bool>> confirmClear,
|
||||
ILogger log)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(catalog);
|
||||
ArgumentNullException.ThrowIfNull(settings);
|
||||
ArgumentNullException.ThrowIfNull(log);
|
||||
_catalog = catalog;
|
||||
_preferences = preferences;
|
||||
_settings = settings;
|
||||
_host = host;
|
||||
_health = health;
|
||||
_clearProfile = clearProfile;
|
||||
_confirmClear = confirmClear;
|
||||
_log = log.ForContext<OdWebAppsViewModel>();
|
||||
var apps = catalog.Current.Apps;
|
||||
Apps = [.. apps.Select(entry => new OdWebAppRowViewModel(entry))];
|
||||
Profiles =
|
||||
[
|
||||
.. apps.GroupBy(entry => entry.Profile, StringComparer.Ordinal)
|
||||
.Select(group => new OdWebProfileGroup(group.Key, [.. group.Select(entry => entry.Id)], string.Join(", ", group.Select(entry => entry.Name)))),
|
||||
];
|
||||
settings.Changed += OnSettingsChanged;
|
||||
Refresh();
|
||||
}
|
||||
|
||||
public IReadOnlyList<OdWebAppRowViewModel> Apps { get; }
|
||||
|
||||
public IReadOnlyList<OdWebProfileGroup> Profiles { get; }
|
||||
|
||||
public bool HasApps => Apps.Count > 0;
|
||||
|
||||
/// <summary>Reads the choices and the catalog check again; the settings page calls it whenever the tab opens.</summary>
|
||||
public void Refresh()
|
||||
{
|
||||
foreach (var row in Apps)
|
||||
{
|
||||
row.Refresh(_preferences.NotificationsOn(row.Entry), _preferences.Permissions(row.Entry.Id));
|
||||
}
|
||||
|
||||
CatalogText = OdLocalization.Format("WebApps_Catalog", _catalog.Current.Updated, Apps.Count);
|
||||
CheckedText = _catalog.LastChecked is { } checkedAt
|
||||
? OdLocalization.Format("WebApps_Checked", checkedAt.ToLocalTime().ToString("g", CultureInfo.CurrentCulture))
|
||||
: OdLocalization.Get("WebApps_NotChecked");
|
||||
}
|
||||
|
||||
public void Dispose() => _settings.Changed -= OnSettingsChanged;
|
||||
|
||||
[RelayCommand]
|
||||
private void ToggleNotifications(OdWebAppRowViewModel row) => _preferences.SetNotifications(row.Entry, !_preferences.NotificationsOn(row.Entry));
|
||||
|
||||
[RelayCommand]
|
||||
private void ResetPermissions(OdWebAppRowViewModel row) => _preferences.ResetPermissions(row.Entry.Id);
|
||||
|
||||
/// <summary>Signs out of every app in the group: closes them, then deletes the profile's data.</summary>
|
||||
[RelayCommand]
|
||||
private async Task ClearDataAsync(OdWebProfileGroup group)
|
||||
{
|
||||
Message = "";
|
||||
if (!await _confirmClear(group.AppNames))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
foreach (var id in group.AppIds)
|
||||
{
|
||||
await _host.CloseAsync(id);
|
||||
}
|
||||
|
||||
await _clearProfile(group.Profile);
|
||||
_health.Forget(group.Profile);
|
||||
Message = OdLocalization.Format("WebApps_Cleared", group.AppNames);
|
||||
}
|
||||
catch (Exception ex) when (ex is not OutOfMemoryException)
|
||||
{
|
||||
_log.Warning(ex, "Web profile {Profile} could not be cleared", group.Profile);
|
||||
Message = OdLocalization.Get("WebApps_ClearFailed");
|
||||
}
|
||||
}
|
||||
|
||||
private void OnSettingsChanged(object? sender, OdSettingsChangedEventArgs e) => Refresh();
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
namespace OmniDeck.App.Settings;
|
||||
|
||||
/// <summary>The web apps that share one catalog profile, and with it their sign-in data.</summary>
|
||||
/// <param name="Profile">The catalog profile.</param>
|
||||
/// <param name="AppIds">The apps' ids, in catalog order.</param>
|
||||
/// <param name="AppNames">The apps' names, as one list to show.</param>
|
||||
public sealed record OdWebProfileGroup(string Profile, IReadOnlyList<string> AppIds, string AppNames);
|
||||
@@ -0,0 +1,11 @@
|
||||
namespace OmniDeck.App.Shell;
|
||||
|
||||
/// <summary>Ends the app on purpose, as opposed to closing its window into the tray.</summary>
|
||||
public interface IOdAppLifetime
|
||||
{
|
||||
/// <summary>Set once <see cref="QuitAsync"/> starts: window closing must not turn into hiding.</summary>
|
||||
bool IsQuitting { get; }
|
||||
|
||||
/// <summary>Closes the open modules, then ends the app. Calls after the first do nothing.</summary>
|
||||
Task QuitAsync();
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
using System.Windows;
|
||||
using OmniDeck.Core.Modules;
|
||||
using OmniDeck.Web.Runtime;
|
||||
|
||||
namespace OmniDeck.App.Shell;
|
||||
|
||||
/// <summary>
|
||||
/// <see cref="IOdAppLifetime"/> over the WPF application, whose shutdown mode is explicit. The modules
|
||||
/// close before the dispatcher stops, while they can still save their state and release what they hold,
|
||||
/// and the shared WebView2 browser process gets a moment to exit and write its cookies out.
|
||||
/// </summary>
|
||||
internal sealed class OdAppLifetime(OdModuleHost host, OdWebRuntime web) : IOdAppLifetime
|
||||
{
|
||||
public bool IsQuitting { get; private set; }
|
||||
|
||||
public async Task QuitAsync()
|
||||
{
|
||||
if (IsQuitting)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
IsQuitting = true;
|
||||
await host.CloseAllAsync();
|
||||
await web.WaitForExitAsync();
|
||||
Application.Current?.Shutdown();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
using System.Collections.ObjectModel;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using OmniDeck.Core.Search;
|
||||
|
||||
namespace OmniDeck.App.Shell;
|
||||
|
||||
/// <summary>The command palette (Ctrl+K, docs/SPEC.md §2): fuzzy search over modules and shell commands.</summary>
|
||||
public sealed partial class OdCommandPaletteViewModel : ObservableObject
|
||||
{
|
||||
private readonly IReadOnlyList<OdPaletteEntry> _entries;
|
||||
|
||||
[ObservableProperty]
|
||||
private string _query = "";
|
||||
|
||||
[ObservableProperty]
|
||||
private OdPaletteEntry? _selected;
|
||||
|
||||
public OdCommandPaletteViewModel(IReadOnlyList<OdPaletteEntry> entries)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(entries);
|
||||
_entries = entries;
|
||||
Filter();
|
||||
}
|
||||
|
||||
/// <summary>Raised when the user accepts <see cref="Chosen"/>.</summary>
|
||||
public event EventHandler? Accepted;
|
||||
|
||||
public ObservableCollection<OdPaletteEntry> Results { get; } = [];
|
||||
|
||||
/// <summary>The accepted entry; <see langword="null"/> while the palette is open or after it was dismissed.</summary>
|
||||
public OdPaletteEntry? Chosen { get; private set; }
|
||||
|
||||
/// <summary>Moves the selection by <paramref name="delta"/> rows, stopping at either end.</summary>
|
||||
public void MoveSelection(int delta)
|
||||
{
|
||||
if (Results.Count == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var current = Selected is null ? -1 : Results.IndexOf(Selected);
|
||||
Selected = Results[Math.Clamp(current + delta, 0, Results.Count - 1)];
|
||||
}
|
||||
|
||||
partial void OnQueryChanged(string value) => Filter();
|
||||
|
||||
[RelayCommand]
|
||||
private void Accept()
|
||||
{
|
||||
if (Selected is null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Chosen = Selected;
|
||||
Accepted?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
|
||||
private void Filter()
|
||||
{
|
||||
Results.Clear();
|
||||
foreach (var entry in OdFuzzyMatcher.Rank(Query, _entries, entry => entry.Title))
|
||||
{
|
||||
Results.Add(entry);
|
||||
}
|
||||
|
||||
Selected = Results.Count > 0 ? Results[0] : null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
<ui:FluentWindow x:Class="OmniDeck.App.Shell.OdCommandPaletteWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:res="clr-namespace:OmniDeck.Core.Localization;assembly=OmniDeck.Core"
|
||||
xmlns:shell="clr-namespace:OmniDeck.App.Shell"
|
||||
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
|
||||
Title="{res:OdLoc Shell_Search}"
|
||||
Width="600"
|
||||
MinHeight="0"
|
||||
ExtendsContentIntoTitleBar="True"
|
||||
PreviewKeyDown="OnPreviewKeyDown"
|
||||
ResizeMode="NoResize"
|
||||
ShowInTaskbar="False"
|
||||
SizeToContent="Height"
|
||||
WindowBackdropType="Acrylic"
|
||||
WindowCornerPreference="Round"
|
||||
WindowStartupLocation="Manual">
|
||||
<!--
|
||||
A borderless overlay without a title bar: type, arrow keys, Enter; Esc or clicking away closes it.
|
||||
MinHeight 0 undoes FluentWindow's 320, so the window fits a short list of results.
|
||||
-->
|
||||
<ui:FluentWindow.Resources>
|
||||
<shell:OdSymbolConverter x:Key="Symbol" />
|
||||
</ui:FluentWindow.Resources>
|
||||
<DockPanel Margin="{DynamicResource Od.Padding.Card}">
|
||||
<ui:TextBox x:Name="SearchBox"
|
||||
AutomationProperties.Name="{res:OdLoc Shell_Search}"
|
||||
ClearButtonEnabled="True"
|
||||
DockPanel.Dock="Top"
|
||||
FontSize="{DynamicResource Od.Font.H2}"
|
||||
PlaceholderText="{res:OdLoc Shell_Search}"
|
||||
Text="{Binding Query, UpdateSourceTrigger=PropertyChanged}">
|
||||
<ui:TextBox.Icon>
|
||||
<ui:SymbolIcon Symbol="Search24" />
|
||||
</ui:TextBox.Icon>
|
||||
</ui:TextBox>
|
||||
<ListBox x:Name="ResultsList"
|
||||
MaxHeight="420"
|
||||
Margin="{DynamicResource Od.Margin.Item}"
|
||||
HorizontalContentAlignment="Stretch"
|
||||
AutomationProperties.Name="{res:OdLoc Shell_Search}"
|
||||
Background="Transparent"
|
||||
BorderThickness="0"
|
||||
ItemsSource="{Binding Results}"
|
||||
MouseDoubleClick="OnResultDoubleClick"
|
||||
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
|
||||
SelectedItem="{Binding Selected}">
|
||||
<ListBox.ItemContainerStyle>
|
||||
<Style BasedOn="{StaticResource {x:Type ListBoxItem}}" TargetType="ListBoxItem">
|
||||
<Setter Property="AutomationProperties.Name" Value="{Binding Title}" />
|
||||
</Style>
|
||||
</ListBox.ItemContainerStyle>
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate DataType="{x:Type shell:OdPaletteEntry}">
|
||||
<DockPanel>
|
||||
<ui:SymbolIcon Margin="{DynamicResource Od.Padding.Control}"
|
||||
VerticalAlignment="Center"
|
||||
DockPanel.Dock="Left"
|
||||
FontSize="{DynamicResource Od.Font.H2}"
|
||||
Symbol="{Binding Icon, Converter={StaticResource Symbol}}" />
|
||||
<StackPanel VerticalAlignment="Center">
|
||||
<TextBlock Text="{Binding Title}" TextTrimming="CharacterEllipsis" />
|
||||
<TextBlock FontSize="{DynamicResource Od.Font.Caption}"
|
||||
Foreground="{DynamicResource TextFillColorSecondaryBrush}"
|
||||
Text="{Binding Detail}"
|
||||
TextTrimming="CharacterEllipsis" />
|
||||
</StackPanel>
|
||||
</DockPanel>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
</DockPanel>
|
||||
</ui:FluentWindow>
|
||||
@@ -0,0 +1,82 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace OmniDeck.App.Shell;
|
||||
|
||||
/// <summary>The command palette overlay (Ctrl+K). After it closes, <see cref="OdCommandPaletteViewModel.Chosen"/> holds the pick.</summary>
|
||||
public partial class OdCommandPaletteWindow
|
||||
{
|
||||
// Sits near the top of its owner, where a search box is expected.
|
||||
private const double TopOffset = 72;
|
||||
|
||||
private readonly OdCommandPaletteViewModel _viewModel;
|
||||
private bool _closing;
|
||||
|
||||
public OdCommandPaletteWindow(OdCommandPaletteViewModel viewModel, Window owner)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(viewModel);
|
||||
ArgumentNullException.ThrowIfNull(owner);
|
||||
InitializeComponent();
|
||||
_viewModel = viewModel;
|
||||
DataContext = viewModel;
|
||||
Owner = owner;
|
||||
viewModel.Accepted += (_, _) => RequestClose();
|
||||
Loaded += (_, _) =>
|
||||
{
|
||||
var bounds = owner.WindowState == WindowState.Maximized ? owner.RestoreBounds : new Rect(owner.Left, owner.Top, owner.ActualWidth, owner.ActualHeight);
|
||||
Left = bounds.Left + ((bounds.Width - ActualWidth) / 2);
|
||||
Top = bounds.Top + TopOffset;
|
||||
SearchBox.Focus();
|
||||
};
|
||||
|
||||
// Clicking away closes it. Closing deactivates the window too, whoever closes it (Esc, Alt+F4,
|
||||
// the owner), so a close already under way must not be started again.
|
||||
Closing += (_, _) => _closing = true;
|
||||
Deactivated += (_, _) => RequestClose();
|
||||
}
|
||||
|
||||
private void RequestClose()
|
||||
{
|
||||
if (_closing)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_closing = true;
|
||||
Close();
|
||||
}
|
||||
|
||||
private void OnResultDoubleClick(object sender, MouseButtonEventArgs e) => _viewModel.AcceptCommand.Execute(null);
|
||||
|
||||
private void OnPreviewKeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
switch (e.Key)
|
||||
{
|
||||
case Key.Escape:
|
||||
RequestClose();
|
||||
break;
|
||||
case Key.Enter:
|
||||
_viewModel.AcceptCommand.Execute(null);
|
||||
break;
|
||||
case Key.Down:
|
||||
MoveSelection(1);
|
||||
break;
|
||||
case Key.Up:
|
||||
MoveSelection(-1);
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
e.Handled = true;
|
||||
}
|
||||
|
||||
private void MoveSelection(int delta)
|
||||
{
|
||||
_viewModel.MoveSelection(delta);
|
||||
if (_viewModel.Selected is { } selected)
|
||||
{
|
||||
ResultsList.ScrollIntoView(selected);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
using System.Windows;
|
||||
using OmniDeck.Core.Localization;
|
||||
using Wpf.Ui;
|
||||
using Wpf.Ui.Controls;
|
||||
|
||||
namespace OmniDeck.App.Shell;
|
||||
|
||||
/// <summary>
|
||||
/// In-window content dialogs, one at a time. Callers check <see cref="CanShow"/> and fall back (a
|
||||
/// message box, or a safe default) before the main window is up or while another dialog is open.
|
||||
/// </summary>
|
||||
public sealed class OdDialogs(IContentDialogService service)
|
||||
{
|
||||
private bool _hostReady;
|
||||
private int _open;
|
||||
|
||||
/// <summary>Raised when the first dialog opens and when the last one closes.</summary>
|
||||
public event EventHandler? OpenChanged;
|
||||
|
||||
/// <summary>Whether a dialog is showing.</summary>
|
||||
public bool IsOpen => _open > 0;
|
||||
|
||||
/// <summary>Whether a dialog can show now: the main window is visible and no other dialog is open.</summary>
|
||||
public bool CanShow => _hostReady && !IsOpen && Application.Current?.MainWindow is { IsVisible: true };
|
||||
|
||||
/// <summary>Called once by the main window with its dialog host.</summary>
|
||||
public void SetHost(ContentDialogHost host)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(host);
|
||||
service.SetDialogHost(host);
|
||||
_hostReady = true;
|
||||
}
|
||||
|
||||
/// <summary>Asks before something that cannot be undone; false when declined, or when no dialog can show.</summary>
|
||||
public async Task<bool> ConfirmAsync(string title, string message, string confirm)
|
||||
{
|
||||
if (!CanShow)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
var result = await ShowAsync(new ContentDialog
|
||||
{
|
||||
Title = title,
|
||||
Content = message,
|
||||
PrimaryButtonText = confirm,
|
||||
CloseButtonText = OdLocalization.Get("Dialog_Cancel"),
|
||||
DefaultButton = ContentDialogButton.Close,
|
||||
});
|
||||
return result == ContentDialogResult.Primary;
|
||||
}
|
||||
|
||||
public async Task<ContentDialogResult> ShowAsync(ContentDialog dialog)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(dialog);
|
||||
if (++_open == 1)
|
||||
{
|
||||
OpenChanged?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
return await service.ShowAsync(dialog, CancellationToken.None);
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (--_open == 0)
|
||||
{
|
||||
OpenChanged?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace OmniDeck.App.Shell;
|
||||
|
||||
/// <summary>Opens links and folders the user asked for, with the default browser or File Explorer.</summary>
|
||||
internal static class OdExternal
|
||||
{
|
||||
public static void Open(Uri uri)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(uri);
|
||||
Start(uri.AbsoluteUri);
|
||||
}
|
||||
|
||||
public static void OpenFolder(string path) => Start(path);
|
||||
|
||||
/// <summary>Opens File Explorer on the folder holding <paramref name="path"/>, with the file selected.</summary>
|
||||
public static void ShowFile(string path)
|
||||
{
|
||||
var explorer = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Windows), "explorer.exe");
|
||||
using var process = Process.Start(new ProcessStartInfo(explorer) { ArgumentList = { "/select," + path } });
|
||||
}
|
||||
|
||||
private static void Start(string target)
|
||||
{
|
||||
using var process = Process.Start(new ProcessStartInfo(target) { UseShellExecute = true });
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,116 @@
|
||||
<UserControl x:Class="OmniDeck.App.Shell.OdLibraryPage"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:res="clr-namespace:OmniDeck.Core.Localization;assembly=OmniDeck.Core"
|
||||
xmlns:shell="clr-namespace:OmniDeck.App.Shell"
|
||||
xmlns:theme="clr-namespace:OmniDeck.App.Theming"
|
||||
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
|
||||
Foreground="{DynamicResource TextFillColorPrimaryBrush}">
|
||||
<!-- The navigation view's frame does not pass the window's text color down: pages set their own. -->
|
||||
<UserControl.Resources>
|
||||
<shell:OdSymbolConverter x:Key="Symbol" />
|
||||
</UserControl.Resources>
|
||||
<ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto">
|
||||
<StackPanel Margin="{DynamicResource Od.Padding.Card}">
|
||||
<TextBlock FontSize="{DynamicResource Od.Font.H1}"
|
||||
FontWeight="SemiBold"
|
||||
Text="{res:OdLoc Shell_LibraryTitle}" />
|
||||
<TextBlock Margin="{DynamicResource Od.Margin.Item}"
|
||||
Foreground="{DynamicResource TextFillColorSecondaryBrush}"
|
||||
Text="{res:OdLoc Shell_LibraryIntro}"
|
||||
TextWrapping="Wrap" />
|
||||
<TextBlock Foreground="{DynamicResource TextFillColorTertiaryBrush}" Text="{res:OdLoc Shell_LibraryEmpty}">
|
||||
<TextBlock.Style>
|
||||
<Style BasedOn="{StaticResource {x:Type TextBlock}}" TargetType="TextBlock">
|
||||
<Setter Property="Visibility" Value="Collapsed" />
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding HasModules}" Value="False">
|
||||
<Setter Property="Visibility" Value="Visible" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</TextBlock.Style>
|
||||
</TextBlock>
|
||||
<ItemsControl Focusable="False" ItemsSource="{Binding Library}">
|
||||
<ItemsControl.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<WrapPanel />
|
||||
</ItemsPanelTemplate>
|
||||
</ItemsControl.ItemsPanel>
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate DataType="{x:Type shell:OdModuleItemViewModel}">
|
||||
<ui:Card Width="260"
|
||||
Margin="{DynamicResource Od.Margin.Tile}"
|
||||
VerticalAlignment="Stretch"
|
||||
theme:OdMotion.HoverScale="True">
|
||||
<DockPanel LastChildFill="False">
|
||||
<DockPanel DockPanel.Dock="Top">
|
||||
<ui:SymbolIcon Margin="{DynamicResource Od.Padding.Control}"
|
||||
VerticalAlignment="Center"
|
||||
DockPanel.Dock="Left"
|
||||
FontSize="{DynamicResource Od.Font.H1}"
|
||||
Symbol="{Binding Info.Icon, Converter={StaticResource Symbol}}" />
|
||||
<StackPanel VerticalAlignment="Center">
|
||||
<TextBlock FontSize="{DynamicResource Od.Font.H2}"
|
||||
FontWeight="SemiBold"
|
||||
Text="{Binding Title}"
|
||||
TextTrimming="CharacterEllipsis" />
|
||||
<TextBlock FontSize="{DynamicResource Od.Font.Caption}"
|
||||
Foreground="{DynamicResource TextFillColorSecondaryBrush}"
|
||||
Text="{Binding Category}"
|
||||
TextTrimming="CharacterEllipsis" />
|
||||
</StackPanel>
|
||||
</DockPanel>
|
||||
<StackPanel Margin="{DynamicResource Od.Padding.Control}"
|
||||
DockPanel.Dock="Bottom"
|
||||
Orientation="Horizontal">
|
||||
<ui:Button Appearance="Primary"
|
||||
Command="{Binding DataContext.OpenCommand, RelativeSource={RelativeSource AncestorType=ItemsControl}}"
|
||||
CommandParameter="{Binding}"
|
||||
Content="{res:OdLoc Shell_Open}" />
|
||||
<ui:Button Margin="{DynamicResource Od.Padding.Control}"
|
||||
Appearance="Transparent"
|
||||
AutomationProperties.Name="{res:OdLoc Shell_PopOut}"
|
||||
Command="{Binding DataContext.PopOutCommand, RelativeSource={RelativeSource AncestorType=ItemsControl}}"
|
||||
CommandParameter="{Binding}"
|
||||
ToolTip="{res:OdLoc Shell_PopOut}">
|
||||
<ui:SymbolIcon Symbol="WindowNew24" />
|
||||
</ui:Button>
|
||||
<ui:Button Margin="{DynamicResource Od.Padding.Control}"
|
||||
Appearance="Transparent"
|
||||
Command="{Binding DataContext.TogglePinCommand, RelativeSource={RelativeSource AncestorType=ItemsControl}}"
|
||||
CommandParameter="{Binding}">
|
||||
<ui:Button.Style>
|
||||
<Style BasedOn="{StaticResource {x:Type ui:Button}}" TargetType="ui:Button">
|
||||
<Setter Property="ToolTip" Value="{res:OdLoc Shell_Pin}" />
|
||||
<Setter Property="AutomationProperties.Name" Value="{res:OdLoc Shell_Pin}" />
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding IsPinned}" Value="True">
|
||||
<Setter Property="ToolTip" Value="{res:OdLoc Shell_Unpin}" />
|
||||
<Setter Property="AutomationProperties.Name" Value="{res:OdLoc Shell_Unpin}" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</ui:Button.Style>
|
||||
<ui:SymbolIcon>
|
||||
<ui:SymbolIcon.Style>
|
||||
<Style TargetType="ui:SymbolIcon">
|
||||
<Setter Property="Symbol" Value="Pin24" />
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding IsPinned}" Value="True">
|
||||
<Setter Property="Symbol" Value="PinOff24" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</ui:SymbolIcon.Style>
|
||||
</ui:SymbolIcon>
|
||||
</ui:Button>
|
||||
</StackPanel>
|
||||
</DockPanel>
|
||||
</ui:Card>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,10 @@
|
||||
namespace OmniDeck.App.Shell;
|
||||
|
||||
/// <summary>The "+" page: every module, with Open and pin buttons. Bound to <see cref="OdShellViewModel"/>.</summary>
|
||||
public partial class OdLibraryPage
|
||||
{
|
||||
public OdLibraryPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,115 @@
|
||||
<UserControl x:Class="OmniDeck.App.Shell.OdMemoryPage"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:res="clr-namespace:OmniDeck.Core.Localization;assembly=OmniDeck.Core"
|
||||
xmlns:shell="clr-namespace:OmniDeck.App.Shell"
|
||||
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
|
||||
Foreground="{DynamicResource TextFillColorPrimaryBrush}">
|
||||
<UserControl.Resources>
|
||||
<BooleanToVisibilityConverter x:Key="Visible" />
|
||||
<shell:OdSymbolConverter x:Key="Symbol" />
|
||||
</UserControl.Resources>
|
||||
<ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto">
|
||||
<StackPanel Margin="{DynamicResource Od.Padding.Card}">
|
||||
<TextBlock FontSize="{DynamicResource Od.Font.H1}"
|
||||
FontWeight="SemiBold"
|
||||
Text="{res:OdLoc Memory_Title}" />
|
||||
<TextBlock Margin="{DynamicResource Od.Margin.Item}"
|
||||
Foreground="{DynamicResource TextFillColorSecondaryBrush}"
|
||||
Text="{res:OdLoc Memory_Intro}"
|
||||
TextWrapping="Wrap" />
|
||||
<ui:Card Margin="{DynamicResource Od.Margin.Item}">
|
||||
<StackPanel>
|
||||
<TextBlock FontSize="{DynamicResource Od.Font.H2}"
|
||||
FontWeight="SemiBold"
|
||||
Text="{Binding InUseText}" />
|
||||
<TextBlock Foreground="{DynamicResource TextFillColorSecondaryBrush}" Text="{Binding LimitsText}" />
|
||||
<TextBlock FontSize="{DynamicResource Od.Font.Caption}"
|
||||
Foreground="{DynamicResource TextFillColorTertiaryBrush}"
|
||||
Text="{res:OdLoc Memory_SharedNote}"
|
||||
TextWrapping="Wrap" />
|
||||
</StackPanel>
|
||||
</ui:Card>
|
||||
<ItemsControl Focusable="False"
|
||||
Grid.IsSharedSizeScope="True"
|
||||
ItemsSource="{Binding Rows}">
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate DataType="{x:Type shell:OdMemoryRowViewModel}">
|
||||
<ui:Card Margin="{DynamicResource Od.Margin.Item}">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" SharedSizeGroup="Keep" />
|
||||
<ColumnDefinition Width="Auto" SharedSizeGroup="Actions" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<DockPanel Grid.Column="0" VerticalAlignment="Center">
|
||||
<ui:SymbolIcon Margin="{DynamicResource Od.Padding.Control}"
|
||||
DockPanel.Dock="Left"
|
||||
FontSize="{DynamicResource Od.Font.H2}"
|
||||
Symbol="{Binding Info.Icon, Converter={StaticResource Symbol}}" />
|
||||
<StackPanel VerticalAlignment="Center">
|
||||
<TextBlock FontWeight="SemiBold"
|
||||
Text="{Binding Title}"
|
||||
TextTrimming="CharacterEllipsis" />
|
||||
<WrapPanel>
|
||||
<TextBlock Margin="0,0,12,0" Text="{Binding StateText}" />
|
||||
<TextBlock Margin="0,0,12,0"
|
||||
Foreground="{DynamicResource TextFillColorSecondaryBrush}"
|
||||
Text="{Binding LastUsedText}" />
|
||||
<TextBlock Foreground="{DynamicResource TextFillColorSecondaryBrush}" Text="{Binding MemoryText}" />
|
||||
</WrapPanel>
|
||||
</StackPanel>
|
||||
</DockPanel>
|
||||
<ui:ToggleSwitch Grid.Column="1"
|
||||
Margin="{DynamicResource Od.Padding.Control}"
|
||||
VerticalAlignment="Center"
|
||||
Command="{Binding DataContext.ToggleKeepRunningCommand, RelativeSource={RelativeSource AncestorType=ItemsControl}}"
|
||||
CommandParameter="{Binding}"
|
||||
Content="{res:OdLoc Memory_KeepRunning}"
|
||||
IsChecked="{Binding KeepRunning, Mode=OneWay}" />
|
||||
<StackPanel Grid.Column="2"
|
||||
VerticalAlignment="Center"
|
||||
Orientation="Horizontal">
|
||||
<ui:Button Margin="{DynamicResource Od.Padding.Control}"
|
||||
Command="{Binding DataContext.SuspendCommand, RelativeSource={RelativeSource AncestorType=ItemsControl}}"
|
||||
CommandParameter="{Binding}"
|
||||
Content="{res:OdLoc Memory_Suspend}"
|
||||
IsEnabled="{Binding CanSuspend}" />
|
||||
<ui:Button Margin="{DynamicResource Od.Padding.Control}"
|
||||
Command="{Binding DataContext.HibernateCommand, RelativeSource={RelativeSource AncestorType=ItemsControl}}"
|
||||
CommandParameter="{Binding}"
|
||||
Content="{res:OdLoc Memory_Hibernate}"
|
||||
IsEnabled="{Binding CanHibernate}" />
|
||||
<ui:Button Margin="{DynamicResource Od.Padding.Control}"
|
||||
Command="{Binding DataContext.CloseCommand, RelativeSource={RelativeSource AncestorType=ItemsControl}}"
|
||||
CommandParameter="{Binding}"
|
||||
Content="{res:OdLoc Shell_Close}"
|
||||
IsEnabled="{Binding CanClose}" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</ui:Card>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
<ui:Card Margin="{DynamicResource Od.Margin.Item}" Visibility="{Binding HasShared, Converter={StaticResource Visible}}">
|
||||
<DockPanel>
|
||||
<TextBlock Margin="{DynamicResource Od.Padding.Control}"
|
||||
VerticalAlignment="Center"
|
||||
DockPanel.Dock="Right"
|
||||
FontWeight="SemiBold"
|
||||
Text="{Binding SharedText}" />
|
||||
<ui:SymbolIcon Margin="{DynamicResource Od.Padding.Control}"
|
||||
DockPanel.Dock="Left"
|
||||
FontSize="{DynamicResource Od.Font.H2}"
|
||||
Symbol="Globe24" />
|
||||
<StackPanel VerticalAlignment="Center">
|
||||
<TextBlock FontWeight="SemiBold" Text="{res:OdLoc Memory_SharedTitle}" />
|
||||
<TextBlock Foreground="{DynamicResource TextFillColorSecondaryBrush}"
|
||||
Text="{res:OdLoc Memory_SharedDescription}"
|
||||
TextWrapping="Wrap" />
|
||||
</StackPanel>
|
||||
</DockPanel>
|
||||
</ui:Card>
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,13 @@
|
||||
namespace OmniDeck.App.Shell;
|
||||
|
||||
/// <summary>
|
||||
/// The task-manager panel, bound to <see cref="OdMemoryViewModel"/>, shown in Settings → Memory
|
||||
/// (docs/RAM-GOVERNOR.md §5).
|
||||
/// </summary>
|
||||
public partial class OdMemoryPage
|
||||
{
|
||||
public OdMemoryPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using OmniDeck.Core.Governor;
|
||||
using OmniDeck.Core.Localization;
|
||||
using OmniDeck.Core.Modules;
|
||||
|
||||
namespace OmniDeck.App.Shell;
|
||||
|
||||
/// <summary>One module in the task-manager panel (docs/RAM-GOVERNOR.md §5).</summary>
|
||||
public sealed partial class OdMemoryRowViewModel(OdHostedModule hosted) : ObservableObject
|
||||
{
|
||||
[ObservableProperty]
|
||||
private string _stateText = "";
|
||||
|
||||
[ObservableProperty]
|
||||
private string _lastUsedText = "";
|
||||
|
||||
[ObservableProperty]
|
||||
private string _memoryText = "";
|
||||
|
||||
[ObservableProperty]
|
||||
private bool _keepRunning;
|
||||
|
||||
[ObservableProperty]
|
||||
private bool _canSuspend;
|
||||
|
||||
[ObservableProperty]
|
||||
private bool _canHibernate;
|
||||
|
||||
[ObservableProperty]
|
||||
private bool _canClose;
|
||||
|
||||
public OdModuleInfo Info => hosted.Info;
|
||||
|
||||
public string Id => hosted.Info.Id;
|
||||
|
||||
public string Title => hosted.Info.Title;
|
||||
|
||||
/// <summary>
|
||||
/// Re-reads the module's state; <paramref name="now"/> dates the last-used text, and
|
||||
/// <paramref name="bytes"/> is the module's own memory, for one that runs processes of its own.
|
||||
/// </summary>
|
||||
public void Refresh(DateTimeOffset now, bool keepRunning, long? bytes = null)
|
||||
{
|
||||
var state = hosted.State;
|
||||
StateText = OdLocalization.Get("State_" + state);
|
||||
LastUsedText = LastUsed(state, now - hosted.LastActive);
|
||||
MemoryText = bytes is { } own ? OdBytes.Format(own) : "";
|
||||
KeepRunning = keepRunning;
|
||||
CanSuspend = state == OdModuleState.Idle;
|
||||
CanHibernate = state is OdModuleState.Idle or OdModuleState.Suspended;
|
||||
CanClose = state is not (OdModuleState.Created or OdModuleState.Closed);
|
||||
OnPropertyChanged(nameof(Title));
|
||||
}
|
||||
|
||||
public override string ToString() => Title;
|
||||
|
||||
private static string LastUsed(OdModuleState state, TimeSpan hiddenFor) => state switch
|
||||
{
|
||||
OdModuleState.Created => "",
|
||||
OdModuleState.Active => OdLocalization.Get("Memory_UsedNow"),
|
||||
_ when hiddenFor < TimeSpan.FromMinutes(1) => OdLocalization.Get("Memory_UsedJustNow"),
|
||||
_ when hiddenFor < TimeSpan.FromHours(1) => OdLocalization.Format("Memory_UsedMinutesAgo", (int)hiddenFor.TotalMinutes),
|
||||
_ => OdLocalization.Format("Memory_UsedHoursAgo", (int)hiddenFor.TotalHours),
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using OmniDeck.Core.Governor;
|
||||
using OmniDeck.Core.Localization;
|
||||
using OmniDeck.Core.Modules;
|
||||
using OmniDeck.Core.Settings;
|
||||
|
||||
namespace OmniDeck.App.Shell;
|
||||
|
||||
/// <summary>
|
||||
/// The task-manager panel (docs/RAM-GOVERNOR.md §5): every module with its state and last use, the
|
||||
/// memory OmniDeck uses against its limits, and the governor's own Suspend, Hibernate, Close and
|
||||
/// keep-running controls. It acts through the governor, never around it. Used from the UI thread.
|
||||
/// </summary>
|
||||
public sealed partial class OdMemoryViewModel : ObservableObject, IDisposable
|
||||
{
|
||||
private readonly OdModuleHost _host;
|
||||
private readonly OdRamGovernor _governor;
|
||||
private readonly IOdSettingsService _settings;
|
||||
private readonly TimeProvider _time;
|
||||
|
||||
[ObservableProperty]
|
||||
private string _inUseText = "";
|
||||
|
||||
[ObservableProperty]
|
||||
private string _limitsText = "";
|
||||
|
||||
[ObservableProperty]
|
||||
private string _sharedText = "";
|
||||
|
||||
[ObservableProperty]
|
||||
private bool _hasShared;
|
||||
|
||||
public OdMemoryViewModel(OdModuleHost host, OdRamGovernor governor, IOdSettingsService settings, TimeProvider time)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(host);
|
||||
ArgumentNullException.ThrowIfNull(governor);
|
||||
ArgumentNullException.ThrowIfNull(settings);
|
||||
_host = host;
|
||||
_governor = governor;
|
||||
_settings = settings;
|
||||
_time = time;
|
||||
Rows = [.. host.Modules.Select(hosted => new OdMemoryRowViewModel(hosted))];
|
||||
host.StateChanged += OnModuleStateChanged;
|
||||
governor.Sampled += OnSampled;
|
||||
settings.Changed += OnSettingsChanged;
|
||||
OdLocalization.Instance.CultureChanged += OnCultureChanged;
|
||||
Refresh();
|
||||
}
|
||||
|
||||
public IReadOnlyList<OdMemoryRowViewModel> Rows { get; }
|
||||
|
||||
public bool HasModules => Rows.Count > 0;
|
||||
|
||||
public void Refresh()
|
||||
{
|
||||
var now = _time.GetUtcNow();
|
||||
var snapshot = _governor.Snapshot;
|
||||
foreach (var row in Rows)
|
||||
{
|
||||
row.Refresh(now, _governor.IsKeptRunning(row.Id), snapshot?.For(row.Id));
|
||||
}
|
||||
|
||||
HasShared = snapshot is { SharedBytes: > 0 };
|
||||
SharedText = snapshot is { SharedBytes: > 0 and var shared } ? OdBytes.Format(shared) : "";
|
||||
|
||||
var options = _governor.Options;
|
||||
InUseText = OdLocalization.Format("Memory_InUse", OdBytes.Format(_governor.CommittedBytes));
|
||||
LimitsText = OdLocalization.Format("Memory_Limits", OdBytes.Format(options.SoftCapBytes), OdBytes.Format(options.HardCapBytes));
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_host.StateChanged -= OnModuleStateChanged;
|
||||
_governor.Sampled -= OnSampled;
|
||||
_settings.Changed -= OnSettingsChanged;
|
||||
OdLocalization.Instance.CultureChanged -= OnCultureChanged;
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
private Task SuspendAsync(OdMemoryRowViewModel row) => _governor.SuspendAsync(row.Id);
|
||||
|
||||
[RelayCommand]
|
||||
private Task HibernateAsync(OdMemoryRowViewModel row) => _governor.HibernateAsync(row.Id);
|
||||
|
||||
[RelayCommand]
|
||||
private Task CloseAsync(OdMemoryRowViewModel row) => _governor.CloseAsync(row.Id);
|
||||
|
||||
[RelayCommand]
|
||||
private void ToggleKeepRunning(OdMemoryRowViewModel row) => _governor.SetKeptRunning(row.Id, !_governor.IsKeptRunning(row.Id));
|
||||
|
||||
private void OnModuleStateChanged(object? sender, OdModuleStateChangedEventArgs e) => Refresh();
|
||||
|
||||
private void OnSampled(object? sender, OdGovernorSampledEventArgs e) => Refresh();
|
||||
|
||||
private void OnSettingsChanged(object? sender, OdSettingsChangedEventArgs e) => Refresh();
|
||||
|
||||
private void OnCultureChanged(object? sender, EventArgs e) => Refresh();
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using OmniDeck.Core.Localization;
|
||||
using OmniDeck.Core.Modules;
|
||||
|
||||
namespace OmniDeck.App.Shell;
|
||||
|
||||
/// <summary>A module as the sidebar, the library and the palette show it.</summary>
|
||||
public sealed partial class OdModuleItemViewModel(OdModuleInfo info) : ObservableObject
|
||||
{
|
||||
[ObservableProperty]
|
||||
private bool _isPinned;
|
||||
|
||||
/// <summary>Shown in a window of its own rather than in the main window.</summary>
|
||||
[ObservableProperty]
|
||||
private bool _isPoppedOut;
|
||||
|
||||
[ObservableProperty]
|
||||
[NotifyPropertyChangedFor(nameof(IsOpen))]
|
||||
private OdModuleState _state = OdModuleState.Created;
|
||||
|
||||
public OdModuleInfo Info { get; } = info;
|
||||
|
||||
public string Id => Info.Id;
|
||||
|
||||
public string Title => Info.Title;
|
||||
|
||||
public string Category => OdLocalization.Get(Info.CategoryKey);
|
||||
|
||||
/// <summary>Opened and not closed since: it keeps a sidebar entry even when unpinned, like a tab.</summary>
|
||||
public bool IsOpen => State is not (OdModuleState.Created or OdModuleState.Closed);
|
||||
|
||||
/// <summary>The name screen readers announce for the module's library tile and palette row.</summary>
|
||||
public override string ToString() => Title;
|
||||
|
||||
/// <summary>Re-reads the localized texts after a language change.</summary>
|
||||
public void RefreshTexts()
|
||||
{
|
||||
OnPropertyChanged(nameof(Title));
|
||||
OnPropertyChanged(nameof(Category));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
<ContentControl x:Class="OmniDeck.App.Shell.OdModuleStage"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
HorizontalContentAlignment="Stretch"
|
||||
VerticalContentAlignment="Stretch"
|
||||
Content="{Binding CurrentView}"
|
||||
Focusable="False"
|
||||
Foreground="{DynamicResource TextFillColorPrimaryBrush}" />
|
||||
@@ -0,0 +1,13 @@
|
||||
namespace OmniDeck.App.Shell;
|
||||
|
||||
/// <summary>
|
||||
/// The one page every module item navigates to: it shows <see cref="OdShellViewModel.CurrentView"/>,
|
||||
/// so the navigation view never creates, caches or keeps a module view (docs/WPFUI-CONVENTIONS.md §5).
|
||||
/// </summary>
|
||||
public partial class OdModuleStage
|
||||
{
|
||||
public OdModuleStage()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
namespace OmniDeck.App.Shell;
|
||||
|
||||
/// <summary>A notification was clicked; <see cref="Target"/> is what it opens, or null for just the window.</summary>
|
||||
public sealed class OdNotificationClickedEventArgs(string? target) : EventArgs
|
||||
{
|
||||
public string? Target { get; } = target;
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
namespace OmniDeck.App.Shell;
|
||||
|
||||
/// <summary>One command palette result: a module to open, or a shell command.</summary>
|
||||
/// <param name="Title">What the palette matches and shows.</param>
|
||||
/// <param name="Detail">The second line: the module's category, or "Command".</param>
|
||||
/// <param name="Icon">A WPF-UI <c>SymbolRegular</c> name.</param>
|
||||
/// <param name="RunAsync">What choosing the entry does.</param>
|
||||
public sealed record OdPaletteEntry(string Title, string Detail, string Icon, Func<Task> RunAsync);
|
||||
@@ -0,0 +1,6 @@
|
||||
using System.Windows;
|
||||
|
||||
namespace OmniDeck.App.Shell;
|
||||
|
||||
/// <summary>How the navigation pane looked before full screen folded it away.</summary>
|
||||
internal sealed record OdPanePlacement(double OpenLength, double CompactLength, bool ToggleVisible, Thickness FrameMargin);
|
||||
@@ -0,0 +1,12 @@
|
||||
using System.Windows;
|
||||
|
||||
namespace OmniDeck.App.Shell;
|
||||
|
||||
/// <summary>A module's own window, to open with the module's view, bring to the front, or close.</summary>
|
||||
public sealed class OdPopOutEventArgs(OdModuleItemViewModel item, FrameworkElement? view = null) : EventArgs
|
||||
{
|
||||
public OdModuleItemViewModel Item { get; } = item;
|
||||
|
||||
/// <summary>The module's view, for a window that opens; null otherwise.</summary>
|
||||
public FrameworkElement? View { get; } = view;
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<ui:FluentWindow x:Class="OmniDeck.App.Shell.OdPopOutWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
|
||||
Width="960"
|
||||
Height="640"
|
||||
MinWidth="480"
|
||||
MinHeight="320"
|
||||
ExtendsContentIntoTitleBar="True"
|
||||
PreviewKeyDown="OnPreviewKeyDown"
|
||||
WindowBackdropType="Mica">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<ui:TitleBar x:Name="PopOutTitleBar" Grid.Row="0" />
|
||||
<!-- The module's view, as on the main window's stage. -->
|
||||
<ContentControl x:Name="Stage"
|
||||
Grid.Row="1"
|
||||
HorizontalContentAlignment="Stretch"
|
||||
VerticalContentAlignment="Stretch"
|
||||
Focusable="False"
|
||||
Foreground="{DynamicResource TextFillColorPrimaryBrush}" />
|
||||
</Grid>
|
||||
</ui:FluentWindow>
|
||||
Loaded 100 of 377 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user