Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 12 additions & 1 deletion src/protontricks/cli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down
14 changes: 11 additions & 3 deletions tests/cli/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
"""
Expand All @@ -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(
Expand Down