fix(gui): prevent background apps from stealing focus#1491
Merged
jelveh merged 2 commits intoHeyPuter:mainfrom Sep 7, 2025
rajanarahul93:fix/terminal-focus-loss-clean
Merged
fix(gui): prevent background apps from stealing focus#1491jelveh merged 2 commits intoHeyPuter:mainfrom rajanarahul93:fix/terminal-focus-loss-clean
jelveh merged 2 commits intoHeyPuter:mainfrom
rajanarahul93:fix/terminal-focus-loss-clean
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fix(gui): prevent background apps from stealing focus
Summary
This pull request fixes an issue where launching a background application from the terminal would incorrectly steal keyboard focus. The change introduces a condition to the window creation logic, ensuring that only foreground applications receive focus upon launch, thereby preserving the user's context in the terminal.
Root Cause
The
UIWindowcomponent was designed to unconditionally grant focus to any newly created window that was marked as visible. This behavior did not differentiate between interactive foreground applications and non-interactive background processes, causing the latter to incorrectly steal focus from the active window.Changes
options.backgroundproperty to theUIWindowcomponent, which defaults tofalse.UIWindow.jsto only callfocusWindow()if theoptions.backgroundproperty isfalse.dropanddragster:enter) to also respect theoptions.backgroundflag, ensuring focus is not stolen during drag-and-drop operations.Closes #453