Files
notify/Notify/Models/ToastSettings.cs
T
chuan b89223fa54 feat: 定位模型重做、聚焦短显、托盘交互与 host spawn 修复
- 定位改为 水平(左/中/右) × 垂直(上/中/下) + 边缘留白,取代四角枚举
- 完成类通知在目标窗口已聚焦时用更短停留(FocusedDurationSeconds)
- 托盘左键单击直接打开设置,右键菜单仅保留退出
- 修复 host 拉起用 UseShellExecute=true,脱离钩子 stdout 管道,避免 Claude 卡在 running stop hook
2026-06-22 16:40:27 +08:00

85 lines
1.9 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
namespace Notify.Models;
/// <summary>
/// 水平方向:决定 toast 贴左/居中/贴右
/// </summary>
public enum HEdge
{
Left,
Center,
Right,
}
/// <summary>
/// 垂直方向:决定 toast 贴上/居中/贴下,并决定堆叠方向
/// </summary>
public enum VEdge
{
Top,
Center,
Bottom,
}
/// <summary>
/// 持久化的弹窗设置(纯数据模型,序列化到磁盘)
/// </summary>
public sealed class ToastSettings
{
/// <summary>
/// 自动消失前的停留秒数
/// </summary>
public int DurationSeconds { get; set; } = 4;
/// <summary>
/// 目标窗口已在前台时的停留秒数(你正盯着看,弹一下即可)
/// </summary>
public int FocusedDurationSeconds { get; set; } = 2;
/// <summary>
/// 水平方向
/// </summary>
public HEdge Horizontal { get; set; } = HEdge.Right;
/// <summary>
/// 垂直方向
/// </summary>
public VEdge Vertical { get; set; } = VEdge.Bottom;
/// <summary>
/// 与屏幕边缘的留白(DIP
/// </summary>
public int Margin { get; set; } = 12;
/// <summary>
/// 不透明度 01
/// </summary>
public double Opacity { get; set; } = 0.96;
/// <summary>
/// 最多同时可见的 toast 数量,超出则排队
/// </summary>
public int MaxVisible { get; set; } = 5;
/// <summary>
/// 是否播放提示音
/// </summary>
public bool PlaySound { get; set; } = true;
/// <summary>
/// toast 宽度(DIP
/// </summary>
public double Width { get; set; } = 340;
/// <summary>
/// 淡入/淡出时长(毫秒)
/// </summary>
public int FadeMilliseconds { get; set; } = 300;
/// <summary>
/// 跨所有虚拟桌面显示(未公开 API,失败自动退回单桌面)
/// </summary>
public bool ShowOnAllDesktops { get; set; } = true;
public ToastSettings Clone() => (ToastSettings)MemberwiseClone();
}