Cette page est affichée en anglais. Une traduction française est en cours.
ScriptsApr 6, 2026·1 min de lecture

微信沉迷提醒脚本

macOS

Prêt pour agents

Staging sûr pour cet actif

Cet actif est d'abord staged. Le prompt copié demande à l'agent d'inspecter les fichiers staged avant d'activer scripts, config MCP ou config globale.

Stage only · 17/100Policy : staging
Surface agent
Tout agent MCP/CLI
Type
Script
Installation
Stage only
Confiance
Confiance : Established
Point d'entrée
wechat-reminder.sh
Commande de staging sûr
npx -y tokrepo@latest install f64b62db-49f8-4e21-8219-92ef2a9dc6a4 --target codex

Stage les fichiers d'abord; l'activation exige la revue du README et du plan staged.

#!/bin/bash

微信沉迷提醒 - WeChat Usage Reminder

后台运行,检测微信连续使用时间,超时弹通知提醒

===== 可调参数 =====

CHECK_INTERVAL=30 # 每 30 秒检查一次 REMIND_AFTER=600 # 连续用微信 10 分钟后开始提醒 REMIND_EVERY=300 # 之后每 5 分钟再提醒一次

====================

wechat_seconds=0 reminded=false

notify() { osascript -e "display notification "$1" with title "微信沉迷提醒 ⏰" sound name "Glass"" }

echo "🔍 微信沉迷提醒已启动" echo " 连续使用 $((REMIND_AFTER / 60)) 分钟后提醒,之后每 $((REMIND_EVERY / 60)) 分钟提醒一次" echo " 按 Ctrl+C 停止"

while true; do front_app=$(osascript -e 'tell application "System Events" to get name of first application process whose frontmost is true' 2>/dev/null)

if [[ "$front_app" == "WeChat" ]]; then
    wechat_seconds=$((wechat_seconds + CHECK_INTERVAL))
    minutes=$((wechat_seconds / 60))

    if [[ $wechat_seconds -ge $REMIND_AFTER ]]; then
        seconds_past=$((wechat_seconds - REMIND_AFTER))
        if [[ $seconds_past -eq 0 ]] || [[ $((seconds_past % REMIND_EVERY)) -eq 0 ]]; then
            notify "你已经刷了 ${minutes} 分钟微信了,休息一下吧!"
            echo "⚠️  已提醒:连续使用微信 ${minutes} 分钟"
        fi
    fi
else
    # 离开微信了,如果之前超过了提醒阈值,报告一下
    if [[ $wechat_seconds -ge $REMIND_AFTER ]]; then
        minutes=$((wechat_seconds / 60))
        notify "本次微信使用共 ${minutes} 分钟,已离开 👍"
        echo "✅ 离开微信,本次使用 ${minutes} 分钟"
    fi
    wechat_seconds=0
fi

sleep $CHECK_INTERVAL

done

Fil de discussion

Connectez-vous pour rejoindre la discussion.
Aucun commentaire pour l'instant. Soyez le premier à partager votre avis.

Actifs similaires