desktop-gui-scripting
Create lightweight Python desktop widgets when GUI automation is unavailable.
- License 许可
- MIT
- 所属仓库
- zapabob/Skills
- 最近更新
- 2026-10-26
- Stars
- ★ 2
- Forks
- 0
01 前言 Front Matter
- name
- desktop-gui-scripting
- tags
- [ "desktop", "python", "tkinter", "gui", "widgets" ]
- author
- Hermes Agent
- license
- MIT
- version
- 1.0.0
- category
- desktop
- metadata
- { "hermes": { "tags": [ "desktop", "python", "tkinter", "gui", "widgets" ], "category": "desktop", "related_skills": [ "computer-use" ] } }
- platforms
- [ "windows", "macos", "linux" ]
- description
- Create lightweight Python desktop widgets when GUI automation is unavailable.
03 SKILL.md 正文
Desktop GUI Scripting Skill
This skill creates small native desktop utilities such as clocks, timers, overlays, and status widgets with Python's standard-library tkinter. It is a fallback for cases where direct desktop automation is unavailable; it does not replace computer_use for interacting with existing applications.
When to Use
- The user asks for a simple desktop widget or overlay.
- The widget should run locally without a package installation.
computer_useis unavailable or not suitable for creating the artifact.- The user needs a persistent, always-on-top display with a simple exit path.
Prerequisites
- Python with Tk support installed.
- A writable destination such as the user's Desktop.
- On Windows, prefer the launcher requested by the workspace convention (
py -3) when available.
How to Run
- Create a standalone
.pyfile withtkinterand no third-party dependencies. - Validate syntax before launch.
- Launch it as a tracked long-running background process.
- Confirm the process remains running; report the absolute file path and exit controls.
For the reusable skeleton, see templates/desktop_widget.py.
For the clock-specific implementation notes from the reference session, see references/digital-clock.md.
Quick Reference
root.attributes("-topmost", True)
root.attributes("-alpha", 0.90)
root.after(250, update)
root.bind("<Escape>", close)
root.protocol("WM_DELETE_WINDOW", close)
Procedure
- Clarify the widget contract. Identify what is displayed, whether it should stay above other windows, and how the user will close it.
- Keep the implementation self-contained. Use
tkinter,datetime, and other standard-library modules unless the user explicitly requests a richer framework. - Design for visibility. Use readable fonts, sufficient contrast, and conservative padding. Add date or secondary status only when useful.
- Add multiple exit paths. Bind Escape, window close, and—when appropriate—a right-click context menu.
- Use an update loop correctly. Schedule refreshes with
root.after()rather than blocking withsleep()inside the UI thread. - Write to an explicit path. Prefer an absolute user-facing path, especially when the process will outlive the current shell.
- Validate and launch. Run a syntax check, then launch from the script's directory or use an absolute path. Poll the background process to distinguish a live GUI from an immediate startup failure.
- Report operation. Give the user the file path, current behavior, exit instructions, and optional customization points.
Pitfalls
- Relative-path launch failure: A path such as
py -3 desktop_clock.pyonly works when the working directory is the script directory. Use an absolute path or setworkdirexplicitly. - GUI lifetime: A widget is intentionally long-running. Use a tracked background process with no completion notification, then poll once to verify it is still alive.
- Automation fallback loop: If
computer_userepeatedly fails during initialization, do not keep retrying blindly; switch to a file-and-process workflow and mention the limitation accurately. - Tk update blocking: Never use a tight loop or
time.sleep()on the main thread; useafter(). - Overlays and focus:
-topmostkeeps the widget visible, but platform window managers may still affect focus. Keep a normal title bar unless the user explicitly wants a borderless overlay. - Transparency portability:
-alphais optional and may vary by window manager; retain a readable opaque fallback. - Unverified visual claim: Process liveness confirms the event loop started, not that the window is visible on the user's monitor. Avoid claiming a screenshot-level verification when desktop capture is unavailable.
Verification
- Syntax validation returns success.
- The background process remains running after launch.
- The script has at least one timer callback and at least two clean exit paths.
- The final response contains an absolute artifact path and truthful verification scope.
- If visual confirmation is needed, use
computer_useafter the widget is launched or ask the user to confirm visibility.
04 同仓库更多 Skills
xurl
X/Twitter via xurl CLI: post, search, DM, media, v2 API.
writing-plans
Write implementation plans: bite-sized tasks, paths, code.
whisper
OpenAI's general-purpose speech recognition model. Supports 99 languages, transcription, translation to English, and language identification. Six model sizes from tiny (39M params) to large (1550M params). Use for speech-to-text, podcast transcription, or multilingual audio processing. Best for robust, multilingual ASR.
weights-and-biases
W&B: log ML experiments, sweeps, model registry, dashboards.
watchers
Poll RSS, JSON APIs, and GitHub with watermark dedup.
serving-llms-vllm
vLLM: high-throughput LLM serving, OpenAI API, quantization.