Skip to content

feat: add support for passing extra arguments to the SPICE viewer#1860

Open
lvillani wants to merge 3 commits intoquickemu-project:masterfrom
lvillani:spice-viewer-extra-args
Open

feat: add support for passing extra arguments to the SPICE viewer#1860
lvillani wants to merge 3 commits intoquickemu-project:masterfrom
lvillani:spice-viewer-extra-args

Conversation

@lvillani
Copy link
Copy Markdown
Contributor

Description

This PR adds support for passing additional arguments to the SPICE viewer. The feature was added mainly to support passing --spice-usbredir-redirect-on-connect in order to support automatic USB device redirection. For example (in a configuration file):

viewer_extra_args="--spice-usbredir-redirect-on-connect=-1,0x1234,0x5678,-1,1"

Where 0x1234 and 0x5678 are example USB VID and PID, respectively.

The string format is described at https://www.spice-space.org/usbredir.html#filter-string-format.

This PR also contains a minor style commit (removing trailing whitespace) and another commit clarifying that "viewer" actually refers to the SPICE viewer.

Type of change

  • New feature (non-breaking change which adds functionality)
  • Documentation (updates the documentation)

Checklist:

  • I have performed a self-review of my code
  • I have tested my code in common scenarios and confirmed there are no regressions
  • I have added comments to my code, particularly in hard-to-understand sections
  • I have made corresponding changes to the documentation

@lvillani lvillani changed the title Add support for passing extra arguments to the SPICE viewer feat: add support for passing extra arguments to the SPICE viewer Jan 28, 2026
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 2 files

Confidence score: 4/5

  • Mild risk: in quickemu, --viewer-extra-args values containing spaces will be split in the desktop shortcut Exec line, which can break viewer invocation with multi-word args.
  • This looks contained to shortcut generation and is a moderate usability issue rather than a core functionality break, so it seems safe to merge with awareness.
  • Pay close attention to quickemu - quote or escape Exec line args to preserve spaces.
Prompt for AI agents (all issues)

Check if these issues are valid — if so, understand the root cause of each and fix them.


<file name="quickemu">

<violation number="1" location="quickemu:2720">
P2: `--viewer-extra-args` values containing spaces will break the generated desktop shortcut because the Exec line is not quoted, so additional viewer args are split into separate CLI options. Quote/escape the value when adding it to `SHORTCUT_OPTIONS` so it stays a single argument in the desktop file.</violation>
</file>

Since this is your first cubic review, here's how it works:

  • cubic automatically reviews your code and comments on bugs and improvements
  • Teach cubic by replying to its comments. cubic learns from your replies and gets better over time
  • Ask questions if you need clarification on any suggestion

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Comment thread quickemu Outdated
@lvillani lvillani force-pushed the spice-viewer-extra-args branch from 2a39d1c to c9f50eb Compare January 29, 2026 08:56
@lvillani
Copy link
Copy Markdown
Contributor Author

I updated commit messages to follow the current style a bit more closely (namely, I added the quickemu scope).

I'm a bit unsure about the remark from cubic since the feature is implemented nearly the same was as --extra-args.

@lvillani lvillani force-pushed the spice-viewer-extra-args branch from c9f50eb to 5663769 Compare January 29, 2026 09:02
@flexiondotorg
Copy link
Copy Markdown
Member

@lvillani Thanks for contributing to the project 🙇 I've been reflecting on the growing number of arguments in quickemu. I'm planning to remove most of the advanced configuration from arguments and expose it exclusively through options in the VM configuration. This is to simplify the code a little and also focus the command execution on common use cases.

So, I won't be merging this pull request as it stands, but if you want to refactor it to be automatically enabled when appropriate or exposed only via a configuration option, I'd welcome that 👍

@lvillani
Copy link
Copy Markdown
Contributor Author

lvillani commented Feb 3, 2026

Thanks for the feedback! I completely agree with the goal of simplifying the arguments and expose this setting only in the VM configuration file instead. I'll update the PR to implement it that way in a few days.

@lvillani lvillani force-pushed the spice-viewer-extra-args branch from 5663769 to 554c0aa Compare February 8, 2026 16:22
@lvillani
Copy link
Copy Markdown
Contributor Author

lvillani commented Feb 8, 2026

I've updated the implementation so that viewer_extra_args is now exclusively read from the configuration file. I also realized I missed documenting this option in quickemu_conf.5.md earlier, so I've added that now.

I'm converting this PR to a draft while I perform more thorough testing. I'll mark it as ready for review once that's complete.

@lvillani lvillani marked this pull request as draft February 8, 2026 16:26
@lvillani lvillani force-pushed the spice-viewer-extra-args branch from 554c0aa to 5f6aff1 Compare February 12, 2026 18:17
@lvillani lvillani marked this pull request as ready for review February 12, 2026 18:28
@lvillani
Copy link
Copy Markdown
Contributor Author

I have rebased my branch against master and set the PR ready for review. I'm a bit unsure about the way I documented viewer_extra_args in quickemu_conf.5.md (I wrote an example of how I use the option to set-up automatic USB redirection even though the option is general-purpose).

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 3 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Auto-approved: Small documentation updates (clarifying SPICE viewer) and minor feature addition (viewer_extra_args config option). 28 lines across 3 files. No destructive operations, credentials, or critical path a

@lvillani lvillani force-pushed the spice-viewer-extra-args branch from 5f6aff1 to f5f9a04 Compare March 1, 2026 17:34
@lvillani lvillani force-pushed the spice-viewer-extra-args branch from f5f9a04 to 31a197c Compare March 25, 2026 09:30
@lvillani
Copy link
Copy Markdown
Contributor Author

Rebased against the master branch and fixed commit ordering. The build now appears to fail for reasons unrelated to this PR.

@lvillani
Copy link
Copy Markdown
Contributor Author

@flexiondotorg Just bumping this since it's now ready for review! The changes reflect your feedback to move this directly to the VM configuration. Let me know what you think.

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.

2 participants