Skip to content

Windows: terminal window minimizes when plugin runs due to PowerShell -WindowStyle Hidden in focus detection #80

@kratky-pavel

Description

@kratky-pavel

On Windows, opencode-notifier 0.2.6 and newer minimize the current terminal window when OpenCode runs.

Tested environment:

  • Windows
  • PowerShell 7.6.1
  • cmd.exe
  • OpenCode 1.16.0

Reproduction:

  1. Configure the plugin as:
    @mohak34/opencode-notifier@0.2.6

  2. Run:
    opencode run "hello"

Actual result:
The current PowerShell/cmd window is minimized.

Expected result:
The terminal window should stay visible.

Regression:

  • @mohak34/opencode-notifier@0.2.5 works correctly
  • @mohak34/opencode-notifier@0.2.6 minimizes the terminal
  • @mohak34/opencode-notifier@latest also minimizes the terminal

I compared 0.2.5 and 0.2.6 and found that 0.2.6 added this argument to the internal PowerShell/pwsh call used for Windows focus detection:

-WindowStyle Hidden

After removing "-WindowStyle", "Hidden" from the cached dist/index.js, the terminal no longer minimizes.

So the likely cause is the use of -WindowStyle Hidden when calling PowerShell/pwsh for GetForegroundWindow focus detection.

Current workaround:
Pin the plugin to 0.2.5:

@mohak34/opencode-notifier@0.2.5

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions