返回顶部
c

cc-sticky-notify粘性通知

>

作者: admin | 来源: ClawHub
源自
ClawHub
版本
V 1.0.2
安全检测
已通过
132
下载量
免费
免费
1
收藏
概述
安装方式
版本历史

cc-sticky-notify

cc-sticky-notify

Mac系统上的固定便签通知系统。关键的Claude Code事件会以黄色浮动便签的形式显示在屏幕右上角,并持续显示直至手动关闭。

文件结构(完全自包含)

~/.claude/skills/cc-sticky-notify/
├── SKILL.md
├── install.sh ← 一次性设置:chmod +x 及 settings.json 指引
└── scripts/
├── notify.sh ← 主通知脚本(由钩子直接调用)
├── sticky-window.swift ← Swift源代码(首次安装时由install.sh编译)
└── sticky-notify.app/ ← .app 应用包(首次使用时自动构建)
└── Contents/
├── Info.plist
└── MacOS/
└── sticky-notify-app

双层通知机制

  1. 1. display notification — 无需权限,立即在右上角显示
  2. Swift NSWindow(.floating层级)— 固定便签,通过✕手动关闭

钩子覆盖范围(与popo-notify一致):

钩子触发条件便签内容
Stop任务完成✅ 任务完成 + 时间/项目/会话
Notification/permission_prompt
需要权限批准 | 🔐 需要权限批准 |
| Notification/idle_prompt | 等待用户选择 | 💬 等待您的输入 |
| PostToolUse/Bash(失败时) | 命令执行失败 | ❌ 命令失败,退出码 |


系统要求

  • - macOS 12 Monterey 或更高版本
  • Xcode命令行工具 — 用于编译Swift浮动窗口、代码签名和JSON解析

bash
xcode-select --install

所有依赖项(swiftc、codesign)均来自Xcode CLT。install.sh会检查CLT是否安装,如果缺失则会提前退出。



安装

当用户请求安装时,请按以下步骤操作:

步骤1 — 运行install.sh

bash
bash ~/.claude/skills/cc-sticky-notify/install.sh

此脚本执行以下操作:

  1. 1. 检查Xcode CLT — 如果xcode-select -p失败,则提前退出并显示说明。
  2. chmod +x notify.sh — 确保脚本可执行(git clone可能会移除+x权限位)。
  3. 构建.app应用包 — 编译sticky-window.swift,写入Info.plist + 授权文件,使用codesign签名。如果应用包已存在则跳过。
  4. 检查钩子配置 — 检查~/.claude/settings.json中是否已有cc-sticky-notify条目,如果未找到则打印所需的钩子命令。
  5. 冒烟测试 — 通过notify.sh触发测试通知。

步骤2 — 配置settings.json钩子

读取~/.claude/settings.json,在hooks字段的以下四个位置各添加一个sticky-notify条目(如果已存在则跳过)。

Stop — 追加到Stop[0].hooks:
json
{
type: command,
command: $HOME/.claude/skills/cc-sticky-notify/scripts/notify.sh
}

Notification/permission_prompt — 追加:
json
{
type: command,
command: $HOME/.claude/skills/cc-sticky-notify/scripts/notify.sh 🔐 Claude Code需要权限批准,请检查终端
}

Notification/idle_prompt — 追加:
json
{
type: command,
command: $HOME/.claude/skills/cc-sticky-notify/scripts/notify.sh 💬 Claude Code等待您的输入,请检查终端
}

PostToolUse/Bash — 追加(仅在失败时触发):
json
{
type: command,
command: bash -c INPUT=$(cat); STATUS=$(echo \$INPUT\ | jq -r \.tool_response.exitCode // 0\); [ \$STATUS\ != \0\ ] && $HOME/.claude/skills/cc-sticky-notify/scripts/notify.sh \❌ Claude Code命令失败,退出码:$STATUS\ || true
}

步骤3 — 验证

bash

测试参数模式(模拟Notification钩子)


$HOME/.claude/skills/cc-sticky-notify/scripts/notify.sh ✅ 安装验证成功

测试stdin模式(模拟Stop钩子)

echo {session_id:test12345678} | $HOME/.claude/skills/cc-sticky-notify/scripts/notify.sh

如果在右上角出现黄色便签和系统通知,则表示安装成功。



配置

CCSTICKYNOTIFYCLOSETIMEOUT — 自动关闭超时时间

便签默认在1小时(3600秒)后自动关闭。可通过此环境变量覆盖:

bash
export CCSTICKYNOTIFYCLOSETIMEOUT=300 # 5分钟后自动关闭

  • - 单位:秒(支持小数,例如30.5)
  • 必须大于0;否则回退到默认的3600秒
  • 设置较大值(例如86400)可使便签保持显示近一整天

要持久化此设置,请将其添加到shell配置文件中(~/.zshrc或~/.bashrc):

bash
echo export CCSTICKYNOTIFYCLOSETIMEOUT=300 >> ~/.zshrc



故障排除

系统通知也未显示

  • - 检查~/.claude/settings.json中的钩子配置是否正确
  • 路径应为$HOME/.claude/skills/cc-sticky-notify/scripts/notify.sh

编译时出现xcrun: error: invalid active developer path

  • - Xcode命令行工具路径损坏(常见于macOS升级或Xcode重新安装后)
  • 修复方法:sudo xcode-select --reset
  • 如果无效,请重新安装:xcode-select --install
  • 如果swiftc无法编译,浮动便签窗口将被禁用,但系统通知仍可正常工作

notify.sh出现Permission denied

  • - 脚本缺少执行权限 — 当文件被克隆或复制时未保留权限时会发生
  • 修复方法:chmod +x ~/.claude/skills/cc-sticky-notify/scripts/notify.sh
  • 修复后重新运行install.sh(最新版本会在启动时自动运行chmod +x)

标签

skill ai

通过对话安装

该技能支持在以下平台通过对话安装:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 cc-sticky-notify-1775968516 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 cc-sticky-notify-1775968516 技能

通过命令行安装

skillhub install cc-sticky-notify-1775968516

下载

⬇ 下载 cc-sticky-notify v1.0.2(免费)

文件大小: 14.15 KB | 发布时间: 2026-4-13 09:39

v1.0.2 最新 2026-4-13 09:39
cc-sticky-notify 1.0.2

---
New Features

Source Display

The notification window now shows a Source field displaying the name of the program
that triggered the notification, making it easy to identify where a message came from.

Cross-Desktop Follow Mode

Notifications can now follow you across virtual desktops. Disabled by default — click
the gray vertical bar on the left side of the window to activate it. The bar turns
amber when active, and the notification window will automatically appear on whichever
desktop you switch to.

Collapse / Expand

The notification window can now be collapsed to show only the title bar, saving screen
space. Expand it again with a single click whenever needed.

---
Improvements

Project Name Highlight

The project name is now displayed in bold red, making it instantly recognizable when
switching between multiple projects.

Stronger Pulse Animation for Same-Session Updates

When a new message arrives in the same session, the pulse animation is significantly
more prominent, reducing the chance of missing a notification while focused on work.

---
Bug Fixes

Message Deduplication

Consecutive identical messages now trigger only one notification, eliminating
repetitive alerts.

Multi-Window Focus Fix

Fixed a long-standing issue where clicking a notification failed to accurately bring
the correct window into focus when multiple windows of the same program were open.

Main Screen Only

In multi-monitor setups, notification windows now appear exclusively on the primary
display, preventing them from popping up on secondary screens and keeping visual focus
consistent.

Archiver·手机版·闲社网·闲社论坛·羊毛社区· 多链控股集团有限公司 · 苏ICP备2025199260号-1

Powered by Discuz! X5.0   © 2024-2025 闲社网·线报更新论坛·羊毛分享社区·http://xianshe.com

p2p_official_large
返回顶部