Best for
- Use when building always-on-top Electron overlays that should recede while the user works in other apps.
sonichi/sutando/skills/electron-overlay-dimming/SKILL.md
Reusable pattern for focus-based auto-dimming of Electron overlay windows — when the app loses focus, all overlay windows fade to a low opacity; when an overlay regains focus, they return to their configured opacity. Use when building always-on-top Electron overlays that should recede while the user works in other apps.
Decision brief
A small, self-contained pattern for always-on-top Electron overlays: the overlays stay readable while in use but fade out of the way when the user clicks into another application, and restore when focus returns to an overlay. First shipped in the benchmark-overlay app.
Compatibility matrix
| Platform | Status | Evidence | What to check |
|---|---|---|---|
| Codex | Not declared | No explicit evidence | Portability before use |
| Claude Code | Not declared | No explicit evidence | Portability before use |
| Cursor | Not declared | No explicit evidence | Portability before use |
| Gemini CLI | Not declared | No explicit evidence | Portability before use |
Installation
The source command is displayed only when detected. A safe inspection prompt is always available so your agent can explain every action before execution.
npx skills add https://github.com/sonichi/sutando --skill "skills/electron-overlay-dimming"Inspect the Agent Skill "electron-overlay-dimming" from https://github.com/sonichi/sutando/blob/6a8f0fccd32e5aa620a3572c8885544f144bb6fe/skills/electron-overlay-dimming/SKILL.md at commit 6a8f0fccd32e5aa620a3572c8885544f144bb6fe. List every install step, command, network request, credential, file read/write, external action, and rollback step. Explain whether it fits my task. Do not install or execute anything until I approve.
Workflow
Any code path that sets a window's opacity (e.g. a config handler) must route through effectiveOpacity() so opacity changes made while dimmed don't undim the window.
App loses focus (no overlay window is focused) → every overlay window's
Two pitfalls the pattern handles:
Live implementation: /projects/benchmark-overlay/main.js — the benchmark-overlay app applies this across three overlay windows (AI Benchmarks, System Resources, Hub Overlay).
Permission review
No configured static risk pattern was detected
This is not proof of safety. Runtime behavior, indirect dependencies, and hidden external systems are outside the static scan.
Evidence record
| Signal | Value | Evidence type | Meaning |
|---|---|---|---|
| Quality score | 66/100 | Computed | Documentation, specificity, maintenance, and trust rules |
| Repository stars | 359 | Source | Repository attention, not individual Skill quality |
| Compatibility | 0 platforms | Source | Declared in the catalog source record |
| Usage guide | automated source guide | Editorial | Generated or reviewed according to the visible evidence level |
Pinned source
A small, self-contained pattern for always-on-top Electron overlays: the
overlays stay readable while in use but fade out of the way when the user
clicks into another application, and restore when focus returns to an
overlay. First shipped in the benchmark-overlay app.
Two pitfalls the pattern handles:
blur then a focus. Dimming on raw blur would flicker. The fix: on
blur, defer ~80 ms and only dim if BrowserWindow.getFocusedWindow() is
then null — i.e. the app truly lost focus, not just one window.appDimmed ? DIM_OPACITY : overlay.config.opacity.const DIM_OPACITY = 0.2;
let appDimmed = false;
function effectiveOpacity(o) {
return appDimmed ? DIM_OPACITY : o.config.opacity;
}
function applyOpacityAll() {
for (const o of Object.values(OVERLAYS)) {
if (o.win && !o.win.isDestroyed()) o.win.setOpacity(effectiveOpacity(o));
}
}
app.on('browser-window-focus', () => {
if (appDimmed) { appDimmed = false; applyOpacityAll(); }
});
app.on('browser-window-blur', () => {
// Defer so an A→B overlay click doesn't briefly dim.
setTimeout(() => {
if (!appDimmed && !BrowserWindow.getFocusedWindow()) {
appDimmed = true;
applyOpacityAll();
}
}, 80);
});
Any code path that sets a window's opacity (e.g. a config handler) must route
through effectiveOpacity() so opacity changes made while dimmed don't undim
the window.
Live implementation: ~/projects/benchmark-overlay/main.js — the
benchmark-overlay app applies this across three overlay windows (AI
Benchmarks, System Resources, Hub Overlay).