This repository was archived by the owner on Apr 25, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Add screenshot support #6
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -276,6 +276,23 @@ enum Command { | |
| #[arg(long, short = 'v')] | ||
| verbose: bool, | ||
| }, | ||
| /// Capture screenshot of the current page | ||
| Screenshot { | ||
| /// Session ID | ||
| session_id: String, | ||
| /// Output file path (default: screenshot-<timestamp>.png) | ||
| #[arg(short, long)] | ||
| output: Option<String>, | ||
| /// Capture full page instead of just the viewport | ||
| #[arg(long)] | ||
| full_page: bool, | ||
| /// Image quality for JPEG (0-100, default: PNG format) | ||
| #[arg(long, value_parser = clap::value_parser!(u32).range(0..=100))] | ||
| quality: Option<u32>, | ||
|
Comment on lines
+289
to
+291
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The CLI help text documents Useful? React with 👍 / 👎. |
||
| /// Output as JSON | ||
| #[arg(long)] | ||
| json: bool, | ||
| }, | ||
| /// Manage and run plugins | ||
| Plugin { | ||
| #[command(subcommand)] | ||
|
|
@@ -465,6 +482,13 @@ async fn main() -> anyhow::Result<()> { | |
| json, | ||
| verbose, | ||
| } => cli::commands::view(session_id, target, page, fresh, json, verbose).await?, | ||
| Command::Screenshot { | ||
| ref session_id, | ||
| ref output, | ||
| full_page, | ||
| quality, | ||
| json, | ||
| } => cli::commands::screenshot(session_id, output.as_deref(), full_page, quality, json).await?, | ||
| Command::Plugin { ref cmd } => match cmd { | ||
| PluginCommand::Run { | ||
| name, | ||
|
|
||
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
handleScreenshotforce-activates the target tab (chrome.tabs.update(..., { active: true })) but never restores the previously active tab in that window. When a screenshot is taken for a background session, this permanently steals focus and changes browser state for the user, which is an unexpected side effect of a read-only command and can disrupt ongoing work in other tabs.Useful? React with 👍 / 👎.