Skip to content

Issue #10 - [BUG] Terminal Loses Focus When Running a Background App #25

@rogelio-cmj

Description

@rogelio-cmj

Motivation

When users launch background applications, they expect to continue working in their current window without interruption. However, the current implementation treats all newly created windows equally, causing background applications to steal keyboard focus from the active window.

This is a general problem that can occur in multiple contexts across the system, but it is most noticeable in the terminal.

Current Behavior

When a background application is launched from the terminal, the newly created window automatically receives keyboard focus, even though it's not visible or interactive.

Reproduction Steps

  1. Open the Terminal application in Puter

  2. Create and run a simple background test script:

    echo "echo Running background process; sleep 5" > background-test.sh
    chmod +x background-test.sh
    ./background-test.sh &
  3. Attempt to continue typing in the terminal immediately after launching the background app

  4. Observe: The terminal no longer has keyboard focus, and keystrokes are not registered in the terminal

Expected Behavior

When a background application is launched, it should run without stealing focus from the currently active window. The terminal (or any other active application) should retain keyboard focus, allowing users to continue their work uninterrupted.

Acceptance Criteria

  • Background applications launched from the terminal do not steal keyboard focus
  • The terminal retains focus after launching a background app, allowing continued typing
  • Existing window focus behavior for interactive applications remains unchanged

Steps To Test

  1. Go to Puter and open the terminal
  2. Launch a background application from the terminal using the test script above
  3. Immediately start typing in the terminal without clicking
    • ✅ Verify that your keystrokes appear in the terminal (focus was not stolen)

Submission

Download https://cap.so/ to record your screen (use Studio mode). Export as an mp4, and drag and drop into an issue comment below.

Guide to submitting pull requests: https://hackmd.io/@timothy1ee/Hky8kV3hlx

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions