360 Secure SkillHub
360 安全技能中心

screen-off

这是一个 macOS 命令行工具,可按显示器 ID、模糊名称或索引开启或关闭指定屏幕,支持强制关闭和永久设置,并能列出显示器状态。依赖 Python 3.8+ 与 CoreGraphics/SkyLight 私有 API,仅适用于 macOS。

mfang0126
mfang0126
热度 16.11
最近更新 2026-08-31 00:21:36
分类:自动化依赖:代码执行应用场景:工作流 / 自动化脚本

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add screen-off
Metadata
name
screen-off
description
Toggle any macOS display on/off by ID, name, or index.
version
1.0.0
author
mfang0126
license
MIT
metadata
{"hermes":{"tags":["macos","display","screen","toggle","cli","hardware"]},"platforms":["macos"]}

screen-off

macOS display toggle CLI — turn any screen on/off by ID, name, or index. Zero dependencies, Python 3.8+.

Based on zy0816/ScreenOff (MIT). Uses CoreGraphics/SkyLight private API.

When to Use

  • You have external monitors and want to turn off a specific screen
  • Multi-display setup management
  • Quick screen toggle from terminal/agent

Quick Start

git clone https://github.com/mfang0126/screen-off.git
alias screen-off='python3 /path/to/screen-off/screen-off.py'

Usage

screen-off --status          # List all displays
screen-off --off 3           # Turn off by ID (stable)
screen-off --on 3            # Turn on by ID
screen-off --off #2          # Turn off by index (changes)
screen-off --off main        # Turn off main display
screen-off --off "S2700"     # Fuzzy match by name
screen-off --off 3 --force   # Force (even if only screen)
screen-off --off 3 --permanent  # Survive reboot

Requirements

  • macOS (SkyLight/CoreGraphics framework)
  • Python 3.8+ (system built-in)