Skip to content

fix(frontend): honor -e/--executable and -b/--bottle CLI options in GUI#4521

Open
goingforstudying-ctrl wants to merge 1 commit into
bottlesdevs:mainfrom
goingforstudying-ctrl:fix/cli-options-parsing-gui
Open

fix(frontend): honor -e/--executable and -b/--bottle CLI options in GUI#4521
goingforstudying-ctrl wants to merge 1 commit into
bottlesdevs:mainfrom
goingforstudying-ctrl:fix/cli-options-parsing-gui

Conversation

@goingforstudying-ctrl
Copy link
Copy Markdown

Description

The GUI frontend (bottles/frontend/main.py) registers --executable (-e), --bottle (-b), and --arguments (-a) as command-line options, but do_command_line() never acts on them. When users launch the main Bottles app with these flags (e.g., flatpak run com.usebottles.bottles -e /path/to/game.exe -b my-bottle), the options are parsed and then silently discarded—the main window opens instead of launching the requested executable.

This is a regression in user expectations because bottles-cli handles these same options correctly.

Root Cause

  1. arg_args was not declared, and the "arguments" option was never read from commands.
  2. After parsing -e and -b, the code fell through to self.do_activate(), which creates BottlesWindow. BottlesWindow only accepts arg_bottle; it has no parameter for arg_exe, so the executable path is lost.

Changes

  • Added arg_args = None class variable.
  • Parse "arguments" in do_command_line().
  • When arg_exe is set and arg_bottle is set, launch the executable via bottles-cli run -b <bottle> -e <exe> [-a <args>] and return early.
  • When arg_exe is set without arg_bottle, show BottlePickerDialog (the same behavior already used for URI handling) and return early.
  • This prevents the main window from opening when the user explicitly requested a CLI-style launch.

Verification Steps

  1. flatpak run com.usebottles.bottles -e /path/to/executable.exe
    • Expected: BottlePickerDialog opens to choose a bottle.
  2. flatpak run com.usebottles.bottles -b my-bottle -e /path/to/executable.exe
    • Expected: Executable launches directly without opening the main window.
  3. flatpak run com.usebottles.bottles -b my-bottle -e /path/to/executable.exe -a "--some-arg"
    • Expected: Executable launches with the provided arguments.

Related Issue

Fixes #3606

@goingforstudying-ctrl goingforstudying-ctrl force-pushed the fix/cli-options-parsing-gui branch from 564484f to 273d4f5 Compare May 29, 2026 22:03
@goingforstudying-ctrl
Copy link
Copy Markdown
Author

rebased on latest main

The GUI frontend was registering --executable, --bottle, and --arguments
options but never acting on them. When users passed -e or -b to the main
app binary, the options were silently ignored and the main window opened
instead of launching the requested executable.

This fix:
1. Parses the --arguments option (was registered but never read)
2. When --executable is provided with --bottle, launches via bottles-cli
3. When --executable is provided without --bottle, shows BottlePickerDialog
4. Returns early so the main window is not opened when launching an exe

Fixes bottlesdevs#3606
@goingforstudying-ctrl goingforstudying-ctrl force-pushed the fix/cli-options-parsing-gui branch from 273d4f5 to 421a4aa Compare May 31, 2026 22:10
@goingforstudying-ctrl
Copy link
Copy Markdown
Author

rebased on latest main

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Command-line options parsing is broken on the GUI frontend

1 participant