Compare commits

...
Author SHA1 Message Date
poli0981 f498437ada Merge remote-tracking branch 'origin/main' into fix/governor-away 2026-11-03 11:12:57 +07:00
poli0981 4305a49291 Merge pull request #54 from poli0981/chore/dev-data-root
chore: a development build can use a data root of its own
2026-11-03 11:09:25 +07:00
poli0981andClaude Opus 5.5 8ba9d620af fix: a minimized or tray-hidden window lets its module rest
The module on screen when the main window was minimized, or closed to the
notification area, stayed Active for as long as the window was away: the
governor never suspended or hibernated it, and the caps never took it.

The host now hears when the window goes away and comes back
(SetMainWindowAwayAsync). Away, its module goes Idle and down the ladder
like any hidden module, while staying the one the window shows; back, it
is activated again, with a new view if it was hibernated meanwhile. The
stage keeps its view while away, so a full screen and the page survive a
minimize. A notification click navigates before bringing the window up.

Because a minimized window never unloads its view, Clock and Timer restart
their ticking in ActivateAsync, and a web app hides its browser before
asking WebView2 to suspend, which it does only for a hidden browser.

Time spent pinned (a player playing) no longer counts as time hidden, so a
player that stops after an hour out of sight is not hibernated at once.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 11:05:11 +07:00
14 changed files with 456 additions and 10 deletions

No files matched your search

+9
View File
@@ -6,6 +6,15 @@ All notable changes to OmniDeck are documented here. The format follows
## [Unreleased]
### Fixed
- The module on screen when you minimized OmniDeck, or closed it to the notification area, kept
running at full size for as long as the window stayed away, even above the memory limits. It now
rests like any other hidden module: suspended after 5 minutes and closed down after 30 (or whatever
Settings → Memory says), unless it is playing, kept running or has notifications on. It comes back,
on the page it showed, when the window does.
- A player that stops after playing out of sight for a while is no longer closed down at once: the
time it spent playing does not count as time unused.
## [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
+2
View File
@@ -64,6 +64,8 @@ public interface IOdModule
`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.
When the main window is minimized or hidden in the tray, nothing it holds is on screen: `OdModuleHost.SetMainWindowAwayAsync` makes its module Idle, so the ladder and the caps apply to it, while it stays the module the window shows. When the window comes back, the module is activated again, and gets a new view if it was hibernated meanwhile. The stage keeps the old view while the window is away, so a full screen and the page survive a minimize. Since a minimized window never unloads its view, `ActivateAsync` must undo whatever `SuspendAsync` stopped (Clock and Timer restart their ticking there), and a web app hides its browser before asking WebView2 to suspend, which WebView2 does only for a hidden browser.
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;
+4
View File
@@ -14,6 +14,8 @@ The governor is the feature that makes "many apps in one" viable. It moves every
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.
The main window's module is hidden too while that window is minimized or hidden in the tray: it goes Idle when the window goes away and down the ladder from there, and it is active again when the window comes back (rebuilt, if it was hibernated meanwhile). Pop-outs keep their rule above, even when their own window is minimized.
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)
@@ -38,6 +40,8 @@ A module that works while hidden is **resident** (`IOdResidency`): in P2, a web
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.
Time spent pinned does not count as time hidden: each pass restarts a pinned module's hidden time, so a player that stops after an hour out of sight is suspended `IdleAfter` later and hibernated `HibernateAfter` later, not on the next pass.
## 4. Cap enforcement
Total footprint = shell process + Σ all WebView2 processes, sampled every `PollInterval`.
+24 -4
View File
@@ -121,6 +121,7 @@ public partial class OdMainWindow : INavigationViewPageProvider
};
SetUpNavigation(theme);
ListenForAway();
// WPF ignores the Windows text size; re-read it when it may have changed (docs/UI-MODES.md §4).
Activated += (_, _) => theme.RefreshTextScale();
@@ -402,13 +403,32 @@ public partial class OdMainWindow : INavigationViewPageProvider
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>
/// <summary>Minimized or in the tray, the window shows nothing: its module goes down the ladder meanwhile.</summary>
private void ListenForAway()
{
IsVisibleChanged += (_, _) => OnAwayChanged(this, EventArgs.Empty);
StateChanged += OnAwayChanged;
}
private async void OnAwayChanged(object? sender, EventArgs e) =>
await _shell.SetWindowAwayAsync(!IsVisible || WindowState == WindowState.Minimized);
/// <summary>
/// A click on a notification brings the window up, on the module that raised it. It navigates first,
/// so a module the window showed before is not woken up only to be hidden again.
/// </summary>
private async void OnNotificationClicked(object? sender, OdNotificationClickedEventArgs e)
{
Present();
if (e.Target is { } target)
try
{
await _shell.NavigateAsync(target);
if (e.Target is { } target)
{
await _shell.NavigateAsync(target);
}
}
finally
{
Present();
}
}
@@ -33,6 +33,7 @@ public sealed partial class OdShellViewModel : ObservableObject, IDisposable
private readonly List<OdModuleItemViewModel> _openOrder = [];
private IReadOnlyList<string> _pinned = [];
private string _sidebarShape = "";
private bool _windowAway;
[ObservableProperty]
private string _currentTarget = LibraryTarget;
@@ -146,6 +147,26 @@ public sealed partial class OdShellViewModel : ObservableObject, IDisposable
}
}
/// <summary>
/// The main window was minimized or hidden in the tray (<paramref name="away"/>), or is back. Away,
/// its module goes down the ladder like any hidden one; back, it is active again. The stage keeps its
/// view meanwhile, so a full screen and the page stay as they were; a module hibernated while away
/// comes back with a new view.
/// </summary>
public async Task SetWindowAwayAsync(bool away)
{
if (away == _windowAway)
{
return;
}
_windowAway = away;
if (await _host.SetMainWindowAwayAsync(away) is { } view)
{
CurrentView = view;
}
}
/// <summary>The palette's entries in the current language: every module, then the shell commands.</summary>
public IReadOnlyList<OdPaletteEntry> PaletteEntries()
{
@@ -99,6 +99,12 @@ public sealed class OdRamGovernor : IDisposable
var demoted = false;
foreach (var hosted in Demotable().Where(hosted => !StaysResident(hosted)))
{
// A player that plays is in use even though hidden: its hidden time starts when it stops.
if (await _host.IsPinnedAsync(hosted.Info.Id))
{
continue;
}
var hiddenFor = now - hosted.LastActive;
if (hiddenFor >= options.HibernateAfter)
{
+86 -4
View File
@@ -58,9 +58,15 @@ public sealed class OdModuleHost : IDisposable
/// <summary>Every registered module, in registration order.</summary>
public IReadOnlyList<OdHostedModule> Modules { get; }
/// <summary>The module visible in the main window; <see langword="null"/> while the shell shows one of its own pages.</summary>
/// <summary>
/// The main window's module; <see langword="null"/> while the shell shows one of its own pages. While
/// the window is away (<see cref="IsMainWindowAway"/>) it stays here but goes down the ladder.
/// </summary>
public OdHostedModule? Current { get; private set; }
/// <summary>Whether the main window is minimized or hidden in the tray, so that nothing it holds is on screen.</summary>
public bool IsMainWindowAway { get; private set; }
public OdHostedModule? Find(string moduleId) => _byId.GetValueOrDefault(moduleId);
/// <summary>
@@ -81,7 +87,7 @@ public sealed class OdModuleHost : IDisposable
throw new InvalidOperationException($"Module '{moduleId}' shows in a window of its own.");
}
if (hosted == Current && hosted.View is { } shown)
if (hosted == Current && hosted.View is { } shown && hosted.State == OdModuleState.Active)
{
return shown;
}
@@ -156,6 +162,77 @@ public sealed class OdModuleHost : IDisposable
}
}
/// <summary>
/// The main window went away (minimized, or hidden in the tray) or came back. Away, its module is
/// hidden like any other and goes down the ladder (docs/RAM-GOVERNOR.md §1), yet stays
/// <see cref="Current"/>. Back, that module is active again, with a new view if it was hibernated
/// meanwhile; the view to show is returned, or <see langword="null"/> when the window shows a shell page
/// or is away. Calls that overtake each other settle on the latest one.
/// </summary>
public async Task<FrameworkElement?> SetMainWindowAwayAsync(bool away)
{
IsMainWindowAway = away;
await _gate.WaitAsync();
try
{
if (Current is not { } current)
{
return null;
}
if (IsMainWindowAway)
{
if (current.State == OdModuleState.Active)
{
current.LastActive = _time.GetUtcNow();
SetState(current, OdModuleState.Idle);
}
return null;
}
if (current.State == OdModuleState.Active && current.View is { } shown)
{
return shown;
}
var view = await EnsureViewAsync(current);
await current.Module.ActivateAsync();
current.LastActive = _time.GetUtcNow();
SetState(current, OdModuleState.Active);
return view;
}
finally
{
_gate.Release();
}
}
/// <summary>
/// Whether a hidden module refuses to be suspended right now, as a player does while it plays. Time
/// spent so pinned is not time hidden: its hidden time restarts, so the ladder counts from the moment
/// the pin ends (docs/RAM-GOVERNOR.md §3).
/// </summary>
public async Task<bool> IsPinnedAsync(string moduleId)
{
var hosted = Get(moduleId);
await _gate.WaitAsync();
try
{
if (hosted.State is not (OdModuleState.Idle or OdModuleState.Suspended) || await hosted.Module.CanSuspendAsync())
{
return false;
}
hosted.LastActive = _time.GetUtcNow();
return true;
}
finally
{
_gate.Release();
}
}
/// <summary>Hides the visible module while the shell shows one of its own pages.</summary>
public async Task HideAsync()
{
@@ -309,8 +386,13 @@ public sealed class OdModuleHost : IDisposable
}
Current = null;
previous.LastActive = _time.GetUtcNow();
SetState(previous, OdModuleState.Idle);
// One the window already hid while it was away keeps its place on the ladder.
if (previous.State == OdModuleState.Active)
{
previous.LastActive = _time.GetUtcNow();
SetState(previous, OdModuleState.Idle);
}
}
private void SetState(OdHostedModule hosted, OdModuleState state)
+9 -1
View File
@@ -26,7 +26,15 @@ public sealed class OdClockModule : IOdModule
return new OdClockView { DataContext = _viewModel };
}
public Task ActivateAsync() => Task.CompletedTask;
/// <summary>
/// Ticks again after a suspension. The view's Loaded event does that when it comes back on stage, but a
/// window that was minimized never unloaded it.
/// </summary>
public Task ActivateAsync()
{
_viewModel?.StartTicking();
return Task.CompletedTask;
}
public Task<bool> CanSuspendAsync() => Task.FromResult(true);
+9 -1
View File
@@ -31,7 +31,15 @@ public sealed class OdTimerModule(OdTimerService service) : IOdModule
return new OdTimerView { DataContext = _viewModel };
}
public Task ActivateAsync() => Task.CompletedTask;
/// <summary>
/// Ticks again after a suspension. The view's Loaded event does that when it comes back on stage, but a
/// window that was minimized never unloaded it.
/// </summary>
public Task ActivateAsync()
{
_viewModel?.StartTicking();
return Task.CompletedTask;
}
public Task<bool> CanSuspendAsync() => Task.FromResult(true);
@@ -46,6 +46,8 @@ public partial class OdWebAppView : IOdWebSurface
return;
}
// WebView2 suspends only a hidden browser, and a minimized window does not hide it.
_browser.Visibility = Visibility.Hidden;
core.MemoryUsageTargetLevel = CoreWebView2MemoryUsageTargetLevel.Low;
try
{
@@ -70,6 +72,8 @@ public partial class OdWebAppView : IOdWebSurface
{
core.Resume();
}
_browser.Visibility = Visibility.Visible;
}
public async Task<int?> CountCookiesAsync(Uri page) =>
@@ -339,6 +339,92 @@ public sealed class OdRamGovernorTests : IDisposable
Assert.IsType<InvalidOperationException>(failure);
}
[Fact]
public void Ladder_TakesTheMainWindowsModule_OnlyWhileTheWindowIsAway() => OdSta.Run(async () =>
{
using var host = NewHost();
using var governor = NewGovernor(host);
await host.ShowAsync("clock");
_time.Advance(TimeSpan.FromHours(1));
await governor.TickAsync();
Assert.Equal(OdModuleState.Active, State(host, "clock"));
await host.SetMainWindowAwayAsync(away: true);
_time.Advance(TimeSpan.FromMinutes(5));
await governor.TickAsync();
Assert.Equal(OdModuleState.Suspended, State(host, "clock"));
_time.Advance(TimeSpan.FromMinutes(25));
await governor.TickAsync();
Assert.Equal(OdModuleState.Hibernated, State(host, "clock"));
Assert.NotNull(await host.SetMainWindowAwayAsync(away: false));
Assert.Equal(OdModuleState.Active, State(host, "clock"));
});
[Fact]
public void SoftCap_TakesTheMainWindowsModule_OnlyWhileTheWindowIsAway() => OdSta.Run(async () =>
{
using var host = NewHost();
using var governor = NewGovernor(host);
await host.ShowAsync("web");
_memory.Committed = 5 * GiB;
await governor.TickAsync();
Assert.Equal(OdModuleState.Active, State(host, "web"));
await host.SetMainWindowAwayAsync(away: true);
await governor.TickAsync();
Assert.Equal(OdModuleState.Hibernated, State(host, "web"));
});
[Fact]
public void Ladder_CountsHiddenTimeFromTheEndOfAPin() => OdSta.Run(async () =>
{
using var host = NewHost();
using var governor = NewGovernor(host);
await host.ShowAsync("clock");
await host.ShowAsync("calc");
_clock.CanSuspend = false;
_time.Advance(TimeSpan.FromMinutes(40));
await governor.TickAsync();
Assert.Equal(OdModuleState.Idle, State(host, "clock"));
// It stopped playing: hidden for 40 minutes, but in use until now.
_clock.CanSuspend = true;
_time.Advance(TimeSpan.FromMinutes(4));
await governor.TickAsync();
Assert.Equal(OdModuleState.Idle, State(host, "clock"));
_time.Advance(TimeSpan.FromMinutes(1));
await governor.TickAsync();
Assert.Equal(OdModuleState.Suspended, State(host, "clock"));
});
[Fact]
public void KeptRunningAndResidentModules_StayUp_WhileTheWindowIsAway() => OdSta.Run(async () =>
{
using var host = NewHost();
using var governor = NewGovernor(host);
governor.SetKeptRunning("clock", keep: true);
_web.StaysResident = true;
await host.ShowAsync("clock");
await host.SetMainWindowAwayAsync(away: true);
_time.Advance(TimeSpan.FromHours(1));
await governor.TickAsync();
Assert.Equal(OdModuleState.Idle, State(host, "clock"));
await host.SetMainWindowAwayAsync(away: false);
await host.ShowAsync("web");
await host.SetMainWindowAwayAsync(away: true);
_time.Advance(TimeSpan.FromHours(1));
await governor.TickAsync();
Assert.Equal(OdModuleState.Idle, State(host, "web"));
});
private static OdModuleState? State(OdModuleHost host, string id) => host.Find(id)?.State;
/// <summary>Opens clock, timer and web one after another, then calc, so the first three are hidden.</summary>
@@ -90,6 +90,35 @@ public sealed class OdBuiltInModulesTests : IDisposable
Assert.Empty(calculatorAgain.History);
});
[Fact]
public void ClockAndTimer_TickAgain_WhenTheWindowComesBackAfterASuspension() => OdSta.Run(async () =>
{
using var timers = new OdTimerService(_time, new OdFakeNotifier());
using var host = NewHost(new OdClockModule(), new OdTimerModule(timers));
// A minimized window never unloads its view, so only activation can restart the ticking.
var clock = (OdClockViewModel)(await host.ShowAsync("clock")).DataContext;
await host.SetMainWindowAwayAsync(away: true);
Assert.True(await host.SuspendAsync("clock", OdSuspendReason.Hidden));
var clockShown = clock.Clocks[0].TimeText;
_time.Advance(TimeSpan.FromMinutes(1));
await Task.Delay(50);
Assert.Equal(clockShown, clock.Clocks[0].TimeText);
await host.SetMainWindowAwayAsync(away: false);
Assert.NotEqual(clockShown, clock.Clocks[0].TimeText, StringComparer.Ordinal);
var timer = (OdTimerViewModel)(await host.ShowAsync("timer")).DataContext;
timer.ToggleStopwatchCommand.Execute(null);
await host.SetMainWindowAwayAsync(away: true);
Assert.True(await host.SuspendAsync("timer", OdSuspendReason.Hidden));
var timerShown = timer.StopwatchText;
_time.Advance(TimeSpan.FromSeconds(30));
await Task.Delay(50);
Assert.Equal(timerShown, timer.StopwatchText);
await host.SetMainWindowAwayAsync(away: false);
Assert.NotEqual(timerShown, timer.StopwatchText, StringComparer.Ordinal);
});
private OdModuleHost NewHost(params IOdModule[] modules)
{
var database = new OdDatabase(_temp.Combine("omnideck.db"), pooling: false);
@@ -284,6 +284,130 @@ public sealed class OdModuleHostTests : IDisposable
Assert.Equal(Start.AddMinutes(2), clock.LastActive);
});
[Fact]
public void WindowAway_HidesItsModule_ButKeepsItCurrent() => OdSta.Run(async () =>
{
using var host = NewHost();
var view = await host.ShowAsync("clock");
var changes = new List<string>();
host.StateChanged += (_, e) => changes.Add($"{e.Module.Info.Id}:{e.Previous}>{e.Module.State}");
_time.Advance(TimeSpan.FromMinutes(2));
Assert.Null(await host.SetMainWindowAwayAsync(away: true));
Assert.Null(await host.SetMainWindowAwayAsync(away: true));
var clock = host.Find("clock")!;
Assert.True(host.IsMainWindowAway);
Assert.Same(clock, host.Current);
Assert.Equal(OdModuleState.Idle, clock.State);
Assert.Equal(Start.AddMinutes(2), clock.LastActive);
Assert.True(await host.SuspendAsync("clock", OdSuspendReason.Hidden));
_time.Advance(TimeSpan.FromMinutes(1));
Assert.Same(view, await host.SetMainWindowAwayAsync(away: false));
Assert.False(host.IsMainWindowAway);
Assert.Equal(OdModuleState.Active, clock.State);
Assert.Equal(Start.AddMinutes(3), clock.LastActive);
Assert.Equal(new[] { "clock:Active>Idle", "clock:Idle>Suspended", "clock:Suspended>Active" }, changes, StringComparer.Ordinal);
Assert.Equal(new[] { "init", "view", "activate", "suspend:Hidden", "activate" }, _clock.Calls, StringComparer.Ordinal);
});
[Fact]
public void WindowBack_AfterAHibernation_BuildsANewView() => OdSta.Run(async () =>
{
using var host = NewHost();
var first = await host.ShowAsync("clock");
await host.SetMainWindowAwayAsync(away: true);
Assert.True(await host.HibernateAsync("clock"));
var second = await host.SetMainWindowAwayAsync(away: false);
Assert.NotNull(second);
Assert.NotSame(first, second);
Assert.Same(second, host.Find("clock")?.View);
Assert.Equal(OdModuleState.Active, host.Find("clock")?.State);
Assert.Equal(new[] { "init", "view", "activate", "hibernate", "view", "activate" }, _clock.Calls, StringComparer.Ordinal);
});
[Fact]
public void WindowAway_OnAShellPage_ChangesNoModule() => OdSta.Run(async () =>
{
using var host = NewHost();
await host.ShowAsync("clock");
await host.HideAsync();
_time.Advance(TimeSpan.FromMinutes(1));
Assert.Null(await host.SetMainWindowAwayAsync(away: true));
Assert.Null(await host.SetMainWindowAwayAsync(away: false));
Assert.Null(host.Current);
Assert.Equal(OdModuleState.Idle, host.Find("clock")?.State);
Assert.Equal(Start, host.Find("clock")?.LastActive);
});
[Fact]
public void ShowingAnotherModule_WhileAway_LeavesTheFirstOneWhereTheLadderHasIt() => OdSta.Run(async () =>
{
using var host = NewHost();
await host.ShowAsync("clock");
await host.SetMainWindowAwayAsync(away: true);
_time.Advance(TimeSpan.FromMinutes(6));
await host.SuspendAsync("clock", OdSuspendReason.Hidden);
// A notification for Timer, clicked while the window is in the tray.
await host.ShowAsync("timer");
Assert.Equal(OdModuleState.Suspended, host.Find("clock")?.State);
Assert.Equal(Start, host.Find("clock")?.LastActive);
Assert.Same(host.Find("timer"), host.Current);
Assert.Equal(OdModuleState.Active, host.Find("timer")?.State);
});
[Fact]
public void ShowingTheWindowsOwnModule_WhileAway_ActivatesItAgain() => OdSta.Run(async () =>
{
using var host = NewHost();
var view = await host.ShowAsync("clock");
await host.SetMainWindowAwayAsync(away: true);
await host.SuspendAsync("clock", OdSuspendReason.Hidden);
Assert.Same(view, await host.ShowAsync("clock"));
Assert.Equal(OdModuleState.Active, host.Find("clock")?.State);
Assert.Equal(new[] { "init", "view", "activate", "suspend:Hidden", "activate" }, _clock.Calls, StringComparer.Ordinal);
});
[Fact]
public void APopOut_StaysActive_WhileTheMainWindowIsAway() => OdSta.Run(async () =>
{
using var host = NewHost();
await host.ShowAsync("clock");
await host.PopOutAsync("timer");
await host.SetMainWindowAwayAsync(away: true);
Assert.Equal(OdModuleState.Active, host.Find("timer")?.State);
Assert.Equal(OdModuleState.Idle, host.Find("clock")?.State);
});
[Fact]
public void IsPinned_RestartsTheHiddenTime_OfAModuleThatRefusesToSuspend() => OdSta.Run(async () =>
{
using var host = NewHost();
await host.ShowAsync("clock");
await host.ShowAsync("timer");
_clock.CanSuspend = false;
_time.Advance(TimeSpan.FromMinutes(40));
Assert.True(await host.IsPinnedAsync("clock"));
Assert.Equal(Start.AddMinutes(40), host.Find("clock")?.LastActive);
_clock.CanSuspend = true;
Assert.False(await host.IsPinnedAsync("clock"));
Assert.False(await host.IsPinnedAsync("timer"));
});
private OdModuleHost NewHost(params IOdModule[] more) => new(
[_clock, _timer, .. more],
new OdDatabase(_temp.Combine("omnideck.db"), pooling: false),
@@ -326,6 +326,49 @@ public sealed class OdShellViewModelTests : IDisposable
return Task.CompletedTask;
});
[Fact]
public void WindowAway_HidesTheModule_AndBackShowsItAgain_OnTheSameView() => OdSta.Run(async () =>
{
using var host = NewHost();
using var shell = NewShell(host);
await shell.NavigateAsync("clock");
var view = shell.CurrentView;
var changed = new List<string?>();
shell.PropertyChanged += (_, e) => changed.Add(e.PropertyName);
await shell.SetWindowAwayAsync(away: true);
await shell.SetWindowAwayAsync(away: true);
Assert.Equal(OdModuleState.Idle, host.Find("clock")?.State);
Assert.Equal(OdModuleState.Idle, shell.Library[0].State);
Assert.Same(view, shell.CurrentView);
await shell.SetWindowAwayAsync(away: false);
Assert.Equal(OdModuleState.Active, host.Find("clock")?.State);
Assert.Same(view, shell.CurrentView);
// The stage keeps its view, so a module in full screen stays there.
Assert.DoesNotContain(nameof(OdShellViewModel.CurrentView), changed, StringComparer.Ordinal);
Assert.Equal("clock", shell.CurrentTarget);
});
[Fact]
public void WindowBack_AfterAHibernation_ShowsTheNewView() => OdSta.Run(async () =>
{
using var host = NewHost();
using var shell = NewShell(host);
await shell.NavigateAsync("clock");
var view = shell.CurrentView;
await shell.SetWindowAwayAsync(away: true);
Assert.True(await host.HibernateAsync("clock"));
Assert.Same(view, shell.CurrentView);
await shell.SetWindowAwayAsync(away: false);
Assert.NotNull(shell.CurrentView);
Assert.NotSame(view, shell.CurrentView);
Assert.Same(host.Find("clock")?.View, shell.CurrentView);
});
[Fact]
public void ABrandName_IsShownAsWritten()
{