Skip to content

Add QR code capture - #6679

Merged
dhh merged 3 commits into
omacom:devfrom
Wondertan:qr-code-capture
Aug 11, 2026
Merged

dhh merged 3 commits into
omacom:devfrom
Wondertan:qr-code-capture

Conversation

@Wondertan

@Wondertan Wondertan commented Aug 10, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • add omarchy capture qr to decode a selected screen region
  • copy the decoded value to the clipboard and show it in a notification
  • add QR Code to the Capture menu
  • install zbar for fresh and existing systems

Motivation

QR codes often appear on the same computer where their contents are needed—for example, when importing an OTP/2FA setup code shown by a web app. Reading one currently means reaching for a phone or taking a screenshot and manually passing it through a decoder. This feature turns that whole detour into one Capture menu action: select the QR code, then its decoded value is immediately displayed and copied to the clipboard.

Testing

  • bash test/omarchy-cli-test.sh
  • generated a QR code with qrencode and decoded it through the new command using the real zbarimg
  • manually tested the Capture → QR Code menu flow

Copilot AI balanced review requested due to automatic review settings August 10, 2026 15:13

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds screen-region QR decoding with clipboard and notification integration.

Changes:

  • Adds omarchy capture qr.
  • Adds QR capture to the Capture menu.
  • Installs zbar for new and existing systems.

Tip

If you aren't ready for review, convert to a draft PR.
Click "Convert to draft" or run gh pr ready --undo.
Click "Ready for review" or run gh pr ready to reengage.

Reviewed changes

Copilot reviewed 2 out of 4 changed files in this pull request and generated no comments.

File Description
bin/omarchy-capture-qr Implements region decoding and result handling.
bin/omarchy-menu Adds the QR capture menu option.
install/omarchy-base.packages Adds zbar to fresh installations.
migrations/1784508420.sh Installs zbar on existing systems.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

dhh and others added 2 commits August 11, 2026 04:17
Freeze the screen before selecting like the other region captures do,
restrict decoding to QR so stray barcodes can't take the clipboard, and
stop echoing the decoded value to stdout and the notification, since an
otpauth:// secret would otherwise land in the journal and notification
history.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Clipboard history records every selection, so the otpauth:// secret this
command is built to capture would survive in it. --sensitive offers the
x-kde-passwordManagerHint type that the clipboard capture skips on.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Copilot AI review requested due to automatic review settings August 11, 2026 11:32

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 4 changed files in this pull request and generated no new comments.

@dhh

dhh commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Nice feature — the Capture menu is the right home for this, and the metadata, migration, and package addition all follow the existing conventions. I've pushed two commits to the branch rather than leaving a review to round-trip on. Here's the reasoning for each.

Keep the decoded value on the clipboard only

The motivation in the description is the strongest argument for this: an OTP setup code means the typical payload is otpauth://totp/...?secret=.... The original flow put that value in three places that outlive the copy:

  • printf '%s\n' "$RESULT" — when the command runs from the menu under uwsm, stdout is the session journal, so the secret gets written to disk.
  • "Result: $RESULT" in the notification — rendered on screen and kept in notification history. (It also passes through printf '%b' inside omarchy-notification-send, so a payload containing backslashes renders mangled.)
  • a plain wl-copy — clipboard history records every selection, so the secret survives there too.

So the value now goes to the clipboard and nowhere else, and the copy is marked wl-copy --sensitive. That offers the x-kde-passwordManagerHint type, which the clipboard capture already gates on, so the entry is skipped by history. Pasting is unaffected; only the recorded copy is given up. This also drops the unbounded notification body — a QR can carry a few thousand characters.

This follows omarchy-capture-text-extraction, which likewise reports only "Copied text from selection to clipboard".

Decode QR codes only

zbarimg has every symbology enabled by default, so it isn't really a QR reader. A Code 128 barcode on screen decodes and takes the clipboard:

$ zint -b 20 -d "NOT-A-QR-CODE" -o code128.png
$ zbarimg -q --raw - < code128.png                          # as written
NOT-A-QR-CODE
$ zbarimg -q --raw -Sdisable -Sqrcode.enable - < code128.png # restricted
(no output, exit 4)

EAN/UPC in particular can false-positive on dense screen content. -Sdisable -Sqrcode.enable makes the behaviour match what the command and the menu entry claim to do, and makes the "No QR code found" message accurate.

Freeze the screen before selecting

Both sibling region captures start hyprpicker -r -z with an EXIT trap so grim photographs a frozen frame. Without it, content can shift between the selection and the capture. Added for consistency.

Smaller things folded in

The empty-result case exited 1 silently with no feedback; it now shares the "No QR code found" notification, which also covers the rare grim failure — in every one of those cases the user's next move is the same, so one message serves them all.

One note on zbarimg -: it works because a bare - is passed through as a filename to ImageMagick, which reads stdin. Worth knowing it depends on the ImageMagick backend rather than on stdin support in zbar itself, but zbar depends on imagemagick and it's already in the base package list, so the extra footprint here is only ~250 KiB.

— 🤖 Claude, posting on behalf of @dhh

@dhh
dhh merged commit 1777085 into omacom:dev Aug 11, 2026
dhh added a commit that referenced this pull request Aug 11, 2026
@dhh dhh mentioned this pull request Aug 11, 2026
nixfred pushed a commit to nixfred/omarchy that referenced this pull request Aug 23, 2026
* Add QR code capture

* Keep the decoded QR value on the clipboard only

Freeze the screen before selecting like the other region captures do,
restrict decoding to QR so stray barcodes can't take the clipboard, and
stop echoing the decoded value to stdout and the notification, since an
otpauth:// secret would otherwise land in the journal and notification
history.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* Mark the copied QR value as sensitive

Clipboard history records every selection, so the otpauth:// secret this
command is built to capture would survive in it. --sensitive offers the
x-kde-passwordManagerHint type that the clipboard capture skips on.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

---------

Co-authored-by: David Heinemeier Hansson <[email protected]>
Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
nixfred pushed a commit to nixfred/omarchy that referenced this pull request Aug 23, 2026
silesai pushed a commit to silesai/omarchy that referenced this pull request Sep 8, 2026
* Add QR code capture

* Keep the decoded QR value on the clipboard only

Freeze the screen before selecting like the other region captures do,
restrict decoding to QR so stray barcodes can't take the clipboard, and
stop echoing the decoded value to stdout and the notification, since an
otpauth:// secret would otherwise land in the journal and notification
history.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* Mark the copied QR value as sensitive

Clipboard history records every selection, so the otpauth:// secret this
command is built to capture would survive in it. --sensitive offers the
x-kde-passwordManagerHint type that the clipboard capture skips on.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

---------

Co-authored-by: David Heinemeier Hansson <[email protected]>
Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
# Conflicts:
#	install/omarchy-base.packages
silesai pushed a commit to silesai/omarchy that referenced this pull request Sep 8, 2026
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.

3 participants