Add --foreground option to control MPV window foreground behavior - #4
Merged
Merged
Conversation
Co-authored-by: zhongfly <11155705+zhongfly@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] 增加一个选项用于设置是否使用setForegroundWindow将mpv窗口前置,选项在命令行和配置文件中都可以使用
Add --foreground option to control MPV window foreground behavior
Sep 17, 2025
Owner
|
@copilot 只在foreground为true时,运行getPid函数 |
Co-authored-by: zhongfly <11155705+zhongfly@users.noreply.github.com>
Contributor
Author
Copilot stopped work on behalf of
zhongfly due to an error
September 17, 2025 15:14
Owner
|
@copilot 修复问题:配置文件中设置foreground=false不生效 |
Co-authored-by: zhongfly <11155705+zhongfly@users.noreply.github.com>
Contributor
Author
Fixed! The issue was that the flag pointer was always passed to resolveConfig(), preventing config file values from being used. Now using flag.Visit() to detect when the user explicitly set --foreground, only then do we override the config file. Commit: c65f83c |
Copilot stopped work on behalf of
zhongfly due to an error
September 18, 2025 11:20
Owner
|
@copilot 当foreground=false时,startMPV启动新的MPV进程时添加参数--window-minimized=yes使得mpv不抢占当前窗口的焦点 |
Co-authored-by: zhongfly <11155705+zhongfly@users.noreply.github.com>
Contributor
Author
zhongfly
marked this pull request as ready for review
September 18, 2025 11:49
zhongfly
deleted the
copilot/fix-1d784a4b-e77a-442d-bf53-0924854cf968
branch
September 18, 2025 11:52
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.
foregroundoption to Config struct with default valuetrue--foregroundto control window foreground behaviorresolveConfigfunction to handle the new foreground optionsetForegroundWindowbased on the optionSummary
Successfully implemented a new
--foregroundoption that allows users to control whether the MPV window is brought to the foreground after loading files.Key Features:
--foreground=falseto disable foreground behaviorforeground=falsein umpv.confUsage Examples:
umpv --foreground=false video.mkvforeground=falseto umpv.confThe implementation handles both scenarios:
The implementation passes all validation tests for configuration parsing, flag handling, and priority resolution (CLI args override config file values).
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.