Compare commits

...
Author SHA1 Message Date
poli0981 7af21aab09 Merge remote-tracking branch 'origin/main' into chore/dev-data-root 2026-11-03 11:05:13 +07:00
poli0981 e5f2835229 Merge pull request #43 from poli0981/feat/catalog-c2
feat(catalog): Spotify's third-party sign-in hops, and audioPin for calls
2026-11-03 10:53:27 +07:00
poli0981andClaude Opus 5.5 76b27e86ed chore: a development build can use a data root of its own
A Debug build reads OMNIDECK_DATA_ROOT and, when it is set, keeps its
settings, database, web sign-ins and logs there, under a single-instance
name of its own, so it runs beside an installed OmniDeck without touching
that copy's data. Release builds never read the variable.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 10:52:59 +07:00
poli0981 66812dc467 Merge remote-tracking branch 'origin/main' into feat/catalog-c2 2026-11-03 10:49:02 +07:00
poli0981 e82507db2d Merge pull request #53 from poli0981/dependabot/nuget/build-tooling-f93e7cef44
deps: Bump the build-tooling group with 1 update
2026-11-03 10:48:20 +07:00
dependabot[bot] 14f9e63f12 deps: Bump the build-tooling group with 1 update
Bumps Meziantou.Analyzer from 3.0.317 to 3.0.318

---
updated-dependencies:
- dependency-name: Meziantou.Analyzer
  dependency-version: 3.0.318
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: build-tooling
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-11-02 19:19:37 +00:00
poli0981 e279e94056 Merge branch 'main' into feat/catalog-c2 2026-11-02 13:03:35 +07:00
poli0981 d33d6fa442 Merge pull request #52 from poli0981/release/0.2.0-alpha.3
chore: release 0.2.0-alpha.3
2026-11-02 12:54:09 +07:00
poli0981andClaude Opus 5.5 a36c846271 chore: release 0.2.0-alpha.3
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 12:49:27 +07:00
poli0981 5c769ae082 Merge pull request #51 from poli0981/feat/p2-polish
feat: P2 polish: app icon, Play/Pause state, docs re-baselined
2026-11-02 12:48:57 +07:00
poli0981 e7acfef005 Merge remote-tracking branch 'origin/main' into feat/p2-polish 2026-11-02 12:42:37 +07:00
poli0981andClaude Opus 5.5 60a57b23e0 docs: re-baseline on what P2 built, and record the resource soak
ROADMAP: P2 started on 2 November 2026, as soon as P1 was done; what it
delivered so far, what changed on the way and what was left for later.
Settings import/export shipped in P1, so it leaves P3's list.

README, SPEC, ARCHITECTURE and CONTRIBUTING now describe P2 as built:
pop-out windows, web notifications, permission questions, downloads,
the bug report's flow and contents, Spotify's DRM and Discord's hotkey.

RAM-GOVERNOR: a soak of 21 pop-out and 21 page full-screen round trips
left GDI and USER objects and handles flat.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 12:42:36 +07:00
poli0981andClaude Opus 5.5 5f1a965153 feat: an application icon, and a Play/Pause button that shows which
OmniDeck had no icon of its own: the executable, its windows, the
taskbar and Velopack's Setup showed defaults. scripts/make-icon.ps1 draws
the monogram the tray icon uses, a bold "O" on Windows' default accent
blue, at the sizes Windows asks for, into Assets/OmniDeck.ico. The
executable carries it (WPF windows take it from there) and vpk pack gets
it with --icon. It stands in until a designed icon replaces the file.

The media player's Play/Pause button always showed Play; it now shows
Pause while playing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 12:32:38 +07:00
poli0981 b5c629907b Merge pull request #50 from poli0981/fix/p2-media-controls
fix: the media control bar keeps its seek bar and buttons when narrow
2026-11-02 12:30:28 +07:00
poli0981 c3a79402b8 Merge remote-tracking branch 'origin/main' into fix/p2-media-controls 2026-11-02 12:26:25 +07:00
poli0981andClaude Opus 5.5 0c9912cc53 fix: the media control bar keeps its seek bar and buttons when narrow
The bar was one row: beside the queue, at the window's default size, the
seek bar shrank to almost nothing and the queue button was cut off. The
title, time and seek bar now have rows of their own above the buttons, and
the volume slider shrinks before anything is cut off. WPF-UI's Slider style
asks for 104 px, so the volume slider sets MinWidth="0" and its column
decides.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 12:26:09 +07:00
poli0981 39019f4fb3 Merge pull request #49 from poli0981/feat/p2-pop-out
feat: pop-out windows, and web full screen
2026-11-02 12:24:41 +07:00
poli0981andClaude Opus 5.5 9b8086d925 docs: changelog for pop-out windows and web full screen
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 12:19:36 +07:00
poli0981 8f7a94973f Merge remote-tracking branch 'origin/main' into feat/p2-pop-out 2026-11-02 12:19:22 +07:00
poli0981andClaude Opus 5.5 1d4babcd41 feat: pop-out windows for modules
Any module can move into a window of its own, from its sidebar menu or
its library tile. The host keeps it active there, out of the governor's
reach, beside whatever the main window shows; asking for it again brings
its window up. Closing the window docks the module back, hidden, and
"Return to main window" shows it in the main window.

The view itself moves, so WPF re-parents a web app's browser and a
video's window: both keep running, without spike #6's track re-selection
and seek. The window lets go of the view before it closes and hands the
windows it owns to the main window, since LibVLCSharp's overlay would
otherwise close for good with it. Pop-outs have their own full screen.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 12:19:21 +07:00
poli0981 c21621403b Merge pull request #48 from poli0981/release/0.2.0-alpha.2
chore: release 0.2.0-alpha.2
2026-11-02 12:03:40 +07:00
poli0981andClaude Opus 5.5 311cdf641b chore: release 0.2.0-alpha.2
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 11:59:45 +07:00
poli0981andClaude Opus 5.5 4925eee1fd feat: a web page's full screen takes the window with it
A page that shows something full screen (a video, say) asks the window
for full screen through OdFullscreen, as the media player does; when the
window leaves first (Esc, another module), the page is told to leave too.

The window cover moves out of the main window into OdWindowCover, with
tests, so pop-out windows can use it next. In full screen the frame now
overlaps the pixels the folded pane's template still keeps, so the module
fills the monitor exactly instead of starting 9 px from the left edge.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 11:59:20 +07:00
poli0981 e2e94c6f5c Merge branch 'main' into feat/catalog-c2 2026-11-02 11:51:25 +07:00
poli0981 6467c87982 Merge pull request #47 from poli0981/feat/p2-media-fullscreen
feat: media full screen and tray controls
2026-11-02 11:46:16 +07:00
poli0981 966e1fb23f Merge remote-tracking branch 'origin/main' into feat/p2-media-fullscreen 2026-11-02 11:41:15 +07:00
poli0981andClaude Opus 5.5 e8ea8aa925 feat: media full screen and tray controls
- OdFullscreen (Core): a view asks for full screen with a bubbling routed
  event raised from itself (its video overlay is a window of its own) and
  learns the answer through an inherited attached property on the stage.
- The main window covers its monitor (OdMonitors, LibraryImport), hides
  the title bar, unlinks it from the navigation view and folds the pane
  to zero width; changing the pane mode would re-template the view and
  re-create the player's video window. Esc, hiding to the tray or showing
  another module ends it.
- The media overlay: a full-screen button, double-click on the picture
  (the overlay is alpha 1 over a picture, so clicks reach it) and Esc;
  the queue steps aside meanwhile.
- IOdMediaControls: while a player has a file loaded, the tray menu shows
  it with Play/Pause, Next and Previous.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 11:40:33 +07:00
poli0981 f52965cdde Merge pull request #46 from poli0981/feat/p2-media-options
feat: media player options: tracks, subtitles, speed, device, snapshot
2026-11-02 11:33:41 +07:00
poli0981andClaude Opus 5.5 5491f6594f feat: media player options: tracks, subtitles, speed, device, snapshot
The overlay's More menu, built when it opens from the file playing:
- audio and subtitle tracks, and a subtitle file (kept if the file
  reopens, dropped when the next file starts);
- the subtitles' encoding (Automatic, UTF-8, common code pages): libVLC
  reads subsdec-encoding only when a file opens, so a new choice reopens
  the file where it stood;
- speed 0.25x to 4x, put back on each file since libVLC starts each at
  normal speed;
- the audio device, without libVLC's own id-less "Default" next to
  "Windows default";
- a snapshot of the picture in Pictures\OmniDeck, named after the file.
Speed, encoding and device are kept in the module's settings.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 11:29:12 +07:00
poli0981 e52b4d679c Merge pull request #45 from poli0981/ci/sonar-native-wrappers
ci: leave the native-engine wrappers out of Sonar coverage
2026-11-02 11:18:25 +07:00
poli0981 763cc93de0 Merge remote-tracking branch 'origin/main' into ci/sonar-native-wrappers 2026-11-02 11:13:29 +07:00
poli0981 be89c978a6 Merge pull request #44 from poli0981/feat/p2-media
feat: add the media player, first part
2026-11-02 11:13:10 +07:00
poli0981andClaude Opus 5.5 16d6e64b0c ci: leave the native-engine wrappers out of Sonar coverage
OdWebRuntime wraps the WebView2 runtime and OdVlcEngine/OdVlcPlayer wrap
libVLC; like the views, they only run against engines CI does not load,
which kept PRs #38 and #39 just under the 80 % new-code coverage gate
(77.3 % and 76.6 %, no issues). The logic around them stays covered, and
the memory reporter's path before any web app opens gets a test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 11:11:53 +07:00
poli0981andClaude Opus 5.5 6b898994a3 feat: add the media player, first part
- OdMediaModule (Heavy): local audio and video through LibVLCSharp 3.10.2
  and libVLC 3.0.24. libVLC starts with the first file played.
- Files, folders and .m3u playlists from the buttons or dropped on the
  player; the queue can be saved as .m3u. The queue and where playback
  stood live in media_playlists (migration 0005) and survive restarts.
- Pinned while playing; suspending lets the player go and keeps the
  position, hibernating lets libVLC go too (spike #6: 280-520 MB).
- libVLC events are posted to the UI thread; only its errors reach the
  log, as warnings, less the three known harmless messages.
- The overlay covers libVLC's blank video window until a picture plays.
- Packaging: x64 only, the SPEC plugin folders without the network access
  plugins (about 80 MB raw) in libvlc\win-x64.
- Third-party notices: LibVLCSharp and libVLC move to bundled, with the
  LGPL-2.1 and GPL-2.0 texts (pre-approved P2 entries).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 11:08:27 +07:00
poli0981andClaude Opus 5.5 fbc2a3c2b6 feat(catalog): Spotify's third-party sign-in hops, and audioPin for calls
- spotify: "Continue with Google / Facebook / Apple" are links to
  accounts.spotify.com/login/<provider>, which redirect the main frame to
  accounts.google.com, www.facebook.com and appleid.apple.com and back.
  The entry lists those hosts and the google-account-domains set (Google's
  SetSID hops), so sign-in no longer leaves for the default browser.
- discord and facebook: audioPin true, so a call that is playing audio is
  never suspended; review rule 5 now allows calls.
- updated: 2026-11-03, so installed 0.2.0-alpha.1 copies, which ship the
  2026-11-02 catalog, take this one at their next daily check.
- Tests follow the catalog's own date and cover the new hosts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 10:52:05 +07:00
poli0981 df161596f8 Merge pull request #42 from poli0981/feat/p2-bug-report
feat: report a bug from About or the error dialog
2026-11-02 10:47:38 +07:00
poli0981andClaude Opus 5.5 48ba07c2ad feat: report a bug from About or the error dialog
- OdScrubber (Core, pure): the user's profile folder, URL queries and
  fragments, cookie values, bearer tokens, JWTs, long hex and base64 runs,
  email addresses and numeric ids of 15+ digits come out of every file.
- OdBugReporter composes the report: version and commit, Windows build,
  preset, modules with state, hidden time and memory, the last 500 log
  lines, sign-in cookie counts, and a web app's console.
- The dialog previews issue.md and lets the user pick the subject. Save
  writes reports\bugreport-<stamp>.zip (ten kept), shows it in Explorer
  and opens the bug form with only the short fields in its query.
- The error dialog gains Report bug, which passes in the error shown.
- While any dialog is open the main window hides the module stage, since a
  web app's native browser window would cover the dialog.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 10:43:53 +07:00
poli0981 7e6d0f474a Merge pull request #41 from poli0981/release/0.2.0-alpha.1
release: 0.2.0-alpha.1
2026-11-02 10:39:00 +07:00
poli0981andClaude Opus 5.5 a0b473459c release: 0.2.0-alpha.1
First P2 alpha: the catalog's web apps on WebView2, with notifications,
site permissions and memory figures, plus Weather and Calendar.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 10:34:43 +07:00
poli0981 4d24d2243c Merge pull request #40 from poli0981/feat/p2-web-notifications
feat: web app notifications, permission questions and Settings > Web apps
2026-11-02 10:34:08 +07:00
poli0981andClaude Opus 5.5 779cb13002 feat: web app notifications, permission questions and Settings > Web apps
- Notifications: NotificationReceived is always handled. When the app's
  switch is on (default: the catalog's flag), it becomes a tray
  notification "App: title" with the body below, cut to what a balloon
  holds. ReportShown follows; a click opens the app and reports
  ReportClicked to the page. OdNotification gains a Clicked callback the
  tray runs after opening the target.
- Residency: an app with notifications on stays live while hidden.
- Permissions: device and data kinds are asked once per app in a bar above
  the browser (no content dialog can cover WebView2) and kept in
  settings.json (web.apps.<id>.permissions); SavesInProfile is off.
  Autoplay and persistent storage are left to the browser, the rest is
  refused.
- Settings > Web apps: notification switches, answered permissions with
  Ask again, Clear data per profile group (closes the apps, clears the
  profile through a hidden browser, resets sign-in health), and the
  catalog's date and last check.
- Downloads keep WebView2's own flyout (SmartScreen, dangerous files).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 10:29:58 +07:00
poli0981 1a2b41be40 Merge pull request #39 from poli0981/feat/p2-web-governor
feat: count the web apps' processes in the RAM governor
2026-11-02 10:09:50 +07:00
poli0981andClaude Opus 5.5 cdf8b1f004 feat: count the web apps' processes in the RAM governor
The governor now measures OmniDeck's own process plus whatever the memory
reporters follow. The web runner reports every WebView2 process: renderers
go to the app whose page they host (main frame id, else a host only one
app shows), and the browser, GPU and utility processes are shared.

- Victims: resident modules last, then least recently used, Heavy first,
  then the module that uses more.
- A hibernated web app counts as gone in the same pass (and the shared
  processes with the last one); the next pass measures again.
- When the shell, the shared processes and the web apps that stay are
  above the hard cap on their own, it warns instead of hibernating.
- IOdResidency: modules that work while hidden skip the time ladder; the
  caps take them last and say so with a notification that reopens them.
- Settings > Memory shows each web app's figure and a shared row.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 10:05:05 +07:00
poli0981 6edea9bb01 Merge pull request #38 from poli0981/feat/p2-web-runner
feat: run the catalog's web apps in WebView2
2026-11-02 09:52:21 +07:00
poli0981 5b46489596 Merge pull request #37 from poli0981/feat/p2-catalog-runtime
feat: load the web-app catalog and check main's copy daily
2026-11-02 09:50:41 +07:00
poli0981 176cf3cf4a Merge branch 'feat/p2-catalog-runtime' into feat/p2-web-runner 2026-11-02 09:47:10 +07:00
poli0981 3a609e88c3 Merge remote-tracking branch 'origin/main' into feat/p2-catalog-runtime 2026-11-02 09:46:34 +07:00
poli0981andClaude Opus 5.5 677e58f5c2 feat: run the catalog's web apps in WebView2
Every catalog entry becomes a Heavy module hosted in one shared WebView2
environment, one profile per catalog profile.

- Navigation policy: main frame stays on navAllow and its named sets over
  HTTPS; web and mail links elsewhere open in the default browser, other
  schemes are blocked. A link that keeps leaving is held back after 3
  opens in 30 s.
- Sign-in popups on popupAllow hosts open in an in-app window on the same
  profile.
- Suspend lowers the memory target and suspends the browser; hibernate
  keeps the page in memory and disposes the control; a crashed page reloads
  once, then asks.
- Console capture over CDP into two session rings for the bug report.
- Sign-in health counts each profile's cookies (never values) at first
  load and at close, and warns when a profile comes back empty.
- Quit closes every module, then waits up to 3 s for the browser process
  to exit so cookies reach disk. --wv2-logging turns on Chromium logging.
- Third-party notices list the WebView2 SDK (BSD-3-Clause).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 09:46:29 +07:00
poli0981 eef73cac86 Merge pull request #36 from poli0981/feat/p2-calendar
feat: add the calendar module
2026-11-02 09:29:17 +07:00
poli0981 43eb0e0da7 Merge remote-tracking branch 'origin/main' into feat/p2-catalog-runtime 2026-11-02 09:26:14 +07:00
poli0981andClaude Opus 5.5 6019bc6c33 feat: load the web-app catalog and check main's copy daily
WP2 creates OmniDeck.Web with the catalog runtime:

- OdCatalog and OdCatalogEntry read webapps.json strictly (unknown,
  missing or null properties are errors) through source-generated JSON.
- OdCatalogValidator applies the rules validate-catalog.ps1 checks in CI;
  its test runs on the repository's file so the two stay in step.
- OdCatalogService uses the newer of the catalog bundled with the build
  and the last one fetched. A minute after start, then at most once a
  day, it fetches main's copy with If-None-Match, keeps a valid one
  atomically in the data root, and applies it from the next start.
- The CI token rule now covers OmniDeck.Web views, and an architecture
  test keeps the web runner off the shell and the built-in modules.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 09:25:12 +07:00
poli0981 038c695987 Merge branch 'main' into feat/p2-calendar 2026-11-02 09:24:50 +07:00
poli0981 932385a71e Merge pull request #33 from poli0981/feat/catalog-schema-v2
feat(catalog): schema v2 with named navAllowSets for Google's account domains
2026-11-02 09:19:50 +07:00
poli0981 6dbfa9e6d4 Merge remote-tracking branch 'origin/feat/catalog-schema-v2' into feat/p2-catalog-runtime 2026-11-02 09:18:45 +07:00
poli0981 503f7bd607 Merge remote-tracking branch 'origin/main' into feat/catalog-schema-v2 2026-11-02 09:15:52 +07:00
poli0981 209fea4e7f Merge remote-tracking branch 'origin/main' into feat/p2-calendar 2026-11-02 09:15:20 +07:00
poli0981andClaude Opus 5.5 8fb9de8702 feat: add the calendar module
Local events with repeats, reminders and .ics import and export
(docs/SPEC.md §3), in a month grid, a week list or a 30-day agenda.

- OdCalendarStore keeps events in calendar_events (migration 0004) as
  local wall-clock times, with the RRULE, the removed dates and the
  reminder; the module and the reminders share it and hear its changes.
- OdRecurrence expands repeats through Ical.Net 5.2.3, imported rules
  (BYDAY, COUNT, ...) included; the editor writes daily, weekly, monthly
  or yearly rules with an interval and an end date, and keeps a rule it
  cannot show unless the user picks another.
- OdIcs reads and writes .ics files; fixed-zone times become local, and
  UIDs make a second import update instead of duplicate.
- OdReminderService starts with the app, so reminders fire whether or not
  Calendar was opened, only while OmniDeck runs; clicking one opens Calendar.
- THIRD-PARTY-NOTICES: Ical.Net (MIT) and NodaTime (Apache-2.0) move to
  the bundled list (pre-approved for P2 packages).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 09:14:52 +07:00
poli0981 835185f26e Merge pull request #35 from poli0981/feat/p2-weather
feat: add the weather module
2026-11-02 09:04:33 +07:00
poli0981 59d49656d7 Merge remote-tracking branch 'origin/main' into feat/catalog-schema-v2 2026-11-02 09:01:35 +07:00
poli0981 bf30b52fb8 Merge remote-tracking branch 'origin/main' into feat/p2-weather 2026-11-02 09:01:32 +07:00
poli0981andClaude Opus 5.5 bb729f8348 feat: add the weather module
Forecasts from Open-Meteo (keyless; the only weather service PRIVACY
lists) for the places the user saves by searching for a city: no device or
IP location. It shows the conditions now, the next 48 hours and the next
7 days, in the region's units or the user's choice.

- OdOpenMeteo builds the requests and parses the answers into records;
  anything unexpected becomes a JsonException.
- OdWeatherService serves a forecast younger than 30 minutes from the
  weather_cache table (migration 0003), fetches older ones again, shows
  the last one as stale when Open-Meteo is out of reach, and never retries
  by itself. Its log lines name neither places nor coordinates.
- The module fetches only while it is on screen; suspending it cancels
  the request in flight. The attribution links to Open-Meteo.com.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 09:00:59 +07:00
poli0981 f60d455647 Merge pull request #34 from poli0981/feat/p2-foundation
feat: lay the P2 foundation in the module contract and the shell
2026-11-02 08:49:50 +07:00
poli0981andClaude Opus 5.5 0c7a3b684b feat: lay the P2 foundation in the module contract and the shell
- IOdModuleContext gives modules the shared HTTP client (OdHttp: one
  HttpClient naming OmniDeck in its User-Agent, no cookies, 15 s timeout)
  and the database for their own tables.
- Notifications carry a target: a module's notifications open it when
  clicked, through the tray icon's balloon-click event.
- OdModuleInfo.DisplayName shows a brand name as written, for web apps.
- The host activates the new module before hiding the old one, so a module
  that fails to start leaves the shell as it was, and CloseAllAsync closes
  every open module; quitting now runs it before the app shuts down.
- The theme engine re-applies the theme only when Windows' look (dark or
  light, accent, High Contrast, animations) actually changed.
- Stale comments fixed. The OmniDeck.Web project is created with the web
  runner (WP3): an empty project would trip ReferenceTrimmer.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 08:46:33 +07:00
poli0981 e03d809492 Merge pull request #32 from poli0981/release/0.1.1
release: 0.1.1
2026-11-02 08:36:38 +07:00
poli0981andClaude Opus 5.5 230f7dc8c7 feat(catalog): schema v2 with named navAllowSets for Google's account domains
Google's sign-in hops to accounts.google.<ccTLD> (for example
accounts.google.com.vn/accounts/SetSID) to set its cookies; spike #2 saw
YouTube blocked there. Schema v2 adds top-level navAllowSets, named lists
of domains that entries reference by name, and google-account-domains
lists the 186 country-code account hosts from google.com/supported_domains.
Every google-profile entry references it, since they share one sign-in.

validate-catalog.ps1 now checks that every set an entry names exists,
that every set is used, and counts sets when checking popupAllow coverage.
No released build reads the catalog yet, so moving to v2 strands no client.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 08:36:10 +07:00
poli0981 5400c6dbe4 Merge pull request #31 from poli0981/fix/tray-icon-gdi-leak
fix: draw the tray icon in-house and stop repeating crash reports
2026-11-02 08:35:15 +07:00
poli0981andClaude Opus 5.5 9b86f98846 release: 0.1.1
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 08:31:44 +07:00
poli0981andClaude Opus 5.5 eb243b7f07 fix: draw the tray icon in-house and stop repeating crash reports
The tray icon used H.NotifyIcon's GeneratedIconSource bound to the accent
brushes. In 2.4.1 every redraw leaks an icon handle (Icon.FromHandle never
destroys it) and every brush change adds one more redraw handler, so redraws
grew quadratically with each accent or theme change until the process ran out
of GDI objects: "A generic error occurred in GDI+" thousands of times a
second, then WPF render failures.

- OdTrayIcon renders the icon with WPF and loads it from ICO bytes, so each
  icon owns its handle and the taskbar icon frees the one it replaces. It
  redraws only when the colors change.
- OdCrashHandler reports a repeating failure once a minute, with a repeat
  count, instead of logging and showing every occurrence.
- Logs are kept for seven days by age (31 files at most), as SPEC §5 and the
  privacy policy say.
- OdThemeEngine applies a custom accent before the theme dictionaries, as
  WPF-UI does with the Windows accent, so toggle switches no longer lag one
  pick behind.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 08:30:47 +07:00
243 changed files with 14509 additions and 310 deletions

No files matched your search

+2 -2
View File
@@ -51,8 +51,8 @@ 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,OmniDeck.Modules}/**.cs]
# UI code (the shell and the modules) 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]
+5 -5
View File
@@ -63,18 +63,18 @@ jobs:
- 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
+3 -1
View File
@@ -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." }
+120 -1
View File
@@ -6,6 +6,121 @@ 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
@@ -120,7 +235,11 @@ 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.1.0...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
+8 -1
View File
@@ -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
+2 -2
View File
@@ -47,7 +47,7 @@
<RepositoryUrl>https://github.com/poli0981/OmniDeck</RepositoryUrl>
<PackageProjectUrl>https://github.com/poli0981/OmniDeck</PackageProjectUrl>
<RepositoryType>git</RepositoryType>
<Version>0.1.0</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>
+1
View File
@@ -3,6 +3,7 @@
<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" />
+6 -5
View File
@@ -13,12 +13,13 @@ OmniDeck combines a set of lightweight native mini-apps (weather, calculator, st
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: alpha.** 0.1.0 (phase P1) is the first installable build: the shell, the RAM governor, and the clock, timer and calculator modules. Web apps and the other modules arrive in P2 and 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.
**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
+201 -5
View File
@@ -1,14 +1,205 @@
{
"$schema": "./webapps.schema.json",
"schemaVersion": 1,
"updated": "2026-10-30",
"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,7 +277,7 @@
"navAllow": ["facebook.com", "fbcdn.net", "fbsbx.com"],
"popupAllow": ["facebook.com"],
"notifications": true,
"audioPin": false
"audioPin": true
}
]
}
+19 -1
View File
@@ -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).",
+79 -15
View File
@@ -10,7 +10,7 @@ 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 and notifications, command
palette, theme engine, legal gate, onboarding, settings UI,
@@ -22,7 +22,7 @@ src/
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
@@ -31,13 +31,13 @@ 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. `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. 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.
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 Velopack update service lives in the app, because Core must not reference Velopack.
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
@@ -58,26 +58,68 @@ public interface IOdModule
}
```
`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), a logger and the clock; the HTTP client factory joins it with the first module that goes online (P2). 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 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 = private commit (`Process.PrivateMemorySize64`) of the shell plus the WebView2 processes from `CoreWebView2Environment.GetProcessInfos()`. 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`.
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
@@ -93,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. 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.
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.
+22 -2
View File
@@ -12,6 +12,8 @@ The governor is the feature that makes "many apps in one" viable. It moves every
| 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 |
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)
@@ -32,11 +34,13 @@ 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: 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.
@@ -50,14 +54,30 @@ The caps, the toasts and the task-manager panel all use it. The panel may show t
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.
## 5. Task-manager panel
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; web apps get their own figures with the web runner (P2). 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.
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).
+15 -6
View File
@@ -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
@@ -39,21 +41,28 @@ Shell (nav, tray, single-instance, command palette), module contract + host, RAM
**Exit (0.1.0):** installable Velopack build; governor demotes/restores the trivial modules correctly; unit tests for governor + storage green.
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. Carried forward:
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 (11 Jan – 7 Mar 2027)
### 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 (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; 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.
@@ -82,9 +91,9 @@ Every version below 1.0.0 is published as a GitHub **pre-release**; 1.0.0 is the
|---|---|---|
| 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 needs a video-output restart and a seek, plus an overlay sizing fix in P2. FlyleafLib is not needed |
| 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). P2 records sign-in health after restarts, and bug reports carry cookie-store counts (never values) |
| 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 |
@@ -98,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.
+30 -13
View File
@@ -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).
@@ -64,19 +64,36 @@ All mini-apps implement the module contract in [ARCHITECTURE](ARCHITECTURE.md) a
- 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). 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** hands the player to the new window by re-selecting the video track and seeking to the current time ([spike #6](spikes/06-libvlcsharp.md)).
- **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).
- **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 need them in `navAllow`, through a catalog schema v2 field (`navAllowSets`) decided in P2 ([spike #2](spikes/02-google-sign-in.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
@@ -90,9 +107,9 @@ All mini-apps implement the module contract in [ARCHITECTURE](ARCHITECTURE.md) a
## 6. Bug reporting flow
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 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).
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)
+11 -8
View File
@@ -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,14 +52,14 @@ Top-level file fields: `$schema` (optional editor hint), `schemaVersion` (int),
| id | profile | audioPin | Notes |
|---|---|---|---|
| spotify | spotify | yes | Web Player; DRM works in the runtime ([spike #1](spikes/01-drm-widevine.md)); the third-party sign-in buttons (Google/Facebook/Apple) are still untested ([spike #2](spikes/02-google-sign-in.md)) |
| discord | discord | no | no global PTT on web; host hotkey partial mitigation |
| youtube | google | yes | sign-in hops to Google's country-code domains, which need `navAllowSets` (P2, spike #2) |
| 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 | also Meta's web messaging (`facebook.com/messages`) since messenger.com closed in April 2026; the Messenger entry was removed |
| 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
+1 -1
View File
@@ -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.
+859 -6
View File
@@ -22,19 +22,20 @@ OmniDeck is licensed under GPL-3.0. This file lists the third-party components O
| Microsoft.Data.Sqlite (+ .Core) | 10.0.14 | MIT | SQLite provider |
| SQLitePCLRaw (bundle_e_sqlite3, core, provider.e_sqlite3, lib.e_sqlite3) | 2.1.13 | Apache-2.0 | SQLite bindings |
| SQLite (the `e_sqlite3` native library) | bundled with SQLitePCLRaw 2.1.13 | public domain | local database engine |
| Ical.Net | 5.2.3 | MIT | calendar repeats and .ics import/export |
| NodaTime (with the IANA time zone database, public domain) | 3.2.2 | Apache-2.0 | time zones for Ical.Net |
| Microsoft.Web.WebView2 (Core, WPF and WinForms bindings, WebView2Loader) | 1.0.4314.35 | BSD-3-Clause | web app engine bindings; the WebView2 Runtime itself is not bundled (§3) |
| LibVLCSharp + LibVLCSharp.WPF | 3.10.2 | LGPL-2.1-or-later | media player bindings |
| libVLC (`VideoLAN.LibVLC.Windows`: libvlc, libvlccore and the plugins in `libvlc\win-x64`) | 3.0.24 | LGPL-2.1-or-later core and most plugins; some plugins GPL-2.0-or-later | media engine |
libVLC note: OmniDeck redistributes the libVLC 3.0.24 binaries unmodified, as separate files in `libvlc\win-x64` that can be replaced, with the plugin folders listed in docs/SPEC.md §3.6. Source for that exact version is available from VideoLAN (https://download.videolan.org/pub/videolan/vlc/3.0.24/) and LibVLCSharp's from https://code.videolan.org/videolan/LibVLCSharp. The combination is distributed under GPL-3.0 terms, compatible with the LGPL-2.1+ and GPL-2.0+ components.
## 2. Planned components (bundled from the version that introduces them)
| Component | License | Role | Phase |
|---|---|---|---|
| Microsoft.Web.WebView2 (SDK) | BSD-3-Clause (Microsoft) | web app engine bindings | P2 |
| Ical.Net (+ NodaTime) | MIT (+ Apache-2.0) | iCalendar import/export | P2 |
| LibVLCSharp.WPF | LGPL-2.1-or-later | media bindings | P2 |
| libVLC (`VideoLAN.LibVLC.Windows`) | LGPL-2.1-or-later core; some plugins GPL-2.0-or-later | media engine | P2 |
| ScottPlot.WPF (+ SkiaSharp, OpenTK) | MIT | stock charts | P3 |
libVLC note: once the media player ships, OmniDeck redistributes libVLC binaries unmodified. Source for the exact libVLC version shipped is available from VideoLAN; the combination is distributed under GPL-3.0 terms, compatible with the LGPL-2.1+ and GPL-2.0+ components.
## 3. Not bundled
- **Microsoft Edge WebView2 Runtime** — ships with Windows 11 and is updated by Microsoft under Microsoft's license terms; OmniDeck does not redistribute it.
@@ -66,6 +67,7 @@ Applies to the MIT-licensed components in §1, with these copyright notices:
- Microsoft.Data.Sqlite and Microsoft.Data.Sqlite.Core: Copyright (c) .NET Foundation and Contributors
- CommunityToolkit.Mvvm: Copyright © .NET Foundation and Contributors
- H.NotifyIcon, H.NotifyIcon.Wpf and H.GeneratedIcons.System.Drawing: Copyright (c) 2020 havendv; they continue Hardcodet NotifyIcon for WPF, Copyright (c) Philipp Sumi (MIT)
- Ical.Net: Copyright 2007-2026 ical-org
```
Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -96,6 +98,7 @@ Applies to these components in §1, with their copyright notices:
- Serilog and Serilog.Sinks.File: Copyright © Serilog Contributors
- Dapper: Copyright © 2019 Stack Exchange, Inc.
- SQLitePCLRaw: Copyright 2014-2024 SourceGear, LLC
- NodaTime: Copyright The Noda Time Authors
```
Apache License
@@ -276,6 +279,38 @@ Applies to these components in §1, with their copyright notices:
END OF TERMS AND CONDITIONS
```
### BSD 3-Clause License
Applies to Microsoft.Web.WebView2: Copyright (C) Microsoft Corporation. All rights reserved.
```
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following disclaimer
in the documentation and/or other materials provided with the
distribution.
* The name of Microsoft Corporation, or the names of its contributors
may not be used to endorse or promote products derived from this
software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
```
### BSD 2-Clause License
Applies to Markdig (1.5.1), with this copyright notice: Copyright (c) 2016-2026, Alexandre Mutel. All rights reserved.
@@ -303,6 +338,824 @@ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
```
### GNU Lesser General Public License, version 2.1
Applies to LibVLCSharp and LibVLCSharp.WPF (Copyright (C) VideoLAN and the LibVLCSharp authors), and to libVLC and its LGPL plugins (Copyright (C) the VLC authors and VideoLAN). Each is offered under version 2.1 of this license or, at your option, any later version.
```
GNU LESSER GENERAL PUBLIC LICENSE
Version 2.1, February 1999
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies of this license
document, but changing it is not allowed.
[This is the first released version of the Lesser GPL. It also counts as
the successor of the GNU Library Public License, version 2, hence the
version number 2.1.]
Preamble
The licenses for most software are designed to take away your freedom to
share and change it. By contrast, the GNU General Public Licenses are
intended to guarantee your freedom to share and change free software--to
make sure the software is free for all its users.
This license, the Lesser General Public License, applies to some specially
designated software packages--typically libraries--of the Free Software
Foundation and other authors who decide to use it. You can use it too, but
we suggest you first think carefully about whether this license or the
ordinary General Public License is the better strategy to use in any
particular case, based on the explanations below.
When we speak of free software, we are referring to freedom of use, not
price. Our General Public Licenses are designed to make sure that you have
the freedom to distribute copies of free software (and charge for this
service if you wish); that you receive source code or can get it if you want
it; that you can change the software and use pieces of it in new free
programs; and that you are informed that you can do these things.
To protect your rights, we need to make restrictions that forbid
distributors to deny you these rights or to ask you to surrender these
rights. These restrictions translate to certain responsibilities for you if
you distribute copies of the library or if you modify it.
For example, if you distribute copies of the library, whether gratis or for
a fee, you must give the recipients all the rights that we gave you. You
must make sure that they, too, receive or can get the source code. If you
link other code with the library, you must provide complete object files to
the recipients, so that they can relink them with the library after making
changes to the library and recompiling it. And you must show them these
terms so they know their rights.
We protect your rights with a two-step method: (1) we copyright the library,
and (2) we offer you this license, which gives you legal permission to copy,
distribute and/or modify the library.
To protect each distributor, we want to make it very clear that there is no
warranty for the free library. Also, if the library is modified by someone
else and passed on, the recipients should know that what they have is not
the original version, so that the original author's reputation will not be
affected by problems that might be introduced by others.
Finally, software patents pose a constant threat to the existence of any
free program. We wish to make sure that a company cannot effectively
restrict the users of a free program by obtaining a restrictive license from
a patent holder. Therefore, we insist that any patent license obtained for a
version of the library must be consistent with the full freedom of use
specified in this license.
Most GNU software, including some libraries, is covered by the ordinary GNU
General Public License. This license, the GNU Lesser General Public License,
applies to certain designated libraries, and is quite different from the
ordinary General Public License. We use this license for certain libraries
in order to permit linking those libraries into non-free programs.
When a program is linked with a library, whether statically or using a
shared library, the combination of the two is legally speaking a combined
work, a derivative of the original library. The ordinary General Public
License therefore permits such linking only if the entire combination fits
its criteria of freedom. The Lesser General Public License permits more lax
criteria for linking other code with the library.
We call this license the "Lesser" General Public License because it does
Less to protect the user's freedom than the ordinary General Public License.
It also provides other free software developers Less of an advantage over
competing non-free programs. These disadvantages are the reason we use the
ordinary General Public License for many libraries. However, the Lesser
license provides advantages in certain special circumstances.
For example, on rare occasions, there may be a special need to encourage the
widest possible use of a certain library, so that it becomes a de-facto
standard. To achieve this, non-free programs must be allowed to use the
library. A more frequent case is that a free library does the same job as
widely used non-free libraries. In this case, there is little to gain by
limiting the free library to free software only, so we use the Lesser
General Public License.
In other cases, permission to use a particular library in non-free programs
enables a greater number of people to use a large body of free software. For
example, permission to use the GNU C Library in non-free programs enables
many more people to use the whole GNU operating system, as well as its
variant, the GNU/Linux operating system.
Although the Lesser General Public License is Less protective of the users'
freedom, it does ensure that the user of a program that is linked with the
Library has the freedom and the wherewithal to run that program using a
modified version of the Library.
The precise terms and conditions for copying, distribution and modification
follow. Pay close attention to the difference between a "work based on the
library" and a "work that uses the library". The former contains code
derived from the library, whereas the latter must be combined with the
library in order to run.
GNU LESSER GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License Agreement applies to any software library or other program
which contains a notice placed by the copyright holder or other authorized
party saying it may be distributed under the terms of this Lesser General
Public License (also called "this License"). Each licensee is addressed as
"you".
A "library" means a collection of software functions and/or data prepared so
as to be conveniently linked with application programs (which use some of
those functions and data) to form executables.
The "Library", below, refers to any such software library or work which has
been distributed under these terms. A "work based on the Library" means
either the Library or any derivative work under copyright law: that is to
say, a work containing the Library or a portion of it, either verbatim or
with modifications and/or translated straightforwardly into another
language. (Hereinafter, translation is included without limitation in the
term "modification".)
"Source code" for a work means the preferred form of the work for making
modifications to it. For a library, complete source code means all the
source code for all modules it contains, plus any associated interface
definition files, plus the scripts used to control compilation and
installation of the library.
Activities other than copying, distribution and modification are not covered
by this License; they are outside its scope. The act of running a program
using the Library is not restricted, and output from such a program is
covered only if its contents constitute a work based on the Library
(independent of the use of the Library in a tool for writing it). Whether
that is true depends on what the Library does and what the program that uses
the Library does.
1. You may copy and distribute verbatim copies of the Library's complete
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the notices
that refer to this License and to the absence of any warranty; and
distribute a copy of this License along with the Library.
You may charge a fee for the physical act of transferring a copy, and you
may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Library or any portion of it,
thus forming a work based on the Library, and copy and distribute such
modifications or work under the terms of Section 1 above, provided that you
also meet all of these conditions:
a) The modified work must itself be a software library.
b) You must cause the files modified to carry prominent notices stating
that you changed the files and the date of any change.
c) You must cause the whole of the work to be licensed at no charge to
all third parties under the terms of this License.
d) If a facility in the modified Library refers to a function or a
table of data to be supplied by an application program that uses the
facility, other than as an argument passed when the facility is
invoked, then you must make a good faith effort to ensure that, in the
event an application does not supply such function or table, the
facility still operates, and performs whatever part of its purpose
remains meaningful.
(For example, a function in a library to compute square roots has a purpose
that is entirely well-defined independent of the application. Therefore,
Subsection 2d requires that any application-supplied function or table used
by this function must be optional: if the application does not supply it,
the square root function must still compute square roots.)
These requirements apply to the modified work as a whole. If identifiable
sections of that work are not derived from the Library, and can be
reasonably considered independent and separate works in themselves, then
this License, and its terms, do not apply to those sections when you
distribute them as separate works. But when you distribute the same sections
as part of a whole which is a work based on the Library, the distribution of
the whole must be on the terms of this License, whose permissions for other
licensees extend to the entire whole, and thus to each and every part
regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest your
rights to work written entirely by you; rather, the intent is to exercise
the right to control the distribution of derivative or collective works
based on the Library.
In addition, mere aggregation of another work not based on the Library with
the Library (or with a work based on the Library) on a volume of a storage
or distribution medium does not bring the other work under the scope of this
License.
3. You may opt to apply the terms of the ordinary GNU General Public License
instead of this License to a given copy of the Library. To do this, you must
alter all the notices that refer to this License, so that they refer to the
ordinary GNU General Public License, version 2, instead of to this License.
(If a newer version than version 2 of the ordinary GNU General Public
License has appeared, then you can specify that version instead if you
wish.) Do not make any other change in these notices.
Once this change is made in a given copy, it is irreversible for that copy,
so the ordinary GNU General Public License applies to all subsequent copies
and derivative works made from that copy.
This option is useful when you wish to copy part of the code of the Library
into a program that is not a library.
4. You may copy and distribute the Library (or a portion or derivative of
it, under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you accompany it with the complete
corresponding machine-readable source code, which must be distributed under
the terms of Sections 1 and 2 above on a medium customarily used for
software interchange.
If distribution of object code is made by offering access to copy from a
designated place, then offering equivalent access to copy the source code
from the same place satisfies the requirement to distribute the source code,
even though third parties are not compelled to copy the source along with
the object code.
5. A program that contains no derivative of any portion of the Library, but
is designed to work with the Library by being compiled or linked with it, is
called a "work that uses the Library". Such a work, in isolation, is not a
derivative work of the Library, and therefore falls outside the scope of
this License.
However, linking a "work that uses the Library" with the Library creates an
executable that is a derivative of the Library (because it contains portions
of the Library), rather than a "work that uses the library". The executable
is therefore covered by this License. Section 6 states terms for
distribution of such executables.
When a "work that uses the Library" uses material from a header file that is
part of the Library, the object code for the work may be a derivative work
of the Library even though the source code is not. Whether this is true is
especially significant if the work can be linked without the Library, or if
the work is itself a library. The threshold for this to be true is not
precisely defined by law.
If such an object file uses only numerical parameters, data structure
layouts and accessors, and small macros and small inline functions (ten
lines or less in length), then the use of the object file is unrestricted,
regardless of whether it is legally a derivative work. (Executables
containing this object code plus portions of the Library will still fall
under Section 6.)
Otherwise, if the work is a derivative of the Library, you may distribute
the object code for the work under the terms of Section 6. Any executables
containing that work also fall under Section 6, whether or not they are
linked directly with the Library itself.
6. As an exception to the Sections above, you may also combine or link a
"work that uses the Library" with the Library to produce a work containing
portions of the Library, and distribute that work under terms of your
choice, provided that the terms permit modification of the work for the
customer's own use and reverse engineering for debugging such modifications.
You must give prominent notice with each copy of the work that the Library
is used in it and that the Library and its use are covered by this License.
You must supply a copy of this License. If the work during execution
displays copyright notices, you must include the copyright notice for the
Library among them, as well as a reference directing the user to the copy of
this License. Also, you must do one of these things:
a) Accompany the work with the complete corresponding machine-readable
source code for the Library including whatever changes were used in the
work (which must be distributed under Sections 1 and 2 above); and, if
the work is an executable linked with the Library, with the complete
machine-readable "work that uses the Library", as object code and/or
source code, so that the user can modify the Library and then relink to
produce a modified executable containing the modified Library. (It is
understood that the user who changes the contents of definitions files
in the Library will not necessarily be able to recompile the
application to use the modified definitions.)
b) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (1) uses at run time a copy
of the library already present on the user's computer system, rather
than copying library functions into the executable, and (2) will
operate properly with a modified version of the library, if the user
installs one, as long as the modified version is interface-compatible
with the version that the work was made with.
c) Accompany the work with a written offer, valid for at least three
years, to give the same user the materials specified in Subsection 6a,
above, for a charge no more than the cost of performing this
distribution.
d) If distribution of the work is made by offering access to copy from
a designated place, offer equivalent access to copy the above specified
materials from the same place.
e) Verify that the user has already received a copy of these materials
or that you have already sent this user a copy.
For an executable, the required form of the "work that uses the Library"
must include any data and utility programs needed for reproducing the
executable from it. However, as a special exception, the materials to be
distributed need not include anything that is normally distributed (in
either source or binary form) with the major components (compiler, kernel,
and so on) of the operating system on which the executable runs, unless that
component itself accompanies the executable.
It may happen that this requirement contradicts the license restrictions of
other proprietary libraries that do not normally accompany the operating
system. Such a contradiction means you cannot use both them and the Library
together in an executable that you distribute.
7. You may place library facilities that are a work based on the Library
side-by-side in a single library together with other library facilities not
covered by this License, and distribute such a combined library, provided
that the separate distribution of the work based on the Library and of the
other library facilities is otherwise permitted, and provided that you do
these two things:
a) Accompany the combined library with a copy of the same work based on
the Library, uncombined with any other library facilities. This must be
distributed under the terms of the Sections above.
b) Give prominent notice with the combined library of the fact that
part of it is a work based on the Library, and explaining where to find
the accompanying uncombined form of the same work.
8. You may not copy, modify, sublicense, link with, or distribute the
Library except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense, link with, or distribute the Library
is void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under this
License will not have their licenses terminated so long as such parties
remain in full compliance.
9. You are not required to accept this License, since you have not signed
it. However, nothing else grants you permission to modify or distribute the
Library or its derivative works. These actions are prohibited by law if you
do not accept this License. Therefore, by modifying or distributing the
Library (or any work based on the Library), you indicate your acceptance of
this License to do so, and all its terms and conditions for copying,
distributing or modifying the Library or works based on it.
10. Each time you redistribute the Library (or any work based on the
Library), the recipient automatically receives a license from the original
licensor to copy, distribute, link with or modify the Library subject to
these terms and conditions. You may not impose any further restrictions on
the recipients' exercise of the rights granted herein. You are not
responsible for enforcing compliance by third parties with this License.
11. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot distribute so
as to satisfy simultaneously your obligations under this License and any
other pertinent obligations, then as a consequence you may not distribute
the Library at all. For example, if a patent license would not permit
royalty-free redistribution of the Library by all those who receive copies
directly or indirectly through you, then the only way you could satisfy both
it and this License would be to refrain entirely from distribution of the
Library.
If any portion of this section is held invalid or unenforceable under any
particular circumstance, the balance of the section is intended to apply,
and the section as a whole is intended to apply in other circumstances.
It is not the purpose of this section to induce you to infringe any patents
or other property right claims or to contest validity of any such claims;
this section has the sole purpose of protecting the integrity of the free
software distribution system which is implemented by public license
practices. Many people have made generous contributions to the wide range of
software distributed through that system in reliance on consistent
application of that system; it is up to the author/donor to decide if he or
she is willing to distribute software through any other system and a
licensee cannot impose that choice.
This section is intended to make thoroughly clear what is believed to be a
consequence of the rest of this License.
12. If the distribution and/or use of the Library is restricted in certain
countries either by patents or by copyrighted interfaces, the original
copyright holder who places the Library under this License may add an
explicit geographical distribution limitation excluding those countries, so
that distribution is permitted only in or among countries not thus excluded.
In such case, this License incorporates the limitation as if written in the
body of this License.
13. The Free Software Foundation may publish revised and/or new versions of
the Lesser General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Library
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Library does not specify a license version
number, you may choose any version ever published by the Free Software
Foundation.
14. If you wish to incorporate parts of the Library into other free programs
whose distribution conditions are incompatible with these, write to the
author to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals of
preserving the free status of all derivatives of our free software and of
promoting the sharing and reuse of software generally.
NO WARRANTY
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR
THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO
THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY
PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR
CORRECTION.
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO
LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR
THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER
SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Libraries
If you develop a new library, and you want it to be of the greatest possible
use to the public, we recommend making it free software that everyone can
redistribute and change. You can do so by permitting redistribution under
these terms (or, alternatively, under the terms of the ordinary General
Public License).
To apply these terms, attach the following notices to the library. It is
safest to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least the
"copyright" line and a pointer to where the full notice is found.
one line to give the library's name and an idea of what it does.
Copyright (C) year name of author
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
This library is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA Also add information on how to contact you by
electronic and paper mail.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the library, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in
the library `Frob' (a library for tweaking knobs) written
by James Random Hacker.
signature of Ty Coon, 1 April 1990
Ty Coon, President of Vice
That's all there is to it!
```
### GNU General Public License, version 2
Applies to the libVLC plugins licensed GPL-2.0-or-later (Copyright (C) the VLC authors and VideoLAN), offered under version 2 of this license or, at your option, any later version. OmniDeck itself is GPL-3.0 (see LICENSE).
```
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
Everyone is permitted to copy and distribute verbatim copies of this license
document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your freedom to
share and change it. By contrast, the GNU General Public License is intended
to guarantee your freedom to share and change free software--to make sure
the software is free for all its users. This General Public License applies
to most of the Free Software Foundation's software and to any other program
whose authors commit to using it. (Some other Free Software Foundation
software is covered by the GNU Lesser General Public License instead.) You
can apply it to your programs, too.
When we speak of free software, we are referring to freedom, not price. Our
General Public Licenses are designed to make sure that you have the freedom
to distribute copies of free software (and charge for this service if you
wish), that you receive source code or can get it if you want it, that you
can change the software or use pieces of it in new free programs; and that
you know you can do these things.
To protect your rights, we need to make restrictions that forbid anyone to
deny you these rights or to ask you to surrender the rights. These
restrictions translate to certain responsibilities for you if you distribute
copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether gratis or
for a fee, you must give the recipients all the rights that you have. You
must make sure that they, too, receive or can get the source code. And you
must show them these terms so they know their rights.
We protect your rights with two steps: (1) copyright the software, and (2)
offer you this license which gives you legal permission to copy, distribute
and/or modify the software.
Also, for each author's protection and ours, we want to make certain that
everyone understands that there is no warranty for this free software. If
the software is modified by someone else and passed on, we want its
recipients to know that what they have is not the original, so that any
problems introduced by others will not reflect on the original authors'
reputations.
Finally, any free program is threatened constantly by software patents. We
wish to avoid the danger that redistributors of a free program will
individually obtain patent licenses, in effect making the program
proprietary. To prevent this, we have made it clear that any patent must be
licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and modification
follow.
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains a notice
placed by the copyright holder saying it may be distributed under the terms
of this General Public License. The "Program", below, refers to any such
program or work, and a "work based on the Program" means either the Program
or any derivative work under copyright law: that is to say, a work
containing the Program or a portion of it, either verbatim or with
modifications and/or translated into another language. (Hereinafter,
translation is included without limitation in the term "modification".) Each
licensee is addressed as "you".
Activities other than copying, distribution and modification are not covered
by this License; they are outside its scope. The act of running the Program
is not restricted, and the output from the Program is covered only if its
contents constitute a work based on the Program (independent of having been
made by running the Program). Whether that is true depends on what the
Program does.
1. You may copy and distribute verbatim copies of the Program's source code
as you receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice and
disclaimer of warranty; keep intact all the notices that refer to this
License and to the absence of any warranty; and give any other recipients of
the Program a copy of this License along with the Program.
You may charge a fee for the physical act of transferring a copy, and you
may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion of it,
thus forming a work based on the Program, and copy and distribute such
modifications or work under the terms of Section 1 above, provided that you
also meet all of these conditions:
a) You must cause the modified files to carry prominent notices stating
that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any part
thereof, to be licensed as a whole at no charge to all third parties
under the terms of this License.
c) If the modified program normally reads commands interactively when
run, you must cause it, when started running for such interactive use
in the most ordinary way, to print or display an announcement including
an appropriate copyright notice and a notice that there is no warranty
(or else, saying that you provide a warranty) and that users may
redistribute the program under these conditions, and telling the user
how to view a copy of this License. (Exception: if the Program itself
is interactive but does not normally print such an announcement, your
work based on the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If identifiable
sections of that work are not derived from the Program, and can be
reasonably considered independent and separate works in themselves, then
this License, and its terms, do not apply to those sections when you
distribute them as separate works. But when you distribute the same sections
as part of a whole which is a work based on the Program, the distribution of
the whole must be on the terms of this License, whose permissions for other
licensees extend to the entire whole, and thus to each and every part
regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest your
rights to work written entirely by you; rather, the intent is to exercise
the right to control the distribution of derivative or collective works
based on the Program.
In addition, mere aggregation of another work not based on the Program with
the Program (or with a work based on the Program) on a volume of a storage
or distribution medium does not bring the other work under the scope of this
License.
3. You may copy and distribute the Program (or a work based on it, under
Section 2) in object code or executable form under the terms of Sections 1
and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable source
code, which must be distributed under the terms of Sections 1 and 2
above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three years,
to give any third party, for a charge no more than your cost of
physically performing source distribution, a complete machine-readable
copy of the corresponding source code, to be distributed under the
terms of Sections 1 and 2 above on a medium customarily used for
software interchange; or,
c) Accompany it with the information you received as to the offer to
distribute corresponding source code. (This alternative is allowed only
for noncommercial distribution and only if you received the program in
object code or executable form with such an offer, in accord with
Subsection b above.)
The source code for a work means the preferred form of the work for making
modifications to it. For an executable work, complete source code means all
the source code for all modules it contains, plus any associated interface
definition files, plus the scripts used to control compilation and
installation of the executable. However, as a special exception, the source
code distributed need not include anything that is normally distributed (in
either source or binary form) with the major components (compiler, kernel,
and so on) of the operating system on which the executable runs, unless that
component itself accompanies the executable.
If distribution of executable or object code is made by offering access to
copy from a designated place, then offering equivalent access to copy the
source code from the same place counts as distribution of the source code,
even though third parties are not compelled to copy the source along with
the object code.
4. You may not copy, modify, sublicense, or distribute the Program except as
expressly provided under this License. Any attempt otherwise to copy,
modify, sublicense or distribute the Program is void, and will automatically
terminate your rights under this License. However, parties who have received
copies, or rights, from you under this License will not have their licenses
terminated so long as such parties remain in full compliance.
5. You are not required to accept this License, since you have not signed
it. However, nothing else grants you permission to modify or distribute the
Program or its derivative works. These actions are prohibited by law if you
do not accept this License. Therefore, by modifying or distributing the
Program (or any work based on the Program), you indicate your acceptance of
this License to do so, and all its terms and conditions for copying,
distributing or modifying the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the original
licensor to copy, distribute or modify the Program subject to these terms
and conditions. You may not impose any further restrictions on the
recipients' exercise of the rights granted herein. You are not responsible
for enforcing compliance by third parties to this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot distribute so
as to satisfy simultaneously your obligations under this License and any
other pertinent obligations, then as a consequence you may not distribute
the Program at all. For example, if a patent license would not permit
royalty-free redistribution of the Program by all those who receive copies
directly or indirectly through you, then the only way you could satisfy both
it and this License would be to refrain entirely from distribution of the
Program.
If any portion of this section is held invalid or unenforceable under any
particular circumstance, the balance of the section is intended to apply and
the section as a whole is intended to apply in other circumstances.
It is not the purpose of this section to induce you to infringe any patents
or other property right claims or to contest validity of any such claims;
this section has the sole purpose of protecting the integrity of the free
software distribution system, which is implemented by public license
practices. Many people have made generous contributions to the wide range of
software distributed through that system in reliance on consistent
application of that system; it is up to the author/donor to decide if he or
she is willing to distribute software through any other system and a
licensee cannot impose that choice.
This section is intended to make thoroughly clear what is believed to be a
consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in certain
countries either by patents or by copyrighted interfaces, the original
copyright holder who places the Program under this License may add an
explicit geographical distribution limitation excluding those countries, so
that distribution is permitted only in or among countries not thus excluded.
In such case, this License incorporates the limitation as if written in the
body of this License.
9. The Free Software Foundation may publish revised and/or new versions of
the General Public License from time to time. Such new versions will be
similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free programs
whose distribution conditions are different, write to the author to ask for
permission. For software which is copyrighted by the Free Software
Foundation, write to the Free Software Foundation; we sometimes make
exceptions for this. Our decision will be guided by the two goals of
preserving the free status of all derivatives of our free software and of
promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR
THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO
THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM
PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR
CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO
LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR
THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest possible
use to the public, the best way to achieve this is to make it free software
which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest to
attach them to the start of each source file to most effectively convey the
exclusion of warranty; and each file should have at least the "copyright"
line and a pointer to where the full notice is found.
one line to give the program's name and an idea of what it does.
Copyright (C) yyyy name of author
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Also add
information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this when
it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author Gnomovision
comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is
free software, and you are welcome to redistribute it under certain
conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may be
called something other than `show w' and `show c'; they could even be mouse-
clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James
Hacker.
signature of Ty Coon, 1 April 1989 Ty Coon, President of Vice
```
### SQLite
SQLite, shipped as the `e_sqlite3` native library, is in the public domain: "The author disclaims copyright to this source code." (see https://sqlite.org/copyright.html).
+1 -1
View File
@@ -47,7 +47,7 @@ Spotify's "Continue with Google / Facebook / Apple" buttons were not tried; the
## 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.
- **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;
+93
View File
@@ -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
View File
@@ -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 {
+35 -6
View File
@@ -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

@@ -1,12 +1,21 @@
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;
@@ -21,6 +30,10 @@ internal static class OdAppServiceCollectionExtensions
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>();
@@ -35,14 +48,30 @@ internal static class OdAppServiceCollectionExtensions
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;
}
@@ -1,6 +1,9 @@
namespace OmniDeck.App.Diagnostics;
/// <summary>Shows the user that something failed; the shell swaps in an in-window dialog in WP4.</summary>
/// <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;
}
}
+78 -16
View File
@@ -8,13 +8,20 @@ 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.
/// The bug-report flow (P2) hangs off the same dialog.
/// 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)
@@ -40,25 +47,28 @@ internal sealed class OdCrashHandler
}
/// <summary>A short code the user can quote; it is logged next to the exception.</summary>
internal static string SupportCode(Exception exception, DateTimeOffset when)
{
// FNV-1a over the exception type and message: stable for the same failure, cheap, and free of
// anything personal.
var hash = 2166136261u;
foreach (var c in exception.GetType().FullName + exception.Message)
{
hash = (hash ^ c) * 16777619u;
}
return string.Create(CultureInfo.InvariantCulture, $"{when:yyMMdd-HHmm}-{hash % 0x10000:X4}");
}
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 code = SupportCode(exception, _time.GetLocalNow());
_log.Error(exception, "Unhandled UI exception, support code {SupportCode}", code);
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)
@@ -82,5 +92,57 @@ internal sealed class OdCrashHandler
Log.CloseAndFlush();
}
internal void HandleUnobserved(Exception exception) => _log.Error(exception, "Unobserved task exception");
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);
}
@@ -5,7 +5,7 @@ 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) : IOdErrorPresenter
internal sealed class OdDialogErrorPresenter(OdDialogs dialogs, OdMessageBoxErrorPresenter fallback, OdBugReportRequests reports) : IOdErrorPresenter
{
public void Show(string message)
{
@@ -15,12 +15,22 @@ internal sealed class OdDialogErrorPresenter(OdDialogs dialogs, OdMessageBoxErro
return;
}
_ = dialogs.ShowAsync(new ContentDialog
_ = 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);
}
}
}
+5 -3
View File
@@ -6,8 +6,9 @@ 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). Nothing leaves the machine; bug reports attach a tail of these files only when
/// the user asks for one.
/// (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
{
@@ -24,7 +25,8 @@ internal static class OdLogging
.WriteTo.File(
System.IO.Path.Combine(dataRoot.LogsDirectory, "omnideck-.log"),
rollingInterval: RollingInterval.Day,
retainedFileCountLimit: 7,
retainedFileCountLimit: 31,
retainedFileTimeLimit: TimeSpan.FromDays(7),
fileSizeLimitBytes: 10 * 1024 * 1024,
rollOnFileSizeLimit: true,
outputTemplate: Template,
+24 -5
View File
@@ -17,7 +17,12 @@ 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;
@@ -30,11 +35,13 @@ namespace OmniDeck.App;
public partial class OdApp
{
private readonly OdSingleInstanceGuard _guard;
private readonly OdDataRoot _dataRoot;
private ServiceProvider? _services;
internal OdApp(OdSingleInstanceGuard guard)
internal OdApp(OdSingleInstanceGuard guard, OdDataRoot dataRoot)
{
_guard = guard;
_dataRoot = dataRoot;
}
/// <summary>The legal documents that ship next to the executable.</summary>
@@ -46,9 +53,10 @@ public partial class OdApp
ShutdownMode = ShutdownMode.OnExplicitShutdown;
OdLocalization.Instance.Register(OdAppStrings.Resources);
OdLocalization.Instance.Register(OdModuleStrings.Resources);
OdLocalization.Instance.Register(OdWebStrings.Resources);
try
{
Start(startMinimized: e.Args.Contains(OdRunKeyStartup.MinimizedArgument, StringComparer.OrdinalIgnoreCase));
Start(e.Args);
}
catch (Exception ex)
{
@@ -67,16 +75,25 @@ public partial class OdApp
base.OnExit(e);
}
private void Start(bool startMinimized)
private void Start(string[] args)
{
var dataRoot = OdDataRoot.Default;
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);
@@ -115,6 +132,8 @@ public partial class OdApp
_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>
@@ -131,7 +150,7 @@ public partial class OdApp
{
if (!lifetime.IsQuitting)
{
lifetime.Quit();
_ = lifetime.QuitAsync();
}
};
}
+22 -8
View File
@@ -65,22 +65,36 @@
Grid.Row="0"
Grid.RowSpan="2" />
<!-- The tray icon lives as long as this window, which closing only hides (docs/SPEC.md §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.IconSource>
<tb:GeneratedIconSource Background="{DynamicResource AccentFillColorDefaultBrush}"
FontWeight="Bold"
Foreground="{DynamicResource TextOnAccentFillColorPrimaryBrush}"
Text="O" />
</tb:TaskbarIcon.IconSource>
<tb:TaskbarIcon.ContextMenu>
<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>
+234 -7
View File
@@ -5,13 +5,17 @@ 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;
@@ -32,6 +36,9 @@ public partial class OdMainWindow : INavigationViewPageProvider
{
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;
@@ -42,8 +49,14 @@ public partial class OdMainWindow : INavigationViewPageProvider
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;
@@ -58,7 +71,10 @@ public partial class OdMainWindow : INavigationViewPageProvider
IOdSettingsService settings,
IOdAppLifetime lifetime,
IOdAppMeta meta,
IOdQuickTimer quickTimer)
IOdQuickTimer quickTimer,
OdBugReportFlow bugReports,
OdBugReportRequests bugReportRequests,
OdModuleHost host)
{
ArgumentNullException.ThrowIfNull(theme);
ArgumentNullException.ThrowIfNull(settingsPage);
@@ -77,16 +93,32 @@ public partial class OdMainWindow : INavigationViewPageProvider
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.
// 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)));
Closed += (_, _) => TrayIcon.Dispose();
notifier.Clicked += OnNotificationClicked;
Closed += (_, _) =>
{
notifier.Clicked -= OnNotificationClicked;
TrayIcon.Dispose();
};
SetUpNavigation(theme);
@@ -200,7 +232,20 @@ public partial class OdMainWindow : INavigationViewPageProvider
private int NavMaxVisibleItems => TryFindResource(OdTokenKeys.NavMaxVisibleItems) is int max ? max : 0;
private void OnThemeApplied(object? sender, EventArgs e) => ApplyNavTokens();
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
@@ -236,10 +281,16 @@ public partial class OdMainWindow : INavigationViewPageProvider
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, close } };
menu.Opened += (_, _) => pin.Header = OdLocalization.Get(module.IsPinned ? "Shell_Unpin" : "Shell_Pin");
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
{
@@ -259,6 +310,12 @@ public partial class OdMainWindow : INavigationViewPageProvider
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);
}
}
}
@@ -285,6 +342,13 @@ public partial class OdMainWindow : INavigationViewPageProvider
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)
{
@@ -323,6 +387,7 @@ public partial class OdMainWindow : INavigationViewPageProvider
}
e.Cancel = true;
SetFullscreen(on: false);
Hide();
// Say once, ever, where the window went.
@@ -335,7 +400,169 @@ public partial class OdMainWindow : INavigationViewPageProvider
private void OnTrayOpen(object sender, RoutedEventArgs e) => Present();
private void OnTrayQuit(object sender, RoutedEventArgs e) => _lifetime.Quit();
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;
}
}
}
+28
View File
@@ -8,6 +8,8 @@
<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). -->
@@ -23,6 +25,7 @@
<ItemGroup>
<ProjectReference Include="..\OmniDeck.Core\OmniDeck.Core.csproj" />
<ProjectReference Include="..\OmniDeck.Modules\OmniDeck.Modules.csproj" />
<ProjectReference Include="..\OmniDeck.Web\OmniDeck.Web.csproj" />
</ItemGroup>
<ItemGroup>
@@ -39,6 +42,26 @@
<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>
@@ -46,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'">
+17 -2
View File
@@ -19,15 +19,30 @@ internal static class Program
.OnBeforeUninstallFastCallback(_ => OdDataRoot.Default.TryDelete())
.Run();
using var guard = new OdSingleInstanceGuard();
var dataRoot = DataRoot();
using var guard = new OdSingleInstanceGuard(dataRoot.InstanceSuffix);
if (!guard.IsPrimaryInstance)
{
guard.SignalPrimaryInstance();
return 0;
}
var app = new OdApp(guard);
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
}
}
+115 -1
View File
@@ -43,6 +43,12 @@
<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>
@@ -92,7 +98,13 @@ Support code: {0}
<value>Soft limit {0} · hard limit {1}</value>
</data>
<data name="Memory_SharedNote" xml:space="preserve">
<value>Measured for OmniDeck as a whole: built-in modules share its process, so they have no figure of their own.</value>
<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>
@@ -145,6 +157,15 @@ Support code: {0}
<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>
@@ -358,4 +379,97 @@ Support code: {0}
<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>
@@ -27,6 +27,9 @@ public sealed partial class OdAboutViewModel(IOdUpdateService updates, Action<Ur
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;
@@ -83,6 +86,9 @@ public sealed partial class OdAboutViewModel(IOdUpdateService updates, Action<Ur
[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;
@@ -166,6 +166,94 @@
</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}">
@@ -202,6 +290,9 @@
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"
@@ -6,6 +6,7 @@ public enum OdSettingsSection
General,
Appearance,
Memory,
WebApps,
Data,
About,
}
@@ -8,7 +8,7 @@ using OmniDeck.Core.Storage;
namespace OmniDeck.App.Settings;
/// <summary>
/// The settings page (docs/SPEC.md §2): General, Appearance, Memory, Data and About. Every change is
/// 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>
@@ -71,6 +71,7 @@ public sealed partial class OdSettingsViewModel : ObservableObject, IDisposable
IOdStartupRegistration startup,
OdDataRoot dataRoot,
OdMemoryViewModel memory,
OdWebAppsViewModel webApps,
OdAboutViewModel about,
Action<string> openFolder)
{
@@ -80,6 +81,7 @@ public sealed partial class OdSettingsViewModel : ObservableObject, IDisposable
_startup = startup;
_openFolder = openFolder;
Memory = memory;
WebApps = webApps;
About = about;
DataFolder = dataRoot.Root;
Load(settings.Current);
@@ -102,6 +104,8 @@ public sealed partial class OdSettingsViewModel : ObservableObject, IDisposable
public OdMemoryViewModel Memory { get; }
public OdWebAppsViewModel WebApps { get; }
public OdAboutViewModel About { get; }
public string DataFolder { get; }
@@ -142,6 +146,10 @@ public sealed partial class OdSettingsViewModel : ObservableObject, IDisposable
{
_ = About.CheckOnOpenAsync();
}
else if (value == (int)OdSettingsSection.WebApps)
{
WebApps.Refresh();
}
}
partial void OnLanguageChanged(string value) => Apply(s => s with { Language = value });
@@ -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);
+3 -2
View File
@@ -3,8 +3,9 @@ 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="Quit"/> runs: window closing must not turn into hiding.</summary>
/// <summary>Set once <see cref="QuitAsync"/> starts: window closing must not turn into hiding.</summary>
bool IsQuitting { get; }
void Quit();
/// <summary>Closes the open modules, then ends the app. Calls after the first do nothing.</summary>
Task QuitAsync();
}
+16 -3
View File
@@ -1,15 +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.</summary>
internal sealed class OdAppLifetime : IOdAppLifetime
/// <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 void Quit()
public async Task QuitAsync()
{
if (IsQuitting)
{
return;
}
IsQuitting = true;
await host.CloseAllAsync();
await web.WaitForExitAsync();
Application.Current?.Shutdown();
}
}
+32 -2
View File
@@ -1,4 +1,5 @@
using System.Windows;
using OmniDeck.Core.Localization;
using Wpf.Ui;
using Wpf.Ui.Controls;
@@ -13,6 +14,9 @@ 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;
@@ -27,17 +31,43 @@ public sealed class OdDialogs(IContentDialogService service)
_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);
_open++;
if (++_open == 1)
{
OpenChanged?.Invoke(this, EventArgs.Empty);
}
try
{
return await service.ShowAsync(dialog, CancellationToken.None);
}
finally
{
_open--;
if (--_open == 0)
{
OpenChanged?.Invoke(this, EventArgs.Empty);
}
}
}
}
+7
View File
@@ -13,6 +13,13 @@ internal static class OdExternal
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 });
@@ -68,6 +68,14 @@
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}}"
+24 -1
View File
@@ -6,6 +6,7 @@
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">
@@ -52,7 +53,10 @@
TextTrimming="CharacterEllipsis" />
<WrapPanel>
<TextBlock Margin="0,0,12,0" Text="{Binding StateText}" />
<TextBlock Foreground="{DynamicResource TextFillColorSecondaryBrush}" Text="{Binding LastUsedText}" />
<TextBlock Margin="0,0,12,0"
Foreground="{DynamicResource TextFillColorSecondaryBrush}"
Text="{Binding LastUsedText}" />
<TextBlock Foreground="{DynamicResource TextFillColorSecondaryBrush}" Text="{Binding MemoryText}" />
</WrapPanel>
</StackPanel>
</DockPanel>
@@ -87,6 +91,25 @@
</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>
+2 -2
View File
@@ -1,8 +1,8 @@
namespace OmniDeck.App.Shell;
/// <summary>
/// The task-manager panel, bound to <see cref="OdMemoryViewModel"/>. The sidebar footer opens it until
/// Settings → Memory exists (docs/RAM-GOVERNOR.md §5).
/// The task-manager panel, bound to <see cref="OdMemoryViewModel"/>, shown in Settings → Memory
/// (docs/RAM-GOVERNOR.md §5).
/// </summary>
public partial class OdMemoryPage
{
+11 -3
View File
@@ -1,4 +1,5 @@
using CommunityToolkit.Mvvm.ComponentModel;
using OmniDeck.Core.Governor;
using OmniDeck.Core.Localization;
using OmniDeck.Core.Modules;
@@ -13,6 +14,9 @@ public sealed partial class OdMemoryRowViewModel(OdHostedModule hosted) : Observ
[ObservableProperty]
private string _lastUsedText = "";
[ObservableProperty]
private string _memoryText = "";
[ObservableProperty]
private bool _keepRunning;
@@ -29,14 +33,18 @@ public sealed partial class OdMemoryRowViewModel(OdHostedModule hosted) : Observ
public string Id => hosted.Info.Id;
public string Title => OdLocalization.Get(hosted.Info.NameKey);
public string Title => hosted.Info.Title;
/// <summary>Re-reads the module's state; <paramref name="now"/> dates the last-used text.</summary>
public void Refresh(DateTimeOffset now, bool keepRunning)
/// <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;
+11 -1
View File
@@ -25,6 +25,12 @@ public sealed partial class OdMemoryViewModel : ObservableObject, IDisposable
[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);
@@ -49,11 +55,15 @@ public sealed partial class OdMemoryViewModel : ObservableObject, IDisposable
public void Refresh()
{
var now = _time.GetUtcNow();
var snapshot = _governor.Snapshot;
foreach (var row in Rows)
{
row.Refresh(now, _governor.IsKeptRunning(row.Id));
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));
@@ -10,6 +10,10 @@ public sealed partial class OdModuleItemViewModel(OdModuleInfo info) : Observabl
[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;
@@ -18,7 +22,7 @@ public sealed partial class OdModuleItemViewModel(OdModuleInfo info) : Observabl
public string Id => Info.Id;
public string Title => OdLocalization.Get(Info.NameKey);
public string Title => Info.Title;
public string Category => OdLocalization.Get(Info.CategoryKey);
@@ -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,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>
@@ -0,0 +1,143 @@
using System.ComponentModel;
using System.Windows;
using System.Windows.Input;
using System.Windows.Interop;
using System.Windows.Threading;
using OmniDeck.Core.Modules;
using OmniDeck.Core.Runtime;
using Wpf.Ui.Controls;
namespace OmniDeck.App.Shell;
/// <summary>
/// A module in a window of its own (docs/ARCHITECTURE.md §2): its view under a title bar with its name,
/// full screen as in the main window. The view moves rather than being built again, so the browser or
/// video it hosts keeps running. Before closing, the window lets go of the view and hands the windows it
/// owns to the main window: LibVLCSharp's video overlay is owned by the window its video is in, and
/// would close for good with it.
/// </summary>
public partial class OdPopOutWindow
{
private readonly Window _home;
private readonly OdWindowCover _cover;
private bool _released;
internal OdPopOutWindow(OdModuleItemViewModel item, FrameworkElement view, Window home)
{
InitializeComponent();
_home = home;
_cover = new OdWindowCover(this);
Title = item.Title;
PopOutTitleBar.Title = item.Title;
PopOutTitleBar.Icon = new SymbolIcon { Symbol = OdSymbolConverter.Parse(item.Info.Icon) };
Stage.Content = view;
AddHandler(OdFullscreen.RequestedEvent, new EventHandler<OdFullscreenRequestedEventArgs>(OnFullscreenRequested));
}
/// <summary>The user closed the window, which has let go of the view: the module goes back to the main window.</summary>
internal event EventHandler? Returned;
/// <summary>Where the window was, out of full screen, when it let go of the view.</summary>
internal Rect LastBounds { get; private set; }
/// <summary>Brings the window to the front, restored.</summary>
internal void Present()
{
if (WindowState == WindowState.Minimized)
{
WindowState = WindowState.Normal;
}
Activate();
}
/// <summary>Lets go of the view and closes: the module returns to the main window, or was closed.</summary>
internal void Release()
{
if (_released)
{
return;
}
LetGo();
Hide();
CloseSoon();
}
protected override void OnClosing(CancelEventArgs e)
{
ArgumentNullException.ThrowIfNull(e);
if (!_released && !Dispatcher.HasShutdownStarted)
{
// The view goes first, and the window closes once it is gone (CloseSoon).
e.Cancel = true;
LetGo();
Returned?.Invoke(this, EventArgs.Empty);
CloseSoon();
}
base.OnClosing(e);
}
private void LetGo()
{
_released = true;
SetFullscreen(on: false);
LastBounds = RestoreBounds;
Stage.Content = null;
}
// At a lower priority than the view's Unloaded, after which a video overlay no longer follows this
// window's closing; the windows it still owns move to the main window.
private void CloseSoon() => _ = Dispatcher.InvokeAsync(
() =>
{
foreach (var owned in OwnedWindows.Cast<Window>().ToList())
{
owned.Owner = _home;
}
Close();
},
DispatcherPriority.ContextIdle);
private void OnFullscreenRequested(object? sender, OdFullscreenRequestedEventArgs e)
{
e.Handled = true;
SetFullscreen(e.On);
}
private void OnPreviewKeyDown(object sender, KeyEventArgs e)
{
if (e.Key == Key.Escape && _cover.IsCovering)
{
e.Handled = true;
SetFullscreen(on: false);
}
}
private void SetFullscreen(bool on)
{
if (on == _cover.IsCovering)
{
return;
}
if (on)
{
if (!_cover.Cover(OdMonitors.BoundsOf(new WindowInteropHelper(this).Handle)))
{
return;
}
PopOutTitleBar.Visibility = Visibility.Collapsed;
}
else
{
_cover.Uncover();
PopOutTitleBar.Visibility = Visibility.Visible;
}
OdFullscreen.SetIsActive(Stage, on);
}
}
+74 -12
View File
@@ -11,10 +11,10 @@ using OmniDeck.Core.Settings;
namespace OmniDeck.App.Shell;
/// <summary>
/// The shell's state: what the sidebar lists, what is showing (a module or the library page) and the
/// view on the module stage. The navigation view is chrome only (docs/WPFUI-CONVENTIONS.md §5): every
/// navigation comes through <see cref="NavigateAsync"/> and the module host runs the module. Used from
/// the UI thread.
/// The shell's state: what the sidebar lists, what is showing (a module or the library page), the
/// view on the module stage, and which modules show in windows of their own. The navigation view is
/// chrome only (docs/WPFUI-CONVENTIONS.md §5): every navigation comes through <see cref="NavigateAsync"/>
/// and the module host runs the module. Used from the UI thread.
/// </summary>
public sealed partial class OdShellViewModel : ObservableObject, IDisposable
{
@@ -58,6 +58,15 @@ public sealed partial class OdShellViewModel : ObservableObject, IDisposable
/// <summary>Raised when a settings tab should come to the front, such as the palette's "Running modules".</summary>
public event EventHandler<OdSettingsSectionEventArgs>? SettingsSectionRequested;
/// <summary>A module moved into a window of its own, which shows <see cref="OdPopOutEventArgs.View"/>.</summary>
public event EventHandler<OdPopOutEventArgs>? PopOutOpened;
/// <summary>A module in a window of its own was asked for: that window comes to the front.</summary>
public event EventHandler<OdPopOutEventArgs>? PopOutActivationRequested;
/// <summary>A module's own window must let go of the view and close: the module returns to the main window, or closed.</summary>
public event EventHandler<OdPopOutEventArgs>? PopOutCloseRequested;
/// <summary>Every module, in registration order: the library page.</summary>
public IReadOnlyList<OdModuleItemViewModel> Library { get; }
@@ -111,7 +120,10 @@ public sealed partial class OdShellViewModel : ObservableObject, IDisposable
return position >= 0 && position < visible.Count ? visible[position].Id : null;
}
/// <summary>Shows <paramref name="target"/>: a module id, or one of the shell's own pages. Other targets are ignored.</summary>
/// <summary>
/// Shows <paramref name="target"/>: a module id, or one of the shell's own pages. A module in a window of
/// its own stays there, and its window comes to the front. Other targets are ignored.
/// </summary>
public async Task NavigateAsync(string target)
{
ArgumentNullException.ThrowIfNull(target);
@@ -121,8 +133,14 @@ public sealed partial class OdShellViewModel : ObservableObject, IDisposable
CurrentView = null;
CurrentTarget = target;
}
else if (_items.ContainsKey(target))
else if (_items.TryGetValue(target, out var item))
{
if (item.IsPoppedOut)
{
PopOutActivationRequested?.Invoke(this, new OdPopOutEventArgs(item));
return;
}
CurrentView = await _host.ShowAsync(target);
CurrentTarget = target;
}
@@ -142,6 +160,13 @@ public sealed partial class OdShellViewModel : ObservableObject, IDisposable
];
}
/// <summary>The user closed a module's own window: the module goes back to the main window, hidden.</summary>
public Task DockAsync(OdModuleItemViewModel item)
{
ArgumentNullException.ThrowIfNull(item);
return _host.DockAsync(item.Id);
}
public void Dispose()
{
_host.StateChanged -= OnModuleStateChanged;
@@ -155,6 +180,40 @@ public sealed partial class OdShellViewModel : ObservableObject, IDisposable
[RelayCommand]
private Task CloseAsync(OdModuleItemViewModel item) => _host.CloseAsync(item.Id);
/// <summary>Moves a module into a window of its own; a main window that showed it shows the library instead.</summary>
[RelayCommand]
private async Task PopOutAsync(OdModuleItemViewModel item)
{
if (item.IsPoppedOut)
{
PopOutActivationRequested?.Invoke(this, new OdPopOutEventArgs(item));
return;
}
if (string.Equals(item.Id, CurrentTarget, StringComparison.Ordinal))
{
// A view is in one window at a time: the main window lets go of it first.
await NavigateAsync(LibraryTarget);
}
var view = await _host.PopOutAsync(item.Id);
PopOutOpened?.Invoke(this, new OdPopOutEventArgs(item, view));
}
/// <summary>Brings a module back from its own window and shows it in the main window.</summary>
[RelayCommand]
private async Task PopInAsync(OdModuleItemViewModel item)
{
if (!item.IsPoppedOut)
{
return;
}
PopOutCloseRequested?.Invoke(this, new OdPopOutEventArgs(item));
await _host.DockAsync(item.Id);
await NavigateAsync(item.Id);
}
[RelayCommand]
private void TogglePin(OdModuleItemViewModel item) => _settings.Update(s => s with
{
@@ -169,11 +228,7 @@ public sealed partial class OdShellViewModel : ObservableObject, IDisposable
return NavigateAsync(SettingsTarget);
}
private Task QuitAsync()
{
_lifetime.Quit();
return Task.CompletedTask;
}
private Task QuitAsync() => _lifetime.QuitAsync();
private void OnModuleStateChanged(object? sender, OdModuleStateChangedEventArgs e)
{
@@ -182,11 +237,18 @@ public sealed partial class OdShellViewModel : ObservableObject, IDisposable
return;
}
var wasPoppedOut = item.IsPoppedOut;
item.State = e.Module.State;
item.IsPoppedOut = e.Module.IsPoppedOut;
if (!item.IsOpen)
{
_openOrder.Remove(item);
if (string.Equals(item.Id, CurrentTarget, StringComparison.Ordinal))
if (wasPoppedOut)
{
// Closed in its own window: the window goes too.
PopOutCloseRequested?.Invoke(this, new OdPopOutEventArgs(item));
}
else if (string.Equals(item.Id, CurrentTarget, StringComparison.Ordinal))
{
// Closed while showing: the library takes its place.
CurrentView = null;
+143
View File
@@ -0,0 +1,143 @@
using System.Globalization;
using System.IO;
using System.Text;
using System.Windows;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using H.NotifyIcon.Interop;
namespace OmniDeck.App.Shell;
/// <summary>
/// Draws the tray icon, a bold "O" on the accent color, and redraws it only when the colors change.
/// H.NotifyIcon's <c>GeneratedIconSource</c> is not used: in 2.4.1 every redraw leaks an icon handle
/// and every brush change adds one more redraw handler, so a few accent changes used up the process's
/// GDI objects ("A generic error occurred in GDI+"). These icons are read from ICO bytes, so each one
/// owns its handle, and the taskbar icon disposes the previous icon when the next one is set.
/// </summary>
internal sealed class OdTrayIcon
{
// The first accent swatch in Settings → Appearance, for a theme that offers no accent brush.
private static readonly Color FallbackAccent = Color.FromRgb(0x00, 0x67, 0xC0);
private (Color Background, Color Foreground)? _drawn;
/// <summary>
/// A new icon in the theme's colors, or null when they match the icon drawn last. The caller hands
/// it to the taskbar icon, which owns it from then on.
/// </summary>
public System.Drawing.Icon? Update(Brush? accent, Brush? textOnAccent)
{
var colors = ColorsFrom(accent, textOnAccent);
if (_drawn == colors)
{
return null;
}
var icon = Create(colors.Background, colors.Foreground, RequiredSize());
_drawn = colors;
return icon;
}
/// <summary>The colors to draw with: the theme's, or the first swatch with a readable text color.</summary>
internal static (Color Background, Color Foreground) ColorsFrom(Brush? accent, Brush? textOnAccent)
{
var background = accent is SolidColorBrush solidAccent ? solidAccent.Color : FallbackAccent;
var foreground = textOnAccent is SolidColorBrush solidText ? solidText.Color : ContrastingText(background);
return (background, foreground);
}
/// <summary>Black or white, whichever reads better on <paramref name="background"/>.</summary>
internal static Color ContrastingText(Color background)
{
// Rec. 709 luma; the midpoint is good enough for one bold letter.
var luma = (0.2126 * background.R) + (0.7152 * background.G) + (0.0722 * background.B);
return luma > 128 ? Colors.Black : Colors.White;
}
/// <summary>The small-icon size in pixels, which is what the notification area shows.</summary>
internal static int RequiredSize() => Math.Max(16, IconUtilities.GetRequiredCustomIconSize(largeIcon: false).Width);
/// <summary>A square icon of <paramref name="size"/> pixels that owns its handle.</summary>
internal static System.Drawing.Icon Create(Color background, Color foreground, int size) =>
FromIco(ToIco(RenderPng(background, foreground, size), size), size);
/// <summary>
/// Reads an icon from ICO bytes. An icon read this way owns its handle, so disposing it destroys the
/// handle; <c>Icon.FromHandle</c> would not, which is the leak this class exists to avoid.
/// </summary>
internal static System.Drawing.Icon FromIco(byte[] ico, int size)
{
using var stream = new MemoryStream(ico, writable: false);
return new System.Drawing.Icon(stream, size, size);
}
/// <summary>Renders the icon with WPF, so no GDI+ is involved, and encodes it as PNG.</summary>
internal static byte[] RenderPng(Color background, Color foreground, int size)
{
var visual = new DrawingVisual();
using (var context = visual.RenderOpen())
{
var corner = size / 8.0;
context.DrawRoundedRectangle(Frozen(background), null, new Rect(0, 0, size, size), corner, corner);
var text = new FormattedText(
"O",
CultureInfo.InvariantCulture,
FlowDirection.LeftToRight,
new Typeface(SystemFonts.MessageFontFamily, FontStyles.Normal, FontWeights.Bold, FontStretches.Normal),
size * 0.8,
Brushes.Black,
pixelsPerDip: 1.0);
var glyph = text.BuildGeometry(default);
var bounds = glyph.Bounds;
context.PushTransform(new TranslateTransform(((size - bounds.Width) / 2) - bounds.X, ((size - bounds.Height) / 2) - bounds.Y));
context.DrawGeometry(Frozen(foreground), null, glyph);
context.Pop();
}
var bitmap = new RenderTargetBitmap(size, size, 96, 96, PixelFormats.Pbgra32);
bitmap.Render(visual);
var encoder = new PngBitmapEncoder();
encoder.Frames.Add(BitmapFrame.Create(bitmap));
using var png = new MemoryStream();
encoder.Save(png);
return png.ToArray();
}
/// <summary>Wraps a PNG in a one-image ICO file; Windows reads PNG-compressed icon images.</summary>
internal static byte[] ToIco(byte[] png, int size)
{
const int headerLength = 6 + 16;
var dimension = (byte)(size >= 256 ? 0 : size);
using var ico = new MemoryStream(headerLength + png.Length);
using (var writer = new BinaryWriter(ico, Encoding.ASCII, leaveOpen: true))
{
// ICONDIR: reserved, type 1 (icon), one image.
writer.Write((ushort)0);
writer.Write((ushort)1);
writer.Write((ushort)1);
// ICONDIRENTRY: width, height (0 means 256), no palette, reserved, 1 plane, 32 bits per
// pixel, then the image's length and where it starts.
writer.Write(dimension);
writer.Write(dimension);
writer.Write((byte)0);
writer.Write((byte)0);
writer.Write((ushort)1);
writer.Write((ushort)32);
writer.Write(png.Length);
writer.Write(headerLength);
writer.Write(png);
}
return ico.ToArray();
}
private static SolidColorBrush Frozen(Color color)
{
var brush = new SolidColorBrush(color);
brush.Freeze();
return brush;
}
}
+20 -4
View File
@@ -7,12 +7,18 @@ namespace OmniDeck.App.Shell;
/// <see cref="IOdNotifier"/> through the tray icon's balloon, which Windows 11 shows as a toast.
/// WinRT toasts would need a Windows-versioned target framework and its 26 MB projection assembly
/// (docs/spikes/05-theme-swap.md). The main window attaches the icon; until then notifications are
/// only logged.
/// only logged. Windows reports a click on the latest balloon only, so a click opens what that
/// notification names.
/// </summary>
public sealed class OdTrayNotifier(ILogger log) : IOdNotifier
{
private readonly ILogger _log = log.ForContext<OdTrayNotifier>();
private Action<string, string>? _show;
private string? _lastTarget;
private Action? _lastClicked;
/// <summary>The user clicked the latest notification.</summary>
public event EventHandler<OdNotificationClickedEventArgs>? Clicked;
public void Attach(Action<string, string> show)
{
@@ -20,14 +26,24 @@ public sealed class OdTrayNotifier(ILogger log) : IOdNotifier
_show = show;
}
public void Notify(string title, string message)
public void Notify(OdNotification notification)
{
ArgumentNullException.ThrowIfNull(notification);
if (_show is null)
{
_log.Information("Notification before the tray icon exists: {Title}", title);
_log.Information("Notification before the tray icon exists: {Title}", notification.Title);
return;
}
_show(title, message);
_lastTarget = notification.Target;
_lastClicked = notification.Clicked;
_show(notification.Title, notification.Message);
}
/// <summary>Called by the tray icon when its balloon is clicked: opens what it names, then runs its own click.</summary>
public void OnClicked()
{
Clicked?.Invoke(this, new OdNotificationClickedEventArgs(_lastTarget));
_lastClicked?.Invoke();
}
}
+66
View File
@@ -0,0 +1,66 @@
using System.Windows;
using System.Windows.Media;
using Wpf.Ui.Controls;
namespace OmniDeck.App.Shell;
/// <summary>
/// Makes a window cover a monitor, on top with square corners, and puts it back where it was
/// (docs/spikes/06-libvlcsharp.md: the window covers the screen; the player never moves). Hiding the
/// window's own chrome is up to the window.
/// </summary>
internal sealed class OdWindowCover(FluentWindow window)
{
private OdWindowPlacement? _before;
public bool IsCovering => _before is not null;
/// <summary>Covers <paramref name="monitor"/>, in device pixels; false, changing nothing, if it is empty or the window covers one already.</summary>
public bool Cover(Int32Rect monitor)
{
if (_before is not null || monitor.IsEmpty)
{
return false;
}
_before = new OdWindowPlacement(
window.WindowState,
window.Left,
window.Top,
window.Width,
window.Height,
window.Topmost,
window.ResizeMode,
window.WindowCornerPreference);
var dpi = VisualTreeHelper.GetDpi(window);
window.WindowState = WindowState.Normal;
window.WindowCornerPreference = WindowCornerPreference.DoNotRound;
window.ResizeMode = ResizeMode.NoResize;
window.Topmost = true;
window.Left = monitor.X / dpi.DpiScaleX;
window.Top = monitor.Y / dpi.DpiScaleY;
window.Width = monitor.Width / dpi.DpiScaleX;
window.Height = monitor.Height / dpi.DpiScaleY;
return true;
}
/// <summary>Puts the window back as it was; false if it covered nothing.</summary>
public bool Uncover()
{
if (_before is not { } before)
{
return false;
}
_before = null;
window.WindowCornerPreference = before.Corners;
window.Topmost = before.Topmost;
window.ResizeMode = before.Resize;
window.Left = before.Left;
window.Top = before.Top;
window.Width = before.Width;
window.Height = before.Height;
window.WindowState = before.State;
return true;
}
}
@@ -0,0 +1,15 @@
using System.Windows;
using Wpf.Ui.Controls;
namespace OmniDeck.App.Shell;
/// <summary>Where a window was, and how it looked, before it covered the screen.</summary>
internal sealed record OdWindowPlacement(
WindowState State,
double Left,
double Top,
double Width,
double Height,
bool Topmost,
ResizeMode Resize,
WindowCornerPreference Corners);
+22
View File
@@ -0,0 +1,22 @@
using System.Windows;
using System.Windows.Media;
using Wpf.Ui.Appearance;
namespace OmniDeck.App.Theming;
/// <summary>
/// The parts of Windows' look that OmniDeck follows: dark or light, the accent color, High Contrast
/// and animations. The theme is applied again only when one of them changes.
/// </summary>
internal readonly record struct OdSystemLook(SystemTheme Theme, Color Accent, bool HighContrast, bool Animations)
{
public static OdSystemLook Read()
{
SystemThemeManager.UpdateSystemThemeCache();
return new OdSystemLook(
SystemThemeManager.GetCachedSystemTheme(),
ApplicationAccentColorManager.GetColorizationColor(),
SystemParameters.HighContrast,
SystemParameters.ClientAreaAnimation);
}
}
+70 -14
View File
@@ -20,6 +20,7 @@ public sealed class OdThemeEngine : IDisposable
private readonly ILogger _log;
private Application? _app;
private OdSettings? _applied;
private OdSystemLook? _systemLook;
private double _textScale = 1.0;
public OdThemeEngine(IOdSettingsService settings, ILogger log)
@@ -41,6 +42,7 @@ public sealed class OdThemeEngine : IDisposable
ArgumentNullException.ThrowIfNull(app);
_app = app;
_applied = _settings.Current;
_systemLook = OdSystemLook.Read();
_textScale = OdTextScale.Read();
ApplyTheme();
ApplyTokens();
@@ -59,6 +61,21 @@ public sealed class OdThemeEngine : IDisposable
}
}
/// <summary>
/// Records Windows' look as it is <paramref name="now"/>; true when it differs from the look the
/// theme was last applied for.
/// </summary>
internal bool NoteSystemLook(OdSystemLook now)
{
if (_systemLook == now)
{
return false;
}
_systemLook = now;
return true;
}
public void Dispose()
{
_settings.Changed -= OnSettingsChanged;
@@ -83,26 +100,59 @@ public sealed class OdThemeEngine : IDisposable
Applied?.Invoke(this, EventArgs.Empty);
}
/// <summary>
/// What <see cref="ApplyTheme"/> applies: whether the theme follows Windows, the theme the user's
/// accent is worked out for, and that accent, or null to use the Windows one.
/// </summary>
internal static (bool FollowSystem, ApplicationTheme Theme, Color? Accent) Choose(
OdThemeMode mode,
string accentColor,
bool highContrast,
Func<ApplicationTheme> systemTheme)
{
// High Contrast: palette tokens, the user's accent included, defer to the system entirely (docs/UI-MODES.md §4).
var followSystem = mode == OdThemeMode.System || highContrast;
Color? accent = !highContrast && accentColor.Length > 0 && ColorConverter.ConvertFromString(accentColor) is Color parsed ? parsed : null;
var theme = mode switch
{
OdThemeMode.Light when !highContrast => ApplicationTheme.Light,
OdThemeMode.Dark when !highContrast => ApplicationTheme.Dark,
_ => systemTheme(),
};
return (followSystem, theme, accent);
}
private static ApplicationTheme SystemAppTheme()
{
SystemThemeManager.UpdateSystemThemeCache();
return SystemThemeManager.GetCachedSystemTheme() switch
{
SystemTheme.Dark or SystemTheme.CapturedMotion or SystemTheme.Glow => ApplicationTheme.Dark,
SystemTheme.HC1 or SystemTheme.HC2 or SystemTheme.HCBlack or SystemTheme.HCWhite => ApplicationTheme.HighContrast,
_ => ApplicationTheme.Light,
};
}
private void ApplyTheme()
{
var settings = _settings.Current;
var (followSystem, theme, accent) = Choose(settings.Theme, settings.AccentColor, SystemParameters.HighContrast, SystemAppTheme);
// High Contrast: palette tokens, the user's accent included, defer to the system entirely (docs/UI-MODES.md §4).
var highContrast = SystemParameters.HighContrast;
var systemAccent = settings.AccentColor.Length == 0 || highContrast;
if (settings.Theme == OdThemeMode.System || highContrast)
// The user's accent goes first, as WPF-UI applies the Windows one: the theme dictionaries' accent
// brushes (the toggle switches', for one) take the accent colors as they load, so an accent
// applied after them showed up one pick late.
if (accent is { } color)
{
ApplicationThemeManager.ApplySystemTheme(updateAccent: systemAccent);
ApplicationAccentColorManager.Apply(color, theme);
}
if (followSystem)
{
ApplicationThemeManager.ApplySystemTheme(updateAccent: accent is null);
}
else
{
var theme = settings.Theme == OdThemeMode.Light ? ApplicationTheme.Light : ApplicationTheme.Dark;
ApplicationThemeManager.Apply(theme, WindowBackdropType.Mica, updateAccent: systemAccent);
}
if (!systemAccent && ColorConverter.ConvertFromString(settings.AccentColor) is Color accent)
{
ApplicationAccentColorManager.Apply(accent, ApplicationThemeManager.GetAppTheme());
ApplicationThemeManager.Apply(theme, WindowBackdropType.Mica, updateAccent: accent is null);
}
}
@@ -126,11 +176,17 @@ public sealed class OdThemeEngine : IDisposable
{
if (e.Category is UserPreferenceCategory.General or UserPreferenceCategory.Color or UserPreferenceCategory.Accessibility or UserPreferenceCategory.VisualStyle)
{
// Windows sends this for many unrelated settings, and applying the theme again re-styles every
// window, so it happens only when the look OmniDeck follows has changed.
_ = _app?.Dispatcher.InvokeAsync(() =>
{
ApplyTheme();
if (NoteSystemLook(OdSystemLook.Read()))
{
ApplyTheme();
ApplyTokens();
}
RefreshTextScale();
ApplyTokens();
});
}
}
+3 -2
View File
@@ -7,8 +7,9 @@ public interface IOdMemory
long PhysicalBytes { get; }
/// <summary>
/// Private commit of the processes OmniDeck runs: the shell in P1; the WebView2 processes join it
/// in P2. Unlike the working set, it does not drop when Windows merely trims pages.
/// Private commit of OmniDeck's own process, where the shell and the built-in modules run; the
/// processes it starts besides come from <see cref="IOdMemoryReporter"/>. Unlike the working set,
/// it does not drop when Windows merely trims pages.
/// </summary>
long CommittedBytes();
@@ -0,0 +1,10 @@
namespace OmniDeck.Core.Governor;
/// <summary>
/// Measures processes OmniDeck runs besides its own, for the governor (docs/RAM-GOVERNOR.md §4): the
/// web runner reports the WebView2 processes. Called on the UI thread, once per pass.
/// </summary>
public interface IOdMemoryReporter
{
Task<OdMemoryReport> ReportAsync();
}
@@ -1,9 +1,12 @@
namespace OmniDeck.Core.Governor;
/// <summary>A governor pass finished: what OmniDeck uses now, against which limits.</summary>
public sealed class OdGovernorSampledEventArgs(long committedBytes, OdGovernorOptions options) : EventArgs
public sealed class OdGovernorSampledEventArgs(OdMemorySnapshot snapshot, OdGovernorOptions options) : EventArgs
{
public long CommittedBytes { get; } = committedBytes;
/// <summary>What the pass measured, less what it hibernated.</summary>
public OdMemorySnapshot Snapshot { get; } = snapshot;
public long CommittedBytes => Snapshot.TotalBytes;
public OdGovernorOptions Options { get; } = options;
}
@@ -0,0 +1,10 @@
namespace OmniDeck.Core.Governor;
/// <summary>What one <see cref="IOdMemoryReporter"/> measured, as private commit.</summary>
/// <param name="SharedBytes">Processes no single module owns, such as WebView2's browser and GPU processes.</param>
/// <param name="Modules">Each module's own processes, by module id; an open module whose processes are not up yet has 0.</param>
public sealed record OdMemoryReport(long SharedBytes, IReadOnlyDictionary<string, long> Modules)
{
/// <summary>Nothing running.</summary>
public static OdMemoryReport None { get; } = new(0, new Dictionary<string, long>(StringComparer.Ordinal));
}
@@ -0,0 +1,32 @@
namespace OmniDeck.Core.Governor;
/// <summary>
/// The private commit one governor pass measured (docs/RAM-GOVERNOR.md §4): OmniDeck's own process,
/// the processes the web apps share, and each web app's own.
/// </summary>
/// <param name="ShellBytes">OmniDeck's own process, which the built-in modules share.</param>
/// <param name="SharedBytes">Processes no single module owns: WebView2's browser, GPU and utility processes.</param>
/// <param name="Modules">What each module that runs processes of its own uses, by module id.</param>
public sealed record OdMemorySnapshot(long ShellBytes, long SharedBytes, IReadOnlyDictionary<string, long> Modules)
{
public long TotalBytes => ShellBytes + SharedBytes + Modules.Values.Sum();
/// <summary>What <paramref name="moduleId"/> uses on its own; null for a module that runs in OmniDeck's process.</summary>
public long? For(string moduleId) => Modules.TryGetValue(moduleId, out var bytes) ? bytes : null;
/// <summary>
/// The figures once <paramref name="moduleId"/> has let go of its processes, which takes them a
/// moment to exit, so the next pass measures again; with no web app left, the shared processes exit
/// too. <paramref name="shellBytes"/> is OmniDeck's own process, measured again.
/// </summary>
internal OdMemorySnapshot Without(string moduleId, long shellBytes)
{
if (!Modules.ContainsKey(moduleId))
{
return this with { ShellBytes = shellBytes };
}
var modules = Modules.Where(pair => !string.Equals(pair.Key, moduleId, StringComparison.Ordinal)).ToDictionary(StringComparer.Ordinal);
return new OdMemorySnapshot(shellBytes, modules.Count > 0 ? SharedBytes : 0, modules);
}
}
@@ -4,7 +4,7 @@ using System.Runtime;
namespace OmniDeck.Core.Governor;
/// <summary><see cref="IOdMemory"/> for this process (P1: native modules run in the shell).</summary>
/// <summary><see cref="IOdMemory"/> for this process, where the shell and the built-in modules run.</summary>
public sealed class OdProcessMemory : IOdMemory
{
public long PhysicalBytes { get; } = GC.GetGCMemoryInfo().TotalAvailableMemoryBytes;
+135 -46
View File
@@ -7,31 +7,41 @@ namespace OmniDeck.Core.Governor;
/// <summary>
/// The RAM governor (docs/RAM-GOVERNOR.md). Every poll it moves hidden modules down the ladder by
/// how long they have been hidden, then enforces the caps on OmniDeck's private commit: above the
/// soft cap it hibernates the least recently used module, above the hard cap as many as it takes,
/// and says so once. Modules the user keeps running, and modules that refuse to suspend, are never
/// demoted. It works through <see cref="OdModuleHost"/> on the UI thread; the task-manager panel uses
/// the same methods.
/// how long they have been hidden, then enforces the caps on the private commit of OmniDeck's own
/// process and of the processes the memory reporters follow, the web runner's: above the soft cap it
/// hibernates the least recently used module, above the hard cap as many as it takes, and says so
/// once. Modules the user keeps running, and modules that refuse to suspend, are never demoted;
/// modules that work while hidden (<see cref="IOdResidency"/>) give way only to the caps. It works
/// through <see cref="OdModuleHost"/> on the UI thread; the task-manager panel uses the same methods.
/// </summary>
public sealed class OdRamGovernor : IDisposable
{
private readonly OdModuleHost _host;
private readonly IOdSettingsService _settings;
private readonly IOdMemory _memory;
private readonly IReadOnlyList<IOdMemoryReporter> _reporters;
private readonly TimeProvider _time;
private readonly IOdNotifier _notifier;
private readonly ILogger _log;
private ITimer? _timer;
private long? _sampled;
private bool _warnedAboveHardCap;
private int _ticking;
public OdRamGovernor(OdModuleHost host, IOdSettingsService settings, IOdMemory memory, TimeProvider time, IOdNotifier notifier, ILogger log)
public OdRamGovernor(
OdModuleHost host,
IOdSettingsService settings,
IOdMemory memory,
IEnumerable<IOdMemoryReporter> reporters,
TimeProvider time,
IOdNotifier notifier,
ILogger log)
{
ArgumentNullException.ThrowIfNull(reporters);
ArgumentNullException.ThrowIfNull(log);
_host = host;
_settings = settings;
_memory = memory;
_reporters = [.. reporters];
_time = time;
_notifier = notifier;
_log = log.ForContext<OdRamGovernor>();
@@ -43,8 +53,11 @@ public sealed class OdRamGovernor : IDisposable
/// <summary>The thresholds in effect, from the settings and this machine's memory.</summary>
public OdGovernorOptions Options => OdGovernorOptions.From(_settings.Current.Memory, _memory.PhysicalBytes);
/// <summary>OmniDeck's private commit at the last pass, or now if no pass ran yet.</summary>
public long CommittedBytes => _sampled ?? _memory.CommittedBytes();
/// <summary>What the last pass measured, less what it hibernated; null before the first pass.</summary>
public OdMemorySnapshot? Snapshot { get; private set; }
/// <summary>OmniDeck's private commit at the last pass, or its own process's now if no pass ran yet.</summary>
public long CommittedBytes => Snapshot?.TotalBytes ?? _memory.CommittedBytes();
public bool IsKeptRunning(string moduleId) => _settings.Current.Memory.KeepRunning.Contains(moduleId, StringComparer.Ordinal);
@@ -84,7 +97,7 @@ public sealed class OdRamGovernor : IDisposable
var options = Options;
var now = _time.GetUtcNow();
var demoted = false;
foreach (var hosted in Demotable())
foreach (var hosted in Demotable().Where(hosted => !StaysResident(hosted)))
{
var hiddenFor = now - hosted.LastActive;
if (hiddenFor >= options.HibernateAfter)
@@ -102,23 +115,23 @@ public sealed class OdRamGovernor : IDisposable
_memory.Reclaim();
}
var bytes = _memory.CommittedBytes();
if (bytes > options.HardCapBytes)
var snapshot = await MeasureAsync();
if (snapshot.TotalBytes > options.HardCapBytes)
{
bytes = await EnforceHardCapAsync(options, bytes);
snapshot = await EnforceHardCapAsync(options, snapshot);
}
else
{
_warnedAboveHardCap = false;
if (bytes > options.SoftCapBytes && await HibernateOneAsync(options))
if (snapshot.TotalBytes > options.SoftCapBytes && await HibernateOneAsync(options, snapshot) is { } hibernated)
{
_memory.Reclaim();
bytes = _memory.CommittedBytes();
snapshot = snapshot.Without(hibernated, _memory.CommittedBytes());
}
}
_sampled = bytes;
Sampled?.Invoke(this, new OdGovernorSampledEventArgs(bytes, options));
Snapshot = snapshot;
Sampled?.Invoke(this, new OdGovernorSampledEventArgs(snapshot, options));
}
/// <summary>The panel's Suspend button.</summary>
@@ -145,6 +158,8 @@ public sealed class OdRamGovernor : IDisposable
public void Dispose() => _timer?.Dispose();
private static bool StaysResident(OdHostedModule hosted) => hosted.Module is IOdResidency { StaysResident: true };
private void Poll() => _ = PollAsync();
private async Task PollAsync()
@@ -170,70 +185,144 @@ public sealed class OdRamGovernor : IDisposable
}
}
/// <summary>OmniDeck's own process, plus what every reporter follows; a reporter that fails is left out of this pass.</summary>
private async Task<OdMemorySnapshot> MeasureAsync()
{
var shared = 0L;
var modules = new Dictionary<string, long>(StringComparer.Ordinal);
foreach (var reporter in _reporters)
{
OdMemoryReport report;
try
{
report = await reporter.ReportAsync();
}
catch (Exception ex) when (ex is not OutOfMemoryException)
{
_log.Warning(ex, "A memory reporter failed; its processes are left out of this pass");
continue;
}
shared += report.SharedBytes;
foreach (var (moduleId, bytes) in report.Modules)
{
modules[moduleId] = modules.GetValueOrDefault(moduleId) + bytes;
}
}
return new OdMemorySnapshot(_memory.CommittedBytes(), shared, modules);
}
/// <summary>Hidden, live modules the user did not keep running: the only ones the governor may demote.</summary>
private List<OdHostedModule> Demotable() =>
[.. _host.Modules.Where(hosted => (hosted.State is OdModuleState.Idle or OdModuleState.Suspended) && !IsKeptRunning(hosted.Info.Id))];
/// <summary>
/// Least recently used first. Recency counts in poll intervals: modules hidden within the same
/// interval are equally recent, and then the heavy one goes first.
/// The order the caps take modules in: those that work while hidden last, then the least recently
/// used first. Recency counts in poll intervals: among modules hidden within the same interval the
/// heavy one goes first, and then the one that uses more.
/// </summary>
private IEnumerable<OdHostedModule> Victims(OdGovernorOptions options)
private List<OdHostedModule> Victims(OdGovernorOptions options, OdMemorySnapshot snapshot)
{
var now = _time.GetUtcNow();
return Demotable()
.OrderByDescending(hosted => (now - hosted.LastActive).Ticks / options.PollInterval.Ticks)
.ThenBy(hosted => hosted.Info.RamClass == OdRamClass.Heavy ? 0 : 1);
return
[
.. Demotable()
.OrderBy(hosted => StaysResident(hosted) ? 1 : 0)
.ThenByDescending(hosted => (now - hosted.LastActive).Ticks / options.PollInterval.Ticks)
.ThenBy(hosted => hosted.Info.RamClass == OdRamClass.Heavy ? 0 : 1)
.ThenByDescending(hosted => snapshot.For(hosted.Info.Id) ?? 0),
];
}
private async Task<bool> HibernateOneAsync(OdGovernorOptions options)
/// <summary>Hibernates the first victim that agrees; returns its id.</summary>
private async Task<string?> HibernateOneAsync(OdGovernorOptions options, OdMemorySnapshot snapshot)
{
foreach (var id in Victims(options).Select(hosted => hosted.Info.Id))
foreach (var hosted in Victims(options, snapshot))
{
if (await _host.HibernateAsync(id))
var resident = StaysResident(hosted);
if (await _host.HibernateAsync(hosted.Info.Id))
{
_log.Information("Above the soft cap: hibernated {ModuleId}", id);
return true;
_log.Information("Above the soft cap: hibernated {ModuleId}", hosted.Info.Id);
TellIfResident(hosted, resident);
return hosted.Info.Id;
}
}
return false;
return null;
}
private async Task<long> EnforceHardCapAsync(OdGovernorOptions options, long bytes)
private async Task<OdMemorySnapshot> EnforceHardCapAsync(OdGovernorOptions options, OdMemorySnapshot snapshot)
{
var hibernated = 0;
foreach (var id in Victims(options).Select(hosted => hosted.Info.Id))
var limit = OdBytes.Format(options.HardCapBytes);
var victims = Victims(options, snapshot);
if (SharedHoldsTheCap(options, snapshot, victims))
{
if (bytes <= options.HardCapBytes)
_log.Warning("Above the hard cap, held there by {Shared} of shared WebView2 processes: nothing hibernated", snapshot.SharedBytes);
Warn(OdLocalization.Format("Governor_HardCapShared", limit, OdBytes.Format(snapshot.SharedBytes)));
return snapshot;
}
var hibernated = 0;
foreach (var hosted in victims)
{
if (snapshot.TotalBytes <= options.HardCapBytes)
{
break;
}
if (await _host.HibernateAsync(id))
var resident = StaysResident(hosted);
if (await _host.HibernateAsync(hosted.Info.Id))
{
hibernated++;
TellIfResident(hosted, resident);
_memory.Reclaim();
bytes = _memory.CommittedBytes();
snapshot = snapshot.Without(hosted.Info.Id, _memory.CommittedBytes());
}
}
_log.Warning("Above the hard cap: hibernated {Count} modules, {Committed} committed", hibernated, bytes);
_log.Warning("Above the hard cap: hibernated {Count} modules, {Committed} committed", hibernated, snapshot.TotalBytes);
Warn(hibernated switch
{
0 => OdLocalization.Format("Governor_HardCapKept", limit),
1 => OdLocalization.Format("Governor_HardCapHibernatedOne", limit),
_ => OdLocalization.Format("Governor_HardCapHibernated", hibernated, limit),
});
return snapshot;
}
// One notification per excursion above the cap, not one per poll.
/// <summary>
/// Whether OmniDeck stays above the hard cap even once every victim is hibernated, because the web
/// apps that remain keep the shared WebView2 processes, whose GPU process grows with video: then
/// hibernating would close apps for nothing.
/// </summary>
private static bool SharedHoldsTheCap(OdGovernorOptions options, OdMemorySnapshot snapshot, List<OdHostedModule> victims)
{
var staying = snapshot.Modules
.Where(pair => !victims.Exists(hosted => string.Equals(hosted.Info.Id, pair.Key, StringComparison.Ordinal)))
.ToList();
return staying.Count > 0 && snapshot.ShellBytes + snapshot.SharedBytes + staying.Sum(pair => pair.Value) > options.HardCapBytes;
}
/// <summary>A module that worked while hidden stops doing so: its notifications, for one. Clicking reopens it.</summary>
private void TellIfResident(OdHostedModule hosted, bool resident)
{
if (resident)
{
_notifier.Notify(new OdNotification(
OdLocalization.Format("Governor_ResidentHibernatedTitle", hosted.Info.Title),
OdLocalization.Get("Governor_ResidentHibernated"),
hosted.Info.Id));
}
}
/// <summary>One notification per excursion above the hard cap, not one per poll.</summary>
private void Warn(string message)
{
if (!_warnedAboveHardCap)
{
_warnedAboveHardCap = true;
var limit = OdBytes.Format(options.HardCapBytes);
var message = hibernated switch
{
0 => OdLocalization.Format("Governor_HardCapKept", limit),
1 => OdLocalization.Format("Governor_HardCapHibernatedOne", limit),
_ => OdLocalization.Format("Governor_HardCapHibernated", hibernated, limit),
};
_notifier.Notify(OdLocalization.Get("Governor_HardCapTitle"), message);
}
return bytes;
}
}
@@ -0,0 +1,19 @@
namespace OmniDeck.Core.Modules;
/// <summary>
/// A module that plays media, which the tray menu controls while something is loaded
/// (docs/SPEC.md §2: "media controls when playing").
/// </summary>
public interface IOdMediaControls
{
/// <summary>What is loaded and ready to play or pause, or null when nothing is.</summary>
string? NowPlaying { get; }
bool IsPlaying { get; }
void PlayPause();
void Next();
void Previous();
}
+18 -1
View File
@@ -1,3 +1,5 @@
using System.Net.Http;
using OmniDeck.Core.Storage;
using Serilog;
namespace OmniDeck.Core.Modules;
@@ -14,6 +16,21 @@ public interface IOdModuleContext
TimeProvider Time { get; }
/// <summary>Windows notifications, raised from the tray icon so they work while minimized.</summary>
/// <summary>
/// Windows notifications, raised from the tray icon so they work while minimized. Clicking one opens
/// this module.
/// </summary>
IOdNotifier Notifier { get; }
/// <summary>
/// The HTTP client OmniDeck's own features share. It names OmniDeck in its User-Agent and keeps no
/// cookies; a module may only call the services docs/legal/PRIVACY.md lists for it.
/// </summary>
HttpClient Http { get; }
/// <summary>
/// The app database, for the tables a module keeps. Their migrations ship with Core
/// (<see cref="OdCoreMigrations"/>), so one schema version covers the whole file.
/// </summary>
OdDatabase Database { get; }
}
+1 -1
View File
@@ -3,5 +3,5 @@ namespace OmniDeck.Core.Modules;
/// <summary>Raises a Windows notification under OmniDeck's name.</summary>
public interface IOdNotifier
{
void Notify(string title, string message);
void Notify(OdNotification notification);
}
+12
View File
@@ -0,0 +1,12 @@
namespace OmniDeck.Core.Modules;
/// <summary>
/// A module that keeps working while hidden, such as a web app that shows notifications: the governor
/// never demotes it for being hidden, only to stay under the memory caps, and says so when it does
/// (docs/RAM-GOVERNOR.md §3).
/// </summary>
public interface IOdResidency
{
/// <summary>Whether the module needs to stay live while hidden, as things stand now.</summary>
bool StaysResident { get; }
}
+38
View File
@@ -0,0 +1,38 @@
using System.Windows;
namespace OmniDeck.Core.Modules;
/// <summary>
/// How a module's view asks the window it is in to cover the screen, and learns that it does
/// (docs/SPEC.md §3.6: the module's own window covers the monitor). The request bubbles up to the
/// window as a routed event; the window answers by setting <see cref="IsActiveProperty"/> on its
/// module stage, which views inherit. A view raises the request from itself: content it hosts in a
/// window of its own, such as a video overlay, is outside the window's tree.
/// </summary>
public static class OdFullscreen
{
public static readonly RoutedEvent RequestedEvent = EventManager.RegisterRoutedEvent(
"Requested", RoutingStrategy.Bubble, typeof(EventHandler<OdFullscreenRequestedEventArgs>), typeof(OdFullscreen));
public static readonly DependencyProperty IsActiveProperty = DependencyProperty.RegisterAttached(
"IsActive", typeof(bool), typeof(OdFullscreen), new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.Inherits));
/// <summary>Asks the window holding <paramref name="view"/> to cover the screen, or to stop.</summary>
public static void Request(UIElement view, bool on)
{
ArgumentNullException.ThrowIfNull(view);
view.RaiseEvent(new OdFullscreenRequestedEventArgs(RequestedEvent, view, on));
}
public static bool GetIsActive(DependencyObject element)
{
ArgumentNullException.ThrowIfNull(element);
return (bool)element.GetValue(IsActiveProperty);
}
public static void SetIsActive(DependencyObject element, bool value)
{
ArgumentNullException.ThrowIfNull(element);
element.SetValue(IsActiveProperty, value);
}
}
@@ -0,0 +1,9 @@
using System.Windows;
namespace OmniDeck.Core.Modules;
/// <summary>A view asked to cover the screen (<see cref="On"/>), or to stop.</summary>
public sealed class OdFullscreenRequestedEventArgs(RoutedEvent routedEvent, object source, bool on) : RoutedEventArgs(routedEvent, source)
{
public bool On { get; } = on;
}
@@ -19,6 +19,9 @@ public sealed class OdHostedModule
/// <summary>The module's view; <see langword="null"/> before the first open and after hibernation or closing.</summary>
public FrameworkElement? View { get; internal set; }
/// <summary>Whether the module shows in a window of its own (a pop-out) rather than in the main window.</summary>
public bool IsPoppedOut { get; internal set; }
/// <summary>When the module was last visible: the governor measures how long it has been hidden from here.</summary>
public DateTimeOffset LastActive { get; internal set; }
+10 -2
View File
@@ -1,7 +1,15 @@
using System.Net.Http;
using OmniDeck.Core.Storage;
using Serilog;
namespace OmniDeck.Core.Modules;
/// <summary>The context <see cref="OdModuleHost"/> hands a module when it initializes.</summary>
internal sealed record OdModuleContext(string ModuleId, IOdModuleSettings Settings, ILogger Log, TimeProvider Time, IOdNotifier Notifier)
: IOdModuleContext;
internal sealed record OdModuleContext(
string ModuleId,
IOdModuleSettings Settings,
ILogger Log,
TimeProvider Time,
IOdNotifier Notifier,
HttpClient Http,
OdDatabase Database) : IOdModuleContext;
+134 -19
View File
@@ -1,3 +1,4 @@
using System.Net.Http;
using System.Windows;
using OmniDeck.Core.Storage;
using Serilog;
@@ -6,10 +7,10 @@ using Serilog.Core;
namespace OmniDeck.Core.Modules;
/// <summary>
/// Runs the modules (docs/ARCHITECTURE.md §2): initializes each one on first use, keeps the view of
/// the visible one, and moves the others down the state ladder when the shell or the RAM governor
/// asks. Calls come from the UI thread and run one at a time, so a slow module never interleaves two
/// transitions.
/// Runs the modules (docs/ARCHITECTURE.md §2): initializes each one on first use, keeps the views of
/// the visible ones (the main window's module and those in windows of their own), and moves the
/// others down the state ladder when the shell or the RAM governor asks. Calls come from the UI thread
/// and run one at a time, so a slow module never interleaves two transitions.
/// </summary>
public sealed class OdModuleHost : IDisposable
{
@@ -19,9 +20,10 @@ public sealed class OdModuleHost : IDisposable
private readonly ILogger _log;
private readonly TimeProvider _time;
private readonly IOdNotifier _notifier;
private readonly HttpClient _http;
private readonly SemaphoreSlim _gate = new(1, 1);
public OdModuleHost(IEnumerable<IOdModule> modules, OdDatabase database, ILogger log, TimeProvider time, IOdNotifier notifier)
public OdModuleHost(IEnumerable<IOdModule> modules, OdDatabase database, ILogger log, TimeProvider time, IOdNotifier notifier, HttpClient http)
{
ArgumentNullException.ThrowIfNull(modules);
ArgumentNullException.ThrowIfNull(log);
@@ -30,10 +32,25 @@ public sealed class OdModuleHost : IDisposable
_log = log.ForContext<OdModuleHost>();
_time = time;
_notifier = notifier;
Modules = [.. modules.Select(module => new OdHostedModule(module))];
_http = http;
// A repeated id keeps the first module: two would share one settings document, and a catalog
// entry named like a built-in module must not stop OmniDeck from starting.
var hosted = new List<OdHostedModule>();
_byId = new Dictionary<string, OdHostedModule>(StringComparer.Ordinal);
foreach (var module in modules)
{
var entry = new OdHostedModule(module);
if (_byId.TryAdd(entry.Info.Id, entry))
{
hosted.Add(entry);
}
else
{
_log.Warning("Module {ModuleId} is registered twice; the first one is kept", entry.Info.Id);
}
}
// Throws on a repeated id: two modules would share one settings document.
_byId = Modules.ToDictionary(hosted => hosted.Info.Id, StringComparer.Ordinal);
Modules = hosted;
}
public event EventHandler<OdModuleStateChangedEventArgs>? StateChanged;
@@ -41,7 +58,7 @@ public sealed class OdModuleHost : IDisposable
/// <summary>Every registered module, in registration order.</summary>
public IReadOnlyList<OdHostedModule> Modules { get; }
/// <summary>The visible module; <see langword="null"/> while the shell shows one of its own pages.</summary>
/// <summary>The module visible in the main window; <see langword="null"/> while the shell shows one of its own pages.</summary>
public OdHostedModule? Current { get; private set; }
public OdHostedModule? Find(string moduleId) => _byId.GetValueOrDefault(moduleId);
@@ -49,6 +66,8 @@ public sealed class OdModuleHost : IDisposable
/// <summary>
/// Makes <paramref name="moduleId"/> the visible module: initializes it on first use, builds its
/// view when it has none (first open, or after hibernation) and hides the module shown before.
/// The previous module stays visible until the new one is active, so a module that fails to start
/// leaves the shell as it was. A module in a window of its own is docked first (<see cref="DockAsync"/>).
/// </summary>
public async Task<FrameworkElement> ShowAsync(string moduleId)
{
@@ -56,21 +75,20 @@ public sealed class OdModuleHost : IDisposable
await _gate.WaitAsync();
try
{
if (hosted.IsPoppedOut)
{
// Its view belongs to the other window until that window lets go of it.
throw new InvalidOperationException($"Module '{moduleId}' shows in a window of its own.");
}
if (hosted == Current && hosted.View is { } shown)
{
return shown;
}
if (!hosted.IsInitialized)
{
await hosted.Module.InitializeAsync(CreateContext(hosted.Info.Id));
hosted.IsInitialized = true;
}
var view = hosted.View ?? hosted.Module.CreateView();
hosted.View = view;
HideCurrent();
var view = await EnsureViewAsync(hosted);
await hosted.Module.ActivateAsync();
HideCurrent();
Current = hosted;
hosted.LastActive = _time.GetUtcNow();
SetState(hosted, OdModuleState.Active);
@@ -82,6 +100,62 @@ public sealed class OdModuleHost : IDisposable
}
}
/// <summary>
/// Moves <paramref name="moduleId"/> into a window of its own (a pop-out). Like <see cref="ShowAsync"/>,
/// it initializes the module and builds its view when it has none; the module stays active, out of
/// the governor's reach, until <see cref="DockAsync"/>. The main window's module stays as it is,
/// unless it is this one, which the main window then no longer shows.
/// </summary>
public async Task<FrameworkElement> PopOutAsync(string moduleId)
{
var hosted = Get(moduleId);
await _gate.WaitAsync();
try
{
var view = await EnsureViewAsync(hosted);
if (hosted.State != OdModuleState.Active)
{
await hosted.Module.ActivateAsync();
}
if (hosted == Current)
{
Current = null;
}
hosted.IsPoppedOut = true;
hosted.LastActive = _time.GetUtcNow();
SetState(hosted, OdModuleState.Active);
return view;
}
finally
{
_gate.Release();
}
}
/// <summary>Its window closed: the module goes back to the main window, hidden, and down the ladder like any hidden module.</summary>
public async Task DockAsync(string moduleId)
{
var hosted = Get(moduleId);
await _gate.WaitAsync();
try
{
if (!hosted.IsPoppedOut)
{
return;
}
hosted.IsPoppedOut = false;
hosted.LastActive = _time.GetUtcNow();
SetState(hosted, OdModuleState.Idle);
}
finally
{
_gate.Release();
}
}
/// <summary>Hides the visible module while the shell shows one of its own pages.</summary>
public async Task HideAsync()
{
@@ -158,9 +232,14 @@ public sealed class OdModuleHost : IDisposable
if (hosted == Current)
{
Current = null;
}
if (hosted.State == OdModuleState.Active)
{
hosted.LastActive = _time.GetUtcNow();
}
hosted.IsPoppedOut = false;
SetState(hosted, OdModuleState.Closed);
}
finally
@@ -169,6 +248,27 @@ public sealed class OdModuleHost : IDisposable
}
}
/// <summary>
/// Closes every open module before OmniDeck exits, so each one can save its state and let go of
/// what it holds; a web app's browser process, for one, writes its cookies out only when it closes
/// cleanly. A module that fails to close is logged and the rest still close.
/// </summary>
public async Task CloseAllAsync()
{
var open = Modules.Where(hosted => hosted.State is not (OdModuleState.Created or OdModuleState.Closed)).Select(hosted => hosted.Info.Id).ToList();
foreach (var moduleId in open)
{
try
{
await CloseAsync(moduleId);
}
catch (Exception ex)
{
_log.Warning(ex, "Module {ModuleId} failed to close", moduleId);
}
}
}
public void Dispose() => _gate.Dispose();
private OdHostedModule Get(string moduleId)
@@ -179,12 +279,27 @@ public sealed class OdModuleHost : IDisposable
: throw new ArgumentException($"No module has the id '{moduleId}'.", nameof(moduleId));
}
private async Task<FrameworkElement> EnsureViewAsync(OdHostedModule hosted)
{
if (!hosted.IsInitialized)
{
await hosted.Module.InitializeAsync(CreateContext(hosted.Info.Id));
hosted.IsInitialized = true;
}
var view = hosted.View ?? hosted.Module.CreateView();
hosted.View = view;
return view;
}
private OdModuleContext CreateContext(string moduleId) => new(
moduleId,
new OdModuleSettingsStore(_database, moduleId),
_baseLog.ForContext(Constants.SourceContextPropertyName, "Module." + moduleId),
_time,
_notifier);
new OdModuleNotifier(_notifier, moduleId),
_http,
_database);
private void HideCurrent()
{
+11 -1
View File
@@ -1,3 +1,5 @@
using OmniDeck.Core.Localization;
namespace OmniDeck.Core.Modules;
/// <summary>What the shell shows about a module.</summary>
@@ -6,4 +8,12 @@ namespace OmniDeck.Core.Modules;
/// <param name="Icon">A WPF-UI <c>SymbolRegular</c> name such as <c>Clock24</c>; Core stays free of WPF-UI.</param>
/// <param name="CategoryKey">The resource key of the localized category the library shows under the name.</param>
/// <param name="RamClass">The governor's priority hint.</param>
public sealed record OdModuleInfo(string Id, string NameKey, string Icon, string CategoryKey, OdRamClass RamClass);
/// <param name="DisplayName">
/// A name shown as written instead of <paramref name="NameKey"/>'s translation: a brand such as a web
/// app's, which is the same in every language.
/// </param>
public sealed record OdModuleInfo(string Id, string NameKey, string Icon, string CategoryKey, OdRamClass RamClass, string? DisplayName = null)
{
/// <summary>The name to show: <see cref="DisplayName"/>, or the localized name in the current language.</summary>
public string Title => DisplayName ?? OdLocalization.Get(NameKey);
}
@@ -0,0 +1,11 @@
namespace OmniDeck.Core.Modules;
/// <summary>A module's notifier: its notifications open the module when clicked, unless they say otherwise.</summary>
internal sealed class OdModuleNotifier(IOdNotifier notifier, string moduleId) : IOdNotifier
{
public void Notify(OdNotification notification)
{
ArgumentNullException.ThrowIfNull(notification);
notifier.Notify(notification.Target is null ? notification with { Target = moduleId } : notification);
}
}
@@ -0,0 +1,11 @@
namespace OmniDeck.Core.Modules;
/// <summary>A Windows notification under OmniDeck's name, and what clicking it opens.</summary>
/// <param name="Title">The first, bold line.</param>
/// <param name="Message">The text below it.</param>
/// <param name="Target">
/// What clicking the notification opens: the id of the module that raised it, or null to just show
/// the window. A module's notifications get its id unless they name something else.
/// </param>
/// <param name="Clicked">Run after the target opens, when the notification is clicked: a web app tells its page.</param>
public sealed record OdNotification(string Title, string Message, string? Target = null, Action? Clicked = null);
@@ -0,0 +1,11 @@
namespace OmniDeck.Core.Modules;
public static class OdNotifierExtensions
{
/// <summary>A notification with a title and a message, opening nothing in particular when clicked.</summary>
public static void Notify(this IOdNotifier notifier, string title, string message)
{
ArgumentNullException.ThrowIfNull(notifier);
notifier.Notify(new OdNotification(title, message));
}
}
+33
View File
@@ -0,0 +1,33 @@
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
namespace OmniDeck.Core.Net;
/// <summary>
/// Builds the one HTTP client OmniDeck's own features share (docs/ARCHITECTURE.md §2): weather and the
/// catalog refresh. Web apps never go through it; WebView2 makes their connections.
/// </summary>
public static class OdHttp
{
/// <summary>How long a request may take before it fails.</summary>
public static readonly TimeSpan Timeout = TimeSpan.FromSeconds(15);
public static HttpClient Create(OdVersionInfo version)
{
ArgumentNullException.ThrowIfNull(version);
var handler = new SocketsHttpHandler
{
// The client lives as long as the app: renewing pooled connections picks up DNS changes.
PooledConnectionLifetime = TimeSpan.FromMinutes(15),
AutomaticDecompression = DecompressionMethods.All,
UseCookies = false,
};
var client = new HttpClient(handler) { Timeout = Timeout };
// A descriptive User-Agent, as the providers ask of scripted clients (docs/spikes/07-providers.md).
client.DefaultRequestHeaders.UserAgent.Add(new ProductInfoHeaderValue("OmniDeck", version.Version));
client.DefaultRequestHeaders.UserAgent.Add(new ProductInfoHeaderValue("(+https://github.com/poli0981/OmniDeck)"));
return client;
}
}
@@ -2,6 +2,7 @@ using Microsoft.Extensions.DependencyInjection;
using OmniDeck.Core.Governor;
using OmniDeck.Core.Legal;
using OmniDeck.Core.Modules;
using OmniDeck.Core.Net;
using OmniDeck.Core.Settings;
using OmniDeck.Core.Storage;
@@ -20,6 +21,7 @@ public static class OdCoreServiceCollectionExtensions
services.AddSingleton<OdDatabase>();
services.AddSingleton<IOdAppMeta, OdAppMeta>();
services.AddSingleton<OdLegalGate>();
services.AddSingleton(_ => OdHttp.Create(OdVersionInfo.FromAssembly(typeof(OdHttp).Assembly)));
// Modules register as IOdModule; the app supplies IOdNotifier (the tray).
services.AddSingleton<OdModuleHost>();
+1 -1
View File
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<!-- Windows-only from the start: DPAPI, toasts and the update service land here in P1. -->
<!-- Windows-only from the start: module views are WPF, and the Twelve Data key (P3) is kept with DPAPI. -->
<TargetFramework>net10.0-windows</TargetFramework>
<!-- IOdModule.CreateView returns a FrameworkElement (docs/ARCHITECTURE.md §2). -->
<UseWPF>true</UseWPF>
+57
View File
@@ -0,0 +1,57 @@
using System.IO.Compression;
using System.Text;
namespace OmniDeck.Core.Reports;
/// <summary>
/// A bug report as OmniDeck saves it (docs/legal/PRIVACY.md §3): the issue text, the system facts, the
/// end of the log and, for a web app, its console, each already scrubbed. It is written to a zip on
/// this PC and never sent; the user attaches it to the issue.
/// </summary>
public sealed record OdBugReport
{
/// <summary>OmniDeck's version and commit, as About shows them.</summary>
public required string Version { get; init; }
/// <summary>Windows' version and build.</summary>
public required string Windows { get; init; }
public required string Preset { get; init; }
/// <summary>What the report is about: a module's name, or OmniDeck in general.</summary>
public required string Subject { get; init; }
/// <summary>The issue's text, laid out like the GitHub form: issue.md.</summary>
public required string Issue { get; init; }
/// <summary>Versions, modules, memory and sign-in counts: system.json.</summary>
public required string SystemInfo { get; init; }
/// <summary>The end of the log: logs.txt.</summary>
public required string Logs { get; init; }
/// <summary>The web app's console, when the report is about one: console-‹app›.txt.</summary>
public string? ConsoleLog { get; init; }
/// <summary>The id of the web app whose console <see cref="ConsoleLog"/> is.</summary>
public string? ConsoleOf { get; init; }
/// <summary>Writes the report to <paramref name="stream"/> as a zip.</summary>
public void WriteZip(Stream stream)
{
using var zip = new ZipArchive(stream, ZipArchiveMode.Create, leaveOpen: true);
Add(zip, "issue.md", Issue);
Add(zip, "system.json", SystemInfo);
Add(zip, "logs.txt", Logs);
if (ConsoleLog is not null && ConsoleOf is not null)
{
Add(zip, "console-" + ConsoleOf + ".txt", ConsoleLog);
}
}
private static void Add(ZipArchive zip, string name, string text)
{
using var writer = new StreamWriter(zip.CreateEntry(name, CompressionLevel.Optimal).Open(), new UTF8Encoding(encoderShouldEmitUTF8Identifier: false));
writer.Write(text);
}
}
+40
View File
@@ -0,0 +1,40 @@
using System.Globalization;
using OmniDeck.Core.Storage;
namespace OmniDeck.Core.Reports;
/// <summary>The data root's reports folder: each report is a bugreport-‹stamp›.zip, and the ten newest are kept.</summary>
public sealed class OdBugReports(OdDataRoot dataRoot, TimeProvider time)
{
/// <summary>How many reports the folder keeps.</summary>
public const int Kept = 10;
/// <summary>Saves <paramref name="report"/>, deletes the reports beyond the newest <see cref="Kept"/>, and returns its path.</summary>
public string Save(OdBugReport report)
{
ArgumentNullException.ThrowIfNull(report);
ArgumentNullException.ThrowIfNull(dataRoot);
var folder = dataRoot.ReportsDirectory;
Directory.CreateDirectory(folder);
var stamp = time.GetLocalNow().ToString("yyyyMMdd-HHmmss", CultureInfo.InvariantCulture);
var path = Path.Combine(folder, "bugreport-" + stamp + ".zip");
var n = 1;
while (File.Exists(path))
{
n++;
path = Path.Combine(folder, string.Create(CultureInfo.InvariantCulture, $"bugreport-{stamp}-{n}.zip"));
}
using (var file = new FileStream(path, FileMode.CreateNew, FileAccess.Write))
{
report.WriteZip(file);
}
foreach (var old in Directory.GetFiles(folder, "bugreport-*.zip").OrderDescending(StringComparer.Ordinal).Skip(Kept))
{
File.Delete(old);
}
return path;
}
}
+60
View File
@@ -0,0 +1,60 @@
using System.Text.RegularExpressions;
namespace OmniDeck.Core.Reports;
/// <summary>
/// Takes what could identify the user out of text before it goes into a bug report
/// (docs/legal/PRIVACY.md §3): the user's profile folder, query strings and fragments of URLs, cookie
/// values, token-shaped values (bearer tokens, JWTs, long hex or base64 runs), email addresses, and
/// numeric ids of 15 digits or more, such as Discord's (docs/spikes/04-cdp-console.md).
/// </summary>
public static partial class OdScrubber
{
/// <summary>What a removed value is replaced with.</summary>
public const string Removed = "[removed]";
public static string Scrub(string text)
{
ArgumentNullException.ThrowIfNull(text);
var profile = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
var scrubbed = profile.Length > 0 ? text.Replace(profile, "%USERPROFILE%", StringComparison.OrdinalIgnoreCase) : text;
scrubbed = UserFolder().Replace(scrubbed, "%USERPROFILE%");
scrubbed = UrlTail().Replace(scrubbed, "${url}?" + Removed);
scrubbed = Cookie().Replace(scrubbed, "${name}" + Removed);
scrubbed = Bearer().Replace(scrubbed, "${scheme} " + Removed);
scrubbed = Jwt().Replace(scrubbed, Removed);
scrubbed = Email().Replace(scrubbed, "[email]");
scrubbed = LongNumber().Replace(scrubbed, "[id]");
scrubbed = LongHex().Replace(scrubbed, Removed);
return LongBase64().Replace(scrubbed, Removed);
}
[GeneratedRegex(@"(?<![\w%])[a-z]:[\\/]users[\\/][^\\/\s""'<>|:*?]+", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant | RegexOptions.ExplicitCapture, matchTimeoutMilliseconds: 1000)]
private static partial Regex UserFolder();
// A URL keeps its scheme, host and path; everything from ? or # on goes.
[GeneratedRegex(@"(?<url>\b[a-z][a-z0-9+.-]*://[^\s?#""'<>]+)[?#][^\s""'<>]*", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant | RegexOptions.ExplicitCapture, matchTimeoutMilliseconds: 1000)]
private static partial Regex UrlTail();
[GeneratedRegex(@"(?<name>\b(?:set-)?cookie\s*[:=]\s*)[^\r\n]+", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant | RegexOptions.ExplicitCapture, matchTimeoutMilliseconds: 1000)]
private static partial Regex Cookie();
[GeneratedRegex(@"(?<scheme>\bbearer)\s+[a-z0-9\-._~+/]+=*", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant | RegexOptions.ExplicitCapture, matchTimeoutMilliseconds: 1000)]
private static partial Regex Bearer();
[GeneratedRegex(@"\beyJ[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]*", RegexOptions.CultureInvariant | RegexOptions.ExplicitCapture, matchTimeoutMilliseconds: 1000)]
private static partial Regex Jwt();
[GeneratedRegex(@"\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}\b", RegexOptions.CultureInvariant | RegexOptions.ExplicitCapture, matchTimeoutMilliseconds: 1000)]
private static partial Regex Email();
[GeneratedRegex(@"\b\d{15,}\b", RegexOptions.CultureInvariant | RegexOptions.ExplicitCapture, matchTimeoutMilliseconds: 1000)]
private static partial Regex LongNumber();
[GeneratedRegex(@"\b[0-9a-f]{32,}\b", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant | RegexOptions.ExplicitCapture, matchTimeoutMilliseconds: 1000)]
private static partial Regex LongHex();
// Session ids, keys and signatures; dots, backslashes and spaces break the run, so paths and names stay.
[GeneratedRegex(@"(?<![A-Za-z0-9+/_-])[A-Za-z0-9+/_-]{40,}={0,2}", RegexOptions.CultureInvariant | RegexOptions.ExplicitCapture, matchTimeoutMilliseconds: 1000)]
private static partial Regex LongBase64();
}
+44
View File
@@ -0,0 +1,44 @@
using System.Runtime.InteropServices;
using System.Windows;
namespace OmniDeck.Core.Runtime;
/// <summary>The monitors windows are on, for covering one in full screen.</summary>
public static partial class OdMonitors
{
private const uint DefaultToNearest = 2;
/// <summary>The bounds, in device pixels, of the monitor <paramref name="window"/> is mostly on; empty if Windows cannot say.</summary>
public static Int32Rect BoundsOf(nint window)
{
var info = new MonitorInfo { Size = Marshal.SizeOf<MonitorInfo>() };
return GetMonitorInfo(MonitorFromWindow(window, DefaultToNearest), ref info)
? new Int32Rect(info.Monitor.Left, info.Monitor.Top, info.Monitor.Right - info.Monitor.Left, info.Monitor.Bottom - info.Monitor.Top)
: Int32Rect.Empty;
}
[LibraryImport("user32.dll")]
private static partial nint MonitorFromWindow(nint window, uint flags);
[LibraryImport("user32.dll", EntryPoint = "GetMonitorInfoW")]
[return: MarshalAs(UnmanagedType.Bool)]
private static partial bool GetMonitorInfo(nint monitor, ref MonitorInfo info);
[StructLayout(LayoutKind.Sequential)]
private struct Bounds
{
public int Left;
public int Top;
public int Right;
public int Bottom;
}
[StructLayout(LayoutKind.Sequential)]
private struct MonitorInfo
{
public int Size;
public Bounds Monitor;
public Bounds Work;
public uint Flags;
}
}
+6
View File
@@ -42,6 +42,9 @@ public sealed record OdSettings
/// <summary>The RAM governor's thresholds and the modules it must keep running.</summary>
public OdMemorySettings Memory { get; init; } = new();
/// <summary>The user's choices for each web app: notifications and site permissions.</summary>
public OdWebSettings Web { get; init; } = new();
internal const string DefaultPreset = "Standard";
internal static readonly string[] KnownPresets = ["Dynamic", "Standard", "Comfort"];
@@ -70,10 +73,13 @@ public sealed record OdSettings
AccentColor = IsHexColor(AccentColor) ? AccentColor.ToUpperInvariant() : "",
PinnedModules = DistinctIds(PinnedModules),
Memory = Repair(Memory),
Web = Repair(Web),
};
private static OdMemorySettings Repair(OdMemorySettings? memory) => (memory ?? new OdMemorySettings()).Normalized();
private static OdWebSettings Repair(OdWebSettings? web) => (web ?? new OdWebSettings()).Normalized();
private static bool IsHexColor(string? value) =>
value is { Length: 7 } && value[0] == '#' && !value.AsSpan(1).ContainsAnyExcept(HexDigits);
@@ -0,0 +1,34 @@
namespace OmniDeck.Core.Settings;
/// <summary>The user's choices for one web app, made in Settings → Web apps and in the app itself.</summary>
public sealed record OdWebAppSettings
{
/// <summary>No permission answered yet.</summary>
public static readonly IReadOnlyDictionary<string, bool> NoPermissions = new Dictionary<string, bool>(StringComparer.Ordinal);
/// <summary>Whether the app may show notifications; null follows the catalog's <c>notifications</c> flag.</summary>
public bool? Notifications { get; init; }
/// <summary>
/// The site permissions the user answered, by WebView2 permission kind (<c>Camera</c>,
/// <c>Microphone</c>, ...): true allowed, false blocked; a kind not listed is asked about. Compared by
/// reference, like every collection in the settings: change it by assigning a new one.
/// </summary>
public IReadOnlyDictionary<string, bool> Permissions { get; init; } = NoPermissions;
/// <summary>Repairs values a hand-edited file may carry; the same instance when there is nothing to repair.</summary>
public OdWebAppSettings Normalized() => NeedsRepair(Permissions)
? this with { Permissions = Repair(Permissions) }
: this;
/// <summary>Whether <paramref name="key"/> is an id or a kind as the settings keep it: not blank, no spaces around.</summary>
internal static bool IsClean(string? key) => !string.IsNullOrWhiteSpace(key) && key.Length == key.Trim().Length;
private static bool NeedsRepair(IReadOnlyDictionary<string, bool>? permissions) => permissions is null || !permissions.Keys.All(IsClean);
private static Dictionary<string, bool> Repair(IReadOnlyDictionary<string, bool>? permissions) =>
(permissions ?? NoPermissions)
.Where(pair => !string.IsNullOrWhiteSpace(pair.Key))
.GroupBy(pair => pair.Key.Trim(), StringComparer.Ordinal)
.ToDictionary(group => group.Key, group => group.Last().Value, StringComparer.Ordinal);
}
@@ -0,0 +1,36 @@
namespace OmniDeck.Core.Settings;
/// <summary>
/// The user's choices for the web apps, by catalog id (docs/legal/PRIVACY.md §1: per-app permissions).
/// An app without an entry shows notifications as the catalog says and asks before using a permission.
/// </summary>
public sealed record OdWebSettings
{
/// <summary>No app with choices of its own.</summary>
public static readonly IReadOnlyDictionary<string, OdWebAppSettings> NoApps = new Dictionary<string, OdWebAppSettings>(StringComparer.Ordinal);
/// <summary>Each app's choices, by catalog id. Compared by reference: change it by assigning a new one.</summary>
public IReadOnlyDictionary<string, OdWebAppSettings> Apps { get; init; } = NoApps;
/// <summary>The choices for <paramref name="appId"/>, or the defaults.</summary>
public OdWebAppSettings For(string appId) => Apps.TryGetValue(appId, out var app) ? app : new OdWebAppSettings();
/// <summary>These settings with <paramref name="appId"/>'s choices changed by <paramref name="change"/>.</summary>
public OdWebSettings With(string appId, Func<OdWebAppSettings, OdWebAppSettings> change)
{
ArgumentNullException.ThrowIfNull(change);
return this with { Apps = new Dictionary<string, OdWebAppSettings>(Apps, StringComparer.Ordinal) { [appId] = change(For(appId)) } };
}
/// <summary>Repairs values a hand-edited file may carry; the same instance when there is nothing to repair.</summary>
public OdWebSettings Normalized() => NeedsRepair(Apps) ? this with { Apps = Repair(Apps) } : this;
private static bool NeedsRepair(IReadOnlyDictionary<string, OdWebAppSettings>? apps) =>
apps is null || apps.Any(pair => !OdWebAppSettings.IsClean(pair.Key) || pair.Value is null || !ReferenceEquals(pair.Value.Normalized(), pair.Value));
private static Dictionary<string, OdWebAppSettings> Repair(IReadOnlyDictionary<string, OdWebAppSettings>? apps) =>
(apps ?? NoApps)
.Where(pair => !string.IsNullOrWhiteSpace(pair.Key) && pair.Value is not null)
.GroupBy(pair => pair.Key.Trim(), StringComparer.Ordinal)
.ToDictionary(group => group.Key, group => group.Last().Value.Normalized(), StringComparer.Ordinal);
}
@@ -0,0 +1,6 @@
-- The weather module's last forecast per place and units, as Open-Meteo sent it (docs/ARCHITECTURE.md §5).
CREATE TABLE IF NOT EXISTS weather_cache (
cache_key TEXT NOT NULL PRIMARY KEY,
fetched_at TEXT NOT NULL,
payload TEXT NOT NULL
) WITHOUT ROWID;
Loaded 100 of 243 files, more files were not shown because too many files have changed in this diff. Show more