QR code scanning via megapixels

Note that megapixels has had QR code scanning built-in for a little while now, and it works out of the box for the pinephone.

Indeed it does! It’s good to see. Though I wonder why pureos doesn’t support it at this time?

Granted the ability to save, and set custom actions for qr codes would still have value. As well as the ability to share things are qr codes.


Given that a QR code can mean just about anything, customisation by the user is essential to

  • extend for future new schemes
  • control existing schemes (since what may be acceptable to one user may be unacceptable to another user).

Per the classification from @dos, mine (main cam) is currently in the category of “basically unusable” even though previously it seemed to be in the category of “works perfectly”. Looks like software “unpredictability” and I will be waiting for driver updates. Selfie cam continues to be reliable. (It has become academic for me anyway, being in lockdown, as you don’t need a mobile phone if you can’t go “mobile”. I assume eventually we will transition back to the previous situation, where a working QR code scanner is almost a legal requirement - and I will again be keenly awaiting a working main cam.)

The Librem 5 branch/fork is based off a earlier version that didn’t support QR code scanning. I’m certain that their changes will be upstreamed eventually.

Custom actions can be done using a protocol handler, see https://askubuntu.com/questions/514125/url-protocol-handlers-in-basic-ubuntu-desktop.

1 Like

… although Megapixels as installed on the Librem 5 highlights the QR code as if it is detecting it and as if it might do something with it. Perhaps there is incomplete work-in-progress code for QR code scanning.

That could be something but in my case I wanted to make the handler for http: dependent even on the domain in question.

Also, a customer may want to disable a protocol as accessed via QR code scanning but not disable it completely.

So I think there’s still plenty of scope for user configuration.

Small progress if you wanted to take the script to the next level as far as actually sending an SMS goes. See discussion here: Librem 5 Capabilities That No Other Phone Has

So the full logic would be approximately:

  • if destination number is missing (in the QR code decode result) then prompt for it
  • if text content is missing then prompt for it
  • get confirmation from user to go ahead (essential if neither field was missing, desirable in any case)
  • kill chatty
  • create the SMS (I found that it worked without using a full international number, and nor does the number need to be in single quotes)
  • read the SMS message number (index) in the response to the create
  • request that message number to actually be sent
  • list messages in order to verify that the message was sent
  • delete the specified message sudo mmcli -m any --messaging-delete-sms=N where N is the message number
  • restart chatty

Yeah, it’s not clean but …

1 Like

Thanks Irvinewade!
At present I’ve largely abandoned that script in favor of:

As I think megapixels will support the generic use of qr codes soonish.

I hate how unclean that is, but there isn’t an alternative right now. I’ll look into adding that as an input plugin.


Is this (scanning QR codes) now solved in megapixels?

Not in what is officially released. There is a merge request in to make it happen

Will be with the next release. Millipixels (our downstream fork of Megapixels) already supported reading QR codes, the missing bit was getting that info in the system clipboard.

This patch solved that: https://source.puri.sm/Librem5/millipixels/-/merge_requests/66

And this patch second allows other types of URL like: otppath:// to be processed. Meaning that millipixels can read QR codes for 2FA applications like numberstation. https://source.puri.sm/Librem5/millipixels/-/merge_requests/67

Both patches have been merged.

So yes, it will be solved with the next release.


How is this supposed to work from the GUI of millipixel? When I today focus a QR code, a blue frame rectangel is flickering around with some text in the upper right corner, which I cant read and which is flickering as well. What should I do? The picture taken does not show the blue frame.

1 Like

ok, if you are running not the release from the repositories, but the latest from master. Then you need to press that small text you mentioned above the blueframe, for it to be selected. The blue text is the data from the QR code. And yes I will admit that the font is small.

No need to try to hunt the text, you can in fact just press anywhere inside the frame :wink:

1 Like

or that :wink:

After a click in the blue frame a window pops up with the string of the QR code and two buttons copy and cancel (see picture). If I mark copy how could I paste it for example into a terminal? The menu in the terminal does not help.

1 Like

1 Like

See above. The Paste doesn’t put the string into the terminal.

1 Like

See above.

1 Like

Is QR code scanning supposed to work in the default camera app (Millipixels) now?

I did get a blue rectangle appearing briefly in Millipixels when pointing at a QR code, but the blue thing disappeared very quickly and did not come back. How is it intended to work?

Yes, it works and has worked since the very beginning (only “copy to clipboard” functionality used to be broken, but it was fixed long ago already). Once a QR code is detected, it shows an outline. Then you can tap on it and act on its content.

If it showed up only briefly, it means that it barely managed to recognize it for a short time and that you should probably improve lightning condition, focus etc.