diff --git a/CHANGELOG.md b/CHANGELOG.md index 9ecf799..260c868 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## [Unreleased] ### Added - Add desktop file associations for batch files and Internet shortcuts + - Add `--unattended/-q` option for running Winetricks GUI in unattended mode ### Changed - Ignore duplicate Steam apps and only list the most recently updated app diff --git a/src/protontricks/cli/main.py b/src/protontricks/cli/main.py index d1ac0e4..5e75b23 100755 --- a/src/protontricks/cli/main.py +++ b/src/protontricks/cli/main.py @@ -110,6 +110,13 @@ def main(args=None, steam_path=None, steam_root=None): parser.add_argument( "--gui", action="store_true", help="Launch the Protontricks GUI.") + parser.add_argument( + "-q", "--unattended", action="store_true", + help=( + "Run Winetricks in unattended mode when using --gui. " + "This suppresses the 64-bit Wine prefix warning." + ) + ) parser.add_argument("appid", type=int, nargs="?", default=None) parser.add_argument("winetricks_command", nargs=argparse.REMAINDER) @@ -203,13 +210,17 @@ def run(self): cwd = \ str(self.steam_app.install_path) if self.cli_args.cwd_app else None + command = [str(self.winetricks_path), "--gui"] + if self.cli_args.unattended: + command.append("-q") + run_command( winetricks_path=self.winetricks_path, proton_app=self.proton_app, steam_app=self.steam_app, use_steam_runtime=self.use_steam_runtime, legacy_steam_runtime_path=self.legacy_steam_runtime_path, - command=[str(self.winetricks_path), "--gui"], + command=command, use_bwrap=self.use_bwrap, start_wineserver=self.start_background_wineserver, cwd=cwd diff --git a/tests/cli/test_main.py b/tests/cli/test_main.py index 02b52af..8d04630 100644 --- a/tests/cli/test_main.py +++ b/tests/cli/test_main.py @@ -741,9 +741,17 @@ def test_steam_installation_not_selected(self, cli, gui_provider): class TestCLIGUI: + @pytest.mark.parametrize( + "cli_args, expected_winetricks_args", + [ + (["--gui"], ["--gui"]), + (["--gui", "-q"], ["--gui", "-q"]), + (["--gui", "--unattended"], ["--gui", "-q"]) + ] + ) def test_run_gui( self, cli, default_proton, steam_app_factory, gui_provider, - command_mock, home_dir): + command_mock, home_dir, cli_args, expected_winetricks_args): """ Start the GUI and fake selecting a game """ @@ -753,13 +761,13 @@ def test_run_gui( # Fake the user selecting the game gui_provider.mock_stdout = "Fake game 1: 10" - cli(["--gui"]) + cli(cli_args) command = command_mock.commands[-1] # 'winetricks --gui' was run for the game selected by user assert str(command.args[0]) == \ str(home_dir / ".local" / "bin" / "winetricks") - assert command.args[1] == "--gui" + assert command.args[1:] == expected_winetricks_args # Correct environment vars were set assert command.env["WINE"] == str(