agentleFS
TomGranotTomGranot/fix-chrome-open-not-showing-skill/.agents/skills/fix-chrome-open-not-showing/SKILL.md

fix-chrome-open-not-showing

Skill0 starsChanged 4 months agoMITView on GitHub

Diagnose and fix macOS Google Chrome running with no visible window. Use when Chrome's menu bar shows but no window appears, a window is stuck off-screen on a disconnected external monitor, or Cmd+N and File menu New Window do nothing. Skip Chrome that crashes on launch, and skip non-macOS.

The file

We split this skill into the rules it gives an agent

9 rules. About 0 are common, 5 are distinctive, and 4 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈5

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 4

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  • could be automatic: a setting could enforce it
  1. Distinctive:

    Ask the user if a window appeared.

    line 43
  2. Very specific:

    Verify nothing remains (must print 0):

    line 58
  3. Very specific:

    If it is not 0, repeat the pgrep | xargs kill -9 line until it is.

    line 64
  4. Distinctive:

    Read each profile's saved rectangle:

    line 69
  5. Distinctive:

    Make sure Chrome is fully dead (rerun Step 3), then launch with explicit geometry that Chrome cannot override from saved state:

    line 105
  6. Distinctive:

    Use the menu bar: Window > Move & Resize > Center (or Zoom) to pull the window onto the main display.

    line 125
  7. Distinctive:

    Check other desktops/Spaces with Mission Control (F3).

    line 127
  8. Very specific:

    After Step 5, python3 scripts/window_placement.py inspect shows all rectangles within the current display bounds.

    line 133
  9. Very specific:

    Not macOS: stop. This skill relies on macOS-only tooling (osascript, system_profiler, the macOS Preferences path).

    line 147

≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Fix Chrome Open Not Showing

Outcome

A visible, on-screen Google Chrome window, plus the reason it was hidden (almost always: Chrome restored its window onto an external monitor that is no longer connected, so it opened off-screen).

When this applies

  • Chrome is running (menu bar reads "Chrome") but you see no window.
  • The Window menu shows Minimize and Zoom greyed out — that means Chrome has zero windows, not a hidden one.
  • New-window shortcuts (Cmd+N, File > New Window) appear to do nothing.

macOS only. If Chrome crashes seconds after launch instead, this is the wrong skill.

How to run it

Escalate through the ladder in order. After each step that could produce a window, stop and ask the user: "Did a Chrome window appear?" Only continue to the next step if the answer is no. Do not run destructive steps (kill, Preferences rewrite) before confirming the cheap steps failed.

The scripts/window_placement.py helper handles the profile-inspection and reset steps deterministically. Invoke it with the path relative to this skill directory.

Step 1 — Ask Chrome to make a window (cheap, non-destructive)

osascript -e 'tell application "Google Chrome" to make new window' \
          -e 'tell application "Google Chrome" to activate'

Ask the user if a window appeared. If yes → done. If no → continue.

Step 2 — Confirm zero windows

Have the user open the Window menu. If Minimize/Zoom are greyed out, Chrome genuinely has no windows and Step 1 failed silently — this confirms the off-screen saved-bounds diagnosis. Continue.

Step 3 — Fully quit and kill every Chrome process

osascript -e 'tell application "Google Chrome" to quit'; sleep 2
pgrep -i "Google Chrome" | xargs -r kill -9

Verify nothing remains (must print 0):

pgrep -i "Google Chrome" | wc -l

If it is not 0, repeat the pgrep | xargs kill -9 line until it is. Helper processes can be stubborn; killing by PID is more reliable than killall.

Step 4 — Inspect saved window bounds vs. the current display

Read each profile's saved rectangle:

python3 scripts/window_placement.py inspect

Get the current display bounds:

system_profiler SPDisplaysDataType | grep -E "Resolution|UI Looks like"

Any profile whose left/top lies outside the active display (for example left greater than the screen width, such as left=3572 on a 1920-wide display) is parked on a disconnected monitor. That is the root cause.

Step 5 — Reset all profiles to a safe on-screen rectangle

python3 scripts/window_placement.py reset

This rewrites browser.window_placement in every profile's Preferences to a box that fits a standard 1920x1080 display (left 100, top 80, right 1600, bottom 1000). Override with --left/--top/--right/--bottom for a smaller screen. Chrome must be fully quit (Step 3) for this to stick. Then relaunch:

open -a "Google Chrome"; sleep 2
osascript -e 'tell application "Google Chrome" to activate'

Ask the user if a window appeared. If yes → done. If no → continue.

Step 6 — Force a positioned window on launch (reliable fallback)

Make sure Chrome is fully dead (rerun Step 3), then launch with explicit geometry that Chrome cannot override from saved state:

open -na "Google Chrome" --args \
  --window-position=100,80 --window-size=1400,900 \
  --new-window "https://www.google.com"
sleep 3
osascript -e 'tell application "Google Chrome" to activate'
osascript -e 'tell application "Google Chrome" to count windows'

A count of 1 or more with a visible window means success.

Step 7 — If the window count is > 0 but still invisible

The window exists but the compositor is hiding it. Suspect Stage Manager or a Spaces/desktop assignment:

  • Toggle Stage Manager off in Control Center, then retry Step 1.
  • Use the menu bar: Window > Move & Resize > Center (or Zoom) to pull the window onto the main display.
  • Check other desktops/Spaces with Mission Control (F3).

Validation

  • osascript -e 'tell application "Google Chrome" to count windows' returns ≥ 1.
  • The user confirms a visible window on the active display.
  • After Step 5, python3 scripts/window_placement.py inspect shows all rectangles within the current display bounds.

Failure handling

  • pgrep ... | wc -l never reaches 0: a process is relaunching Chrome (Keep-Alive, MDM, or a login item). Report this instead of looping; the reset cannot apply while Chrome is running.
  • reset reports 0 profiles changed: the profiles have no saved window_placement yet, so off-screen bounds are not the cause. Go straight to Step 6.
  • Step 6 window count is 0: Chrome may be blocked by a corrupt Local State or a policy. Report the failure; do not delete profile data without explicit user consent.
  • Not macOS: stop. This skill relies on macOS-only tooling (osascript, system_profiler, the macOS Preferences path).

Root cause

Chrome saves per-profile window bounds in ~/Library/Application Support/Google/Chrome/<Profile>/Preferences under browser.window_placement. When Chrome last ran on an external monitor that is now disconnected, it restores each window at coordinates outside the current display, so the window is real but off-screen. Resetting those bounds — or forcing geometry at launch — brings it back.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.