feat(ui): open Settings from the Mission Control header
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Controls.ApplicationLifetimes;
|
||||
using Avalonia.Layout;
|
||||
using Avalonia.Media;
|
||||
using ClaudeDo.Ui.Services;
|
||||
@@ -31,6 +33,18 @@ public sealed class WindowDialogService : IDialogService
|
||||
|
||||
private IslandsShellViewModel? Shell => _owner.DataContext as IslandsShellViewModel;
|
||||
|
||||
// Own modals to the window the user is actually looking at (e.g. the Mission Control
|
||||
// window when Settings is opened from there), falling back to the main window.
|
||||
private Window ActiveOwner()
|
||||
{
|
||||
if (Application.Current?.ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
|
||||
{
|
||||
var active = desktop.Windows.FirstOrDefault(w => w.IsActive);
|
||||
if (active is not null) return active;
|
||||
}
|
||||
return _owner;
|
||||
}
|
||||
|
||||
public async Task ShowAboutAsync(AboutModalViewModel vm)
|
||||
{
|
||||
var dlg = new AboutModalView { DataContext = vm };
|
||||
@@ -48,7 +62,7 @@ public sealed class WindowDialogService : IDialogService
|
||||
public async Task ShowSettingsAsync(SettingsModalViewModel vm)
|
||||
{
|
||||
var dlg = new SettingsModalView { DataContext = vm };
|
||||
await dlg.ShowDialog(_owner);
|
||||
await dlg.ShowDialog(ActiveOwner());
|
||||
}
|
||||
|
||||
public async Task ShowListSettingsAsync(ListSettingsModalViewModel vm)
|
||||
|
||||
Reference in New Issue
Block a user