1. Home
  2. Linux
  3. Scan qr codes linux

How to scan QR codes from the Linux desktop

Many people use their smartphones to scan QR codes that they see in various places. But what if you need to scan a QR code and you have your Linux PC and no smartphone? Use CoBang! 

CoBang is an interesting app that allows Linux users to scan QR codes right from the webcam on their PC or upload the QR code directly to the app. In this guide, we’ll show you how to use it.

Installing CoBang on Linux

Before going over how to use the CoBang app to scan QR codes on the Linux desktop, we must demonstrate how to install the app. The reason? CoBang is not currently installed by default on any of the major Linux operating systems available.

There are three ways you can quickly get the CoBang app set up on your Linux PC. The first (and best practice) to install the app on Linux is via a Flatpak package through the Flathub app store. However, it is also possible to set up the app through an Ubuntu PPA or the Arch Linux AUR.

To start the installation of CoBang on Linux, open up a terminal window on the desktop. Once the terminal window is open, follow the command-line installation instructions outlined below that correspond with the installation method you prefer.

Flatpak 

To install the CoBang app on your Linux PC via Flatpak, you will need to have the Flatpak runtime up and running. To set up the Flatpak runtime, install the “flatpak” package the way you typically install software, and it should be ready to go.

If you are having issues setting up the Flatpak runtime on your computer, don’t worry! Follow along with our guide on how to set up Flatpak on Linux to get it set up. 

Once the Flatpak runtime is working on your computer, the next step is to add the Flathub app store to the system. To add the Flathub app store, execute the following remote-add command in a terminal window.

flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo

After adding the Flathub app store to your computer, the installation of CoBang can begin. Using the flatpak install command below, set up the app on your computer.

flatpak install flathub vn.hoabinh.quan.CoBang

Ubuntu 

Suppose you’re on Ubuntu (or distributions based upon Ubuntu like Elementary, Mint, etc.) and aren’t a fan of Flatpak. In that case, you’ll be able to install CoBang using the official PPA the developer has set up.

To start the installation via PPA, you must use the add-apt-repository command below to add the PPA as a software source to Ubuntu. 

sudo add-apt-repository ppa:ng-hong-quan/ppa

After adding the new software source to your Ubuntu system, you must refresh Ubuntu with the update command. Updating will make the new software source ready to use.

sudo apt update

Following the update command, you can execute the apt install command below to install the latest version of CoBang for Ubuntu.

sudo apt install cobang

Arch Linux

CoBang is available as an Arch Linux AUR package. So, if you’re not a fan of using Flatpak on Arch, you can get it installed this way. To start, make use of the Pacman command below and install the “Git” and “Base-devel” packages on your computer.

sudo pacman -S git base-devel

After installing the two packages, use the commands below to install the Trizen AUR helper app. This program will make it very easy to build the CoBang application from the source code with little effort.

git clone https://aur.archlinux.org/trizen.git 

cd trizen 

makepkg -sri

Finally, install the CoBang app on your Arch Linux PC using the trizen -S command.

trizen -S cobang

Scan QR codes on Linux desktop

To scan a QR code from the Linux desktop using CoBang, open up the CoBang app by searching for it in the app menu. Once the app is open, follow the step-by-step instructions below.

Webcam

Step 1: Connect your webcam to your Linux PC. Once the webcam is connected, click on CoBang to access the app. It should automatically detect your camera. If it doesn’t, relaunch the app.

Step 2: Aim the QR code at the camera to easily be visible in the CoBang viewfinder app. It should then detect the QR code and display the result in the “Result” area.

File

Step 1: Open up CoBang, and click on the photo icon next to the camera button on the top-left. After selecting this button, the CoBang will load into image mode.

Once in image mode, click on the “(None)” button. This button will allow you to browse for a QR image file. Select the QR image file to load it into CoBang.

Step 2: When you’ve loaded a QR image into CoBang, it will detect its contents and print it in the “Results” area. 

7 Comments

  1. Claims to allow URLs to remote images, but I can find nowhere to enter a URL.

    Claims to support “copy/pasting” a picture, but attempting to right-click to copy fails to open the context menu (windows-esqe control-V doesn’t work either.)

  2. (appstreamcli:1865): GLib-CRITICAL **: 13:39:02.066: g_variant_builder_end: assertion ‘!GVSB(builder)->uniform_item_types || GVSB(builder)->prev_item_type != NULL || g_variant_type_is_definite (GVSB(builder)->type)’ failed

    (appstreamcli:1865): GLib-CRITICAL **: 13:39:02.067: g_variant_new_variant: assertion ‘value != NULL’ failed

    (appstreamcli:1865): GLib-ERROR **: 13:39:02.067: g_variant_new_parsed: 11-13:invalid GVariant format string
    Trace/breakpoint trap (core dumped)
    Načítají se seznamy balíků… Hotovo
    E: Problem executing scripts APT::Update::Post-Invoke-Success ‘if /usr/bin/test -w /var/cache/app-info -a -e /usr/bin/appstreamcli; then appstreamcli refresh-cache > /dev/null; fi’
    E: Sub-process returned an error code

  3. Of note, this is not ported to all architectures. If you have a pinebook or pinebook pro (AARCH64) you may have to port the hard way.