zulip-terminal
zulip-terminal copied to clipboard
feature: Capture screenshots in ZT
This PR adds a feature to capture the screen of ZT using the hotkey meta c
.
The screenshots are saved locally in screenshots/
(format: png
)
This PR could also potentially be an initial step in automating screenshots update in docs :)
@zulipbot add "PR needs review"
Heads up @Ezio-Sarthak, we just merged some commits that conflict with the changes you made in this pull request! You can review this repository's recent commits to see where the conflicts occur. Please rebase your feature branch against the upstream/main
branch and resolve your pull request's merge conflicts accordingly.
Some other notes following the prototype by @Ezio-Sarthak.
This needs rebasing to avoid the conflicts, which should allow testing, but please consider the feedback above and in this comment on how to structure this.
Note that this was discussed at #zulip-terminal>Updating screenshot
For a first version, this would be great as a dev tool:
- we may not need more than pillow to achieve screenshots now?
- pillow can be added to the appropriate 'dev' extra list
- code would check for the presence of pillow on startup, and do nothing if absent
- we have
platform_code
, which seems like a good place for this - we very likely want to save screenshots to a temporary directory (but keep them around), to avoid naming/security conflicts
- keep the key out of the help (in-app and markdown file) for now
- add some notes to the dev section to document the shortcut key exists :)
- as a follow-up, the PR template can be updated to note about this tool for the visual changes section :)
For a followup v2 later (separate PR), more for use by users, with more polish:
- it'd be preferable to keep install size minimal, so add something like a
screenshot
install extra, with additional installation dependencies for that (which could be included indev
too) - this can likely still fail on non-GUI terminal platforms, which needs handling
- we need to consider further where to save the files, and maybe to make this configurable later
- now include the key in the help popup, but this could be dynamic to avoid confusion, or show an error message when attempted, if the key is not present (possibly with a custom message in the markdown?)
id like to take this up