# TimerAlert **Repository Path**: lisniuse/timer-alert ## Basic Information - **Project Name**: TimerAlert - **Description**: TimerAlert - **Primary Language**: Go - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-04-28 - **Last Updated**: 2026-04-29 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # TimerAlert TimerAlert 是一个用 Go 编写的 Windows 11 桌面提醒工具。程序会读取 `config.json` 中的时间安排,到点后弹出系统通知,并常驻托盘方便随时启用、停用或退出。 ## 主要功能 - 读取 `config.json` 配置每日提醒 - 使用 Windows 11 Toast 通知弹窗 - 托盘图标和右键菜单 - 启用/停用提醒 - 开机启动/取消开机启动 - 自动检测配置文件变更 - 手动重新读取配置 - 立即发送测试通知 - 打开配置文件 - 退出程序 - 通知失败时写入 `TimerAlert.log` ## 托盘菜单 启动 `TimerAlert.exe` 后,程序会显示在 Windows 托盘区域。右键托盘图标可以使用: - `启用提醒` / `停用提醒` - `开机启动` / `取消开机启动` - `重新读取配置` - `发送测试通知` - `打开配置文件` - `退出` ## 配置文件 程序启动时读取可执行文件同目录下的 `config.json`。如果文件不存在,程序会自动生成默认配置。 当前配置示例: ```json { "enabled": true, "app_name": "TimerAlert", "check_interval_seconds": 15, "alerts": [ { "id": "wake-up", "title": "起床", "message": "9 点了,起床洗漱,准备开始今天的游戏日程。", "time": "09:00" }, { "id": "meeting", "title": "会议提醒", "message": "20:00 开会,预计到 20:30。", "time": "20:00" } ] } ``` 字段说明: - `enabled`:提醒总开关,`true` 为启用。 - `app_name`:应用名称。 - `check_interval_seconds`:检查提醒时间的间隔,建议保持 `15` 秒左右。 - `alerts`:提醒列表。 - `alerts[].id`:提醒唯一标识。 - `alerts[].title`:通知标题。 - `alerts[].message`:通知正文。 - `alerts[].time`:单个提醒时间,格式为 `HH:mm`。 - `alerts[].times`:多个提醒时间,格式为 `["10:30", "15:30"]`。 - `alerts[].weekdays`:可选,星期过滤,`1` 到 `7` 分别代表周一到周日;不填则每天提醒。 - `alerts[].enabled`:可选,单条提醒开关;省略时默认启用。 ## 当前日程 仓库中的 `config.json` 已配置为每日游戏日程: | 时间 | 安排 | | --- | --- | | 09:00 | 起床 | | 09:20 | 洛克王国 | | 10:30 | 异环 | | 11:40-12:30 | 午饭 | | 12:30 | 暗黑破坏神 4 | | 14:30 | 三角洲行动 | | 16:20 | 生化危机 2 重制版 | | 17:50-19:00 | 晚饭 | | 19:00 | 燕云十六声 | | 20:00-20:30 | 会议 | | 20:30 | 三角洲行动 | | 22:20 | 暗黑破坏神 4 | | 00:10 | 睡前整理 | | 00:30 | 睡觉 | ## 构建 安装依赖并构建: ```powershell go mod tidy go build -ldflags="-H windowsgui" -o TimerAlert.exe . ``` 如果希望调试时看到控制台日志,可以去掉 `-ldflags="-H windowsgui"`: ```powershell go build -o TimerAlert.exe . ``` ## 图标 项目包含两种图标资源: - `assets/timer-alert.png`:1024x1024 PNG 图标,可用于发布页、快捷方式素材等。 - `assets/timer-alert.ico`:多尺寸 ICO 图标,程序托盘会在编译时内嵌使用。 - `rsrc_windows_amd64.syso`:Windows exe 图标资源文件,`go build` 会自动链接到 `TimerAlert.exe`。 如需重新生成 exe 图标资源,需要先安装 `rsrc`: ```powershell go install github.com/akavel/rsrc@latest rsrc -arch amd64 -ico assets/timer-alert.ico -o rsrc_windows_amd64.syso go build -ldflags="-H windowsgui" -o TimerAlert.exe . ``` ## 开机启动 托盘菜单中的 `开机启动` 会写入当前用户注册表: ```text HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run ``` 选择 `取消开机启动` 会删除对应注册表项。 ## 注意事项 - 程序需要保持运行,提醒才会弹出。 - 如果修改了 `config.json`,程序会自动检测;也可以通过托盘菜单手动 `重新读取配置`。 - 如果没有看到通知,请检查 Windows 的通知权限、请勿打扰/专注助手设置。 - 如果通知接口报错,会写入可执行文件同目录下的 `TimerAlert.log`。