基于WebView2实现的Win11桌面框架,利用插件自定义
Moli
2026-05-02 ae7304f4ee418d517275c2ad3ead1e9ef1888510
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
using Moli.Desktop.Layout;
using Moli.Desktop.Plugins;
 
namespace Moli.Desktop.Configuration;
 
public sealed record StartupSettings
{
    public bool StartWithWindows { get; init; }
    public bool StartMinimized { get; init; } = true;
}
 
public sealed record RuntimeSettings
{
    public int ApiPort { get; init; } = 8765;
    public bool SafeInputMode { get; init; }
    public bool EditMode { get; init; }
}
 
public sealed record AppSettingsDocument
{
    public int SchemaVersion { get; init; } = 1;
    public StartupSettings Startup { get; init; } = new();
    public RuntimeSettings Runtime { get; init; } = new();
}
 
public sealed record PluginRegistryItem
{
    public required PluginId Id { get; init; }
    public PluginState State { get; init; } = PluginState.Enabled;
    public DateTimeOffset UpdatedAt { get; init; } = DateTimeOffset.UtcNow;
}
 
public sealed record PluginRegistryDocument
{
    public int SchemaVersion { get; init; } = 1;
    public List<PluginRegistryItem> Plugins { get; init; } = [];
}
 
public sealed record MonitorInfo
{
    public required MonitorId Id { get; init; }
    public required RectD Bounds { get; init; }
    public required RectD WorkArea { get; init; }
    public bool IsPrimary { get; init; }
    public double Scale { get; init; } = 1;
}
 
public sealed record MonitorSnapshot
{
    public DateTimeOffset CapturedAt { get; init; } = DateTimeOffset.UtcNow;
    public List<MonitorInfo> Monitors { get; init; } = [];
}
 
public sealed record WidgetLayout
{
    public required WidgetInstanceId InstanceId { get; init; }
    public required PluginId PluginId { get; init; }
    public required MonitorId MonitorId { get; init; }
    public required RectD Bounds { get; init; }
    public bool IsVisible { get; init; } = true;
    public bool IsLocked { get; init; }
    public double Opacity { get; init; } = 1;
    public bool ClickThrough { get; init; } = true;
    public double Scale { get; init; } = 1;
}
 
public sealed record LayoutDocument
{
    public int SchemaVersion { get; init; } = 1;
    public List<MonitorSnapshot> Monitors { get; init; } = [];
    public List<WidgetLayout> Instances { get; init; } = [];
}
 
public sealed record ConfigurationSnapshot
{
    public AppSettingsDocument AppSettings { get; init; } = new();
    public PluginRegistryDocument Plugins { get; init; } = new();
    public LayoutDocument Layout { get; init; } = new();
}