How to capture a screenshot of the SDDM greeter screen

In my previous post I explained how to capture a screenshot of the LightDM greeter screen. The procedure is essentially the same for the SDDM greeter screen; only the Bash script differs slightly. The procedure is given below.

  1. If they are not already installed, install the packages x11-apps/xwd and media-gfx/imagemagick.

  2. Create the Bash script ~/sddm-greeter-capture.sh containing the following:
    TMPXAUTHORITY=$(ls /var/run/sddm/*)
    sleep 30
    DISPLAY=:0 XAUTHORITY=/var/run/sddm/$TMPXAUTHORITY xwd -root > /tmp/greeter.xwd
    convert /tmp/greeter.xwd /home/fitzcarraldo/greeter.png
    

    Make sure you make it executable:

    user $ chmod +x sddm-greeter-capture.sh

  3. Log out of the Desktop Environment so that the SDDM greeter screen is displayed.

  4. Press Ctrl+Alt+F2 to switch to VT2.

  5. Log in to you user account and enter the following command (do not wait for it to complete):

    user $ sudo /home/fitzcarraldo/sddm-greeter-capture.sh

  6. As soon as you have pressed Enter for the above command, press Ctrl+Alt+F7 to switch back to VT7.

  7. Wait for at least 30 seconds to be sure the Bash script has made a snapshot of the SDDM greeter screen, then log in.

  8. You should now find the file ~/greeter.png containing a snapshot of your SDDM greeter screen.

If you install media-libs/netpbm instead of (or as well as) media-gfx/imagemagick then you can use a different command to convert in the Bash script:

TMPXAUTHORITY=$(ls /var/run/sddm/*)
sleep 30
#DISPLAY=:0 XAUTHORITY=/var/run/sddm/$TMPXAUTHORITY xwd -root | xwdtopnm | pnmtopng > /home/fitzcarraldo/greeter.png

The resulting PNG image looks equally good to my eyes.

How to capture a screenshot of the LightDM greeter screen

  1. If they are not already installed, install the packages x11-apps/xwd and media-gfx/imagemagick.

  2. Create the Bash script ~/ligthdm-greeter-capture.sh containing the following:
    #!/bin/bash
    sleep 30
    DISPLAY=:0 XAUTHORITY=/var/run/lightdm/root/$DISPLAY xwd -root > /tmp/greeter.xwd
    convert /tmp/greeter.xwd /home/fitzcarraldo/greeter.png
    

    Make sure you make it executable:

    user $ chmod +x lightdm-greeter-capture.sh

  3. Log out of the Desktop Environment so that the LightDM greeter screen is displayed.

  4. Press Ctrl+Alt+F2 to switch to VT2.

  5. Log in to you user account and enter the following command (do not wait for it to complete):

    user $ sudo /home/fitzcarraldo/lightdm-greeter-capture.sh

  6. As soon as you have pressed Enter for the above command, press Ctrl+Alt+F7 to switch back to VT7.

  7. Wait for at least 30 seconds to be sure the Bash script has made a snapshot of the LightDM greeter screen, then log in.

  8. You should now find the file ~/greeter.png containing a snapshot of your LightDM greeter screen.

If you install media-libs/netpbm instead of (or as well as) media-gfx/imagemagick then you can use a different command to convert in the Bash script:

#!/bin/bash
sleep 30
DISPLAY=:0 XAUTHORITY=/var/run/lightdm/root/$DISPLAY xwd -root | xwdtopnm | pnmtopng > /home/fitzcarraldo/greeter.png

The resulting PNG image looks equally good to my eyes.

A long overdue update to Google Earth for Linux

Google has finally released Version 7.1.7.2600 of Google Earth for Linux, fixing various crashes and the infamous empty Panoramio window. The last version of Google Earth for Linux that worked properly ‘out of the box’ in Gentoo Linux for me was 5.2.1.1588, and that was several years ago.

The current version of Google Earth in the Portage main tree is 7.1.4.1529. That version does not display Panoramio photos in Gentoo Linux (Stable Branch) on my Clevo W230SS laptop (NVIDIA Optimus), and Version 7.1.4.1529 crashes at launch more often than not. So I was keen to try the new version. Below are the steps I followed to install Version 7.1.7.2600 in the Portage local overlay on the laptop. If you don’t already have a local overlay, see the Gentoo Wiki article Overlay/Local overlay. Don’t forget to copy the files directory and its contents from /usr/portage/sci-geosciences/googleearth/ to /usr/local/portage/sci-geosciences/googleearth/ as well.

1. Download the file google-earth-stable_current_amd64.deb from the Google Earth Web site (Download the latest version of Google Earth for PC, Mac or Linux).

2. Edit the file /etc/portage/package.use/googleearth and add the line:

=sci-geosciences/googleearth-7.1.7.2600 -bundled-libs

3. Edit the file /etc/portage/package.unmask/googleearth and add the line:

=sci-geosciences/googleearth-7.1.7.2600

4. Edit the file /etc/portage/package.accept_keywords/googleearth and add the line:

=sci-geosciences/googleearth-7.1.7.2600 ~amd64

5. Copy the downloaded binary package to the distfiles directory and rename the package:

root # cp /home/fitzcarraldo/Downloads/google-earth-stable_current_amd64.deb /usr/portage/distfiles/GoogleEarthLinux-7.1.7.2600_amd64.deb

6. Create an ebuild for the new version and generate a manifest:

root # cd /usr/local/portage/sci-geosciences/googleearth/
root # cp /usr/portage/sci-geosciences/googleearth/googleearth-7.1.4.1529.ebuild googleearth-7.1.7.2600.ebuild
root # ebuild googleearth-7.1.7.2600.ebuild manifest

7. Install Google Earth 7.1.7.2600:

root # emerge =googleearth-7.1.7.2600

The package was installed without any trouble:

root # eix -I googleearth
[I] sci-geosciences/googleearth
     Available versions:  {M}(~)7.1.4.1529^m {M}(~)7.1.7.2600^m[1] {+bundled-libs}
     Installed versions:  7.1.7.2600^m[1](00:02:27 02/10/16)(-bundled-libs)
     Homepage:            https://earth.google.com/
     Description:         A 3D interface to the planet

[1] "local_overlay" /usr/local/portage

Google Earth for Linux 7.1.7.2600 launches quickly and without trouble on this laptop, and Panoramio photos are indeed now visible again (finally!). The only issue is one I also came across over a year ago after hacking an earlier version of Google Earth for Linux: If you click on a photo icon and the Panoramio window that opens displays several thumbnails, clicking on a thumbnail results in a white Panoramio window without any photo and thumbnails. Apparently this only happens in KDE. Anyway, the work-around is to right-click on the desired thumbnail and select ‘Open in New Window’.

Completing PDF forms and adding your signature without having to print the form

A recent post in the Gentoo Forums made me interested to find out what is actually achievable with fillable PDF forms in Gentoo Linux and Windows 10 without being required to purchase a software licence, be it for personal or professional use, in order to be able to complete PDF forms (including forms that have automatically-updating bar codes).

Designing PDF Forms

It is possible to create PDF forms with LibreOffice, although LibreOffice cannot create a form containing bar codes that get updated automatically with the information entered in fields on the form. In order to create PDF forms that contain automatically-updating bar codes it is necessary to purchase Adobe Acrobat DC or Adobe LiveCycle Designer, which are Windows-only applications. As forms usually have several fields, 2D bar code symbologies are used in order to be able to encode the amount of data in a practical way. See the Adobe demonstration video Capture electronic data from printed forms.

Using PDF Forms

However, the enquiry in the above-mentioned forum thread was not about designing PDF forms, it was about being able to complete existing PDF forms (including forms that have automatically-updating bar codes, and including being able to add a written signature to the form without printing it out):

Hi,

I need to sign pdfs, and sometimes fill out pdf forms which also need to be signed. At the moment I get them, print them, sign them and scan them back in to return to the sender. I’d like to simplify that.

I know that on Windows and Mac OS your adobe software can sign the pdf, but I don’t even know how that works exactly.

It would be really neat if there were an app which could handle all that.

Oh yeah, another thing. Some forms (all?) when you fill them out and print them have a bar of machine-readable gobbledygook on the page which lets the recipient of a printed pdf scan the data back in with 100% accuracy. That would be neat too.

Thanks.

Although I have sometimes added my signature to a PDF form before printing it out — more on that later — I had never come across PDF forms with automatically-updating bar codes, so my curiosity was piqued. I decided to investigate if free applications could be used to complete PDF forms (including those with automatically-updating bar codes) and add a written signature. My investigations were carried out in Linux and Windows 10, and my findings are given below. In summary, I discovered that I could do all these things in Linux as well as in Windows 10, although in Linux I had to resort to running a Windows application under WINE if a PDF form contained automatically-updating bar codes. I did not bother trying the GNOME document viewer Evince, as I could find no evidence on the Web of it having the capability of updating bar codes automatically, and I use KDE.

For my tests I used the following four PDF forms I found on the Web:

  1. acrobat8_barcodedforms.pdf, an October 2006 PDF article from Adobe containing three sample form fields and an associated automatically-updating bar code (PDF417 symbology).
  2. barcode_field.pdf, a February 2013 sample PDF form with three fields and three associated bar codes of different symbologies (PDF417, Data Matrix and QR Code).
  3. PdfFormExample.pdf, a June 2013 sample PDF form created using LibreOffice (and therefore not containing automatically-updating bar codes).
  4. sample_barcoded_demo.pdf, a December 2005 sample PDF form from Adobe with an automatically-updating bar code (PDF417 symbology).

1. Windows 10

1.1 Acrobat Reader DC

This is the ubiquitous ‘free’ closed-source application you can download from Adobe.

Below are screenshots of the four sample PDF forms opened in Acrobat Reader DC…

1.1.1 I could enter text in the three fields in acrobat8_barcodedforms.pdf, and the bar code was updated accordingly:

Acrobat Reader DC - acrobat8_barcodedforms.pdf

Acrobat Reader DC - acrobat8_barcodedforms.pdf

I used my smartphone’s Barcode Scanner app to read the bar code on the hard-copy form printed by Acrobat Reader DC:

Text1Text2Text3I am able to change the text in these fields of this form to see how 2D barcodes work.

1.1.2 I could enter text in the three fields in barcode_field.pdf, but the three bar codes were not visible:

Acrobat Reader DC - acrobat8_barcodedforms.pdf

Acrobat Reader DC - barcode_field.pdf

1.1.3 I could enter text in the fields in PdfFormExample.pdf:

Acrobat Reader DC - PdfFormExample.pdf

Acrobat Reader DC - PdfFormExample.pdf

1.1.4 I could enter text in all fields of sample_barcoded_demo.pdf and the field contents were echoed in the box ‘Barcode Contents’ but the bar code itself was not visible:

Acrobat Reader DC - sample_barcoded_demo.pdf

Acrobat Reader DC - sample_barcoded_demo.pdf

So, in summary, Acrobat Reader DC is not a viable option if you have to deal with forms that include automatically-updating bar codes.

1.2 PDF-XChange Editor

This application from Canadian company Tracker Software Products supersedes their deprecated PDF-XChange Viewer and has additional features. Neither application is open-source, though. Some features only work fully if you purchase a software licence and enter the licence key. For example, if you add a signature to a PDF form (‘Document’ > ‘Signatures and Initials’) and then save it, DEMO stamps are added to the new PDF file (which still has editable fields). However, if you print the PDF form (either to a PDF file or to paper) then DEMO stamps are not added (but the new PDF file is not fillable/editable). Click on the two links below to view the sample PDF file PdfFormExample.pdf signed and saved to a new PDF file, and the sample PDF file PdfFormExample.pdf signed and printed to a new PDF file:

PdfFormExample_with_signature_added_then_Saved.pdf

PdfFormExample_with_signature_added_then_Printed_to_PDF.pdf

If you save them to disk and open them in PDF-XChange Editor, you will see the distinction.

As stated on the company’s Web site, the free application can be used for private and work purposes:

The FREE download of the PDF-XChange Editor may be used without limitation for Private, Commercial, Government and all uses, provided it is not: incorporated or distributed for profit/commercial gain with other software or media distribution of any type – without first gaining permission.

Below are screenshots of the four sample PDF forms opened in PDF-XChange Editor…

1.2.1 I could enter text in the three fields in acrobat8_barcodedforms.pdf, and the bar code was updated accordingly:

PDF-XChange Editor - acrobat8_barcodedforms.pdf

PDF-XChange Editor - acrobat8_barcodedforms.pdf

I used my smartphone’s Barcode Scanner app to read the bar code on the hard-copy form printed by PDF-XChange Editor:

Text1Text2Text3
I am able to change the text in these fields of this formto see how 2D barcodes work.

Notice that the layout of the encoded text is slightly different to the bar code generated by Adobe Acrobat Reader DC.

1.2.2 I could enter text in the three fields in barcode_field.pdf, and the three bar codes were visible:

PDF-XChange Editor - barcode_field.pdf

PDF-XChange Editor - barcode_field.pdf

I used my smartphone’s Barcode Scanner app to read the three bar codes on the hard-copy form printed by PDF-XChange Editor:

The PDF417 bar code was read as follows:

text_0:PDF417 barcode:I can enter text in these fields of this form and can see the three barcodes to the right of these fields in PDF-XChange Editor.

The Data Matrix bar code was read as follows:

text_1:Data Matrix barcode:
To change the barcode field to the right, type in this box. The barcode field to the right will reflect the contents of the text field as barcode after the text field lost the focus. To reset the contents of all barcode fields, cick the ‘Rset’ button.

Notice that the words ‘click’ and ‘Reset’ in the field were apparently not encoded correctly.

The QR Code bar code was read as a meaningless apparently random bunch of characters.

The PDF file and the three bar codes were generated on the fly by PHP code calling the pdflib library produced by the company PDFlib GmbH. I do not know how accurate this particular PDF file is, or how accurate is the Bar Code Scanner app on my smartphone.

1.2.3 I could enter text in the fields in PdfFormExample.pdf:

PDF-XChange Editor - PdfFormExample.pdf

PDF-XChange Editor - PdfFormExample.pdf

1.2.4 I could enter text in all fields of sample_barcoded_demo.pdf, and the field contents were echoed in the box ‘Barcode Contents’ and the bar code itself was visible:

PDF-XChange Editor - sample_barcoded_demo.pdf

PDF-XChange Editor - sample_barcoded_demo.pdf

I used my smartphone’s Barcode Scanner app to read the PDF417 bar code on the hard-copy form printed by PDF-XChange Editor:

Brian
S
Fitzgerald
Calle Fitzcarrald, 225
Iquitos

bsf@iquitos.nom.pe

So, in summary, PDF-XChange Editor appears to be a possible option in Windows 10, whether or not you have to deal with forms that include automatically-updating bar codes. I am quite impressed with the application.

2. Linux

2.1 Acrobat Reader 9

This is the free closed-source Linux application you can install via the Portage package manager (the package is app-text/acroread).

Below are screenshots of the four sample PDF forms opened in Acrobat Reader 9 for Linux.

2.1.1 I could enter text in the three fields in acrobat8_barcodedforms.pdf, and the bar code was updated accordingly:

Acrobat Reader 9 Linux - acrobat8_barcodedforms.pdf

Acrobat Reader 9 Linux - acrobat8_barcodedforms.pdf

I used my smartphone’s Barcode Scanner app to read the bar code on the hard-copy form printed by Acrobat Reader 9 for Linux:

Text1Text2Text3I am able to change the text in these fields of this form to see how 2D barcodes work.

2.1.2 I could enter text in the three fields in barcode_field.pdf, but the three bar codes were not visible:

Acrobat Reader 9 Linux - barcode_field.pdf

Acrobat Reader 9 Linux - barcode_field.pdf

2.1.3 I could enter text in the fields in PdfFormExample.pdf:

Acrobat Reader 9 Linux - PdfFormExample.pdf

Acrobat Reader 9 Linux - PdfFormExample.pdf

2.1.4 I could enter text in all fields of sample_barcoded_demo.pdf, and the field contents were echoed in the box ‘Barcode Contents’ but the bar code itself was not visible:

Acrobat Reader 9 Linux - sample_barcoded_demo.pdf

Acrobat Reader 9 Linux - sample_barcoded_demo.pdf

So, in summary, Acrobat Reader 9 for Linux is not a viable option if you have to deal with forms that include automatically-updating bar codes.

2.2 Okular

This is the well-known KDE document viewer application.

Below are screenshots of the four sample PDF forms opened in Okular.

2.2.1 I could enter text in the three fields in acrobat8_barcodedforms.pdf but the bar code was not visible:

Okular - acrobat8_barcodedforms.pdf

Okular - acrobat8_barcodedforms.pdf

2.2.2 I could enter text in the three fields in barcode_field.pdf but the three bar codes were not visible:

Okular - barcode_field.pdf

Okular - barcode_field.pdf

2.2.3 I could enter text in the fields in PdfFormExample.pdf:

Okular - PdfFormExample.pdf

Okular - PdfFormExample.pdf

2.2.4 I could enter text in all fields of sample_barcoded_demo.pdf but the field contents were not echoed in the box ‘Barcode Contents’ and the bar code itself was not visible:

Okular - sample_barcoded_demo.pdf

Okular - sample_barcoded_demo.pdf

So, in summary, Okular is not a viable option if you have to deal with forms that include automatically-updating bar codes. In fact, Okular was the worst of the bunch.

2.3 PDF-XChange Editor

To install this Windows application under WINE in Linux:

$ export WINEPREFIX=$HOME/.wine-pdfxve6
$ export WINEARCH="win32"
$ winecfg # Select Windows 10.
$ cd .wine-pdfxve6/drive_c/
$ # Copy downloaded installer to C: drive:
$ cp ~/Downloads/PDFXVE6.zip .
$ unzip PDFXVE6.zip
$ # Install PDF-XChange Editor:
$ wine PDFXVE6.exe

  • Click ‘Install’.
  • Click ‘Next’.
  • Select ‘I accept the terms in the License Agreement’ and click ‘Next’.
  • Click ‘Custom’.
  • Click ‘Browsers Plugins’ and select ‘Don’t install’. Click ‘Next’.
  • Leave ‘Create a Start Menu folder’ ticked. Untick ‘Create Desktop Icons.’ Untick ‘Set PDF-XChange Editor as default application for PDF files’. Untick ‘Set Printer “PDF-XChange Lite V6” As Default’. Click ‘Next’.
  • Select ‘Free Version’ and click ‘Next’.
  • Click ‘Install’.
  • Untick ‘Launch PDF-XChange Editor’ and click ‘Finish’.
  • Click ‘Close’.

KDE Plasma 5 then has an entry for PDF-XChange Editor in the Application Launcher under ‘Applications’ > ‘Wine’ > ‘Programs’ > ‘Tracker Software’. Alternatively, to launch PDF-XChange Editor from the command line, you should enter:

$ WINEPREFIX="$HOME/.wine-pdfxve6" && WINEARCH="win32" && wine $WINEPREFIX/drive_c/Program\ Files/Tracker\ Software/PDF\ Editor/PDFXEdit.exe

If you also want the Windows application running under WINE to be able to access PDF files on a NAS, i.e. to be able to open Samba shares, see my previous post How to enable a Windows application in WINE to access a Samba share on a NAS.

I will not bother showing screenshots of the four sample PDF files open in PDF-XChange Editor running under WINE in Linux, as the application’s behaviour is the same as in Windows (see the screenshots in sections 1.2.1 to 1.2.4 above). So, in summary, PDF-XChange Editor appears to be a viable option in Linux (albeit running under WINE), irrespective of whether or not you have to deal with forms that include automatically-updating bar codes.

3. Adding a signature to a soft copy of the PDF form

I am referring to a person’s written signature here, not to a digital signature. Rather than having to print the completed form on paper in order to sign it with a pen, then scan the fully-completed form in order to send it via e-mail, fax or whatever, many people wish to add their signature directly to the PDF form without having to print it. Below I explain the method I use to do this in both Linux and Windows.

3.1 Create a PNG file with your signature (one-time operation)

  1. Get a blank white piece of paper.
  2. Sign your name on the page.
  3. Scan the page with your scanner and save the image as a PNG file.
  4. Open the image with GIMP.
  5. Crop the image around the signature.
  6. Select ‘Layer’ > ‘Transparency’ > ‘Add Alpha Channel’.
  7. Select the Fuzzy Select Tool from the toolbox.
  8. Click on each white area and press the Delete key. Do this for the area around the signature and inside any loops. Obviously don’t click on the signature itself.
  9. Select ‘File’ > ‘Export’.
  10. Save the image as a PNG file.

3.2 Signing PDF documents

  1. Launch LibreOffice Draw and open the PDF file you wish to sign.
  2. Select ‘Insert’ > ‘Image…’ and select the PNG file of your signature. The image will be inserted.
  3. To move the signature around on the page, hover the mouse cursor over the image until the cursor changes to a red dot with four arrowheads, then click-and-hold to grab the image drag it.
  4. To reduce the size of the signature, hover the mouse cursor over the image until the cursor changes to a red dot with four arrowheads, then click and release. You will then see small blue ‘handles’ on the outline of the image. Hover the mouse cursor over a handle at one of the four corners of the image until the cursor changes to a Resize cursor. Click-and-hold and move the cursor to increase or decrease the size of the signature whilst maintaining the ratio of width to height.
  5. To save the completed and signed PDF form, select ‘File’ > ‘Export as PDF…’, click on ‘Export’ and give the file a name of your choice.

The new PDF file will contain all the information visible on the previous PDF file plus your written signature. However, unlike the original PDF file, you will not be able to modify any of the data. Therefore I recommend you retain a copy of the original PDF file before you added the signature, in case you wish to change any of field entries in future.

Note that the free PDF-XChange Editor can be used instead of LibreOffice Draw providing the PDF form is not secured or restricted, and providing you print it to a new PDF file using a virtual PDF printer driver. If the PDF form is secured or changes restricted, then use LibreOffice Draw as described above.

If you are using a PDF viewer that refuses to save your completed form as a PDF file after you have entered data in the fields (notice the message in the purple bar in the screenshots of Acrobat Reader 9 for Linux, for example), print the page to a PDF file instead by using the virtual PDF printer (‘Microsoft Print to PDF’ in Windows; CUPS ‘Virtual PDF Printer’ in Linux) at a resolution of e.g. 600 dpi (if possible). You should then be able to open that PDF file in LibreOffice Draw or PDF-XChange Editor to add your signature as explained above and print the signed form to a new PDF file.

Fixing all-white log-in screen when using the LightDM KDE greeter with Plasma 5 in Gentoo Linux

In a previous post I explained how I got LightDM to work on my Clevo W230SS laptop running KDE Plasma 5 in Gentoo Linux (Stable Branch). However, following a world update a few weeks later, the LightDM log-in screen (‘greeter’) became all white. Searching the Web showed me that this is a common problem with LightDM, although the cause appeared to be different in many other cases, as I could still see the password-entry box and the button to select the session.

To summarise what was already installed:

fitzcarraldo@clevow230ss ~ $ uname -a
Linux clevow230ss 3.18.11-gentoo #47 SMP Thu May 26 11:03:29 BST 2016 x86_64 Intel(R) Core(TM) i7-4810MQ CPU @ 2.80GHz GenuineIntel GNU/Linux
fitzcarraldo@clevow230ss ~ $ eix -I plasma-meta
[I] kde-plasma/plasma-meta
     Available versions:  (5) 5.6.5 ~5.7.3
       {bluetooth +display-manager grub gtk +handbook mediacenter networkmanager pam plymouth pulseaudio +sddm sdk +wallpapers}
     Installed versions:  5.6.5(5)(12:28:08 26/07/16)(bluetooth display-manager gtk handbook networkmanager pam pulseaudio wallpapers -grub -mediacenter -plymouth -sddm -sdk)
     Homepage:            https://www.kde.org/workspaces/plasmadesktop/
     Description:         Merge this to pull in all Plasma 5 packages

fitzcarraldo@clevow230ss ~ $ eix -I lightdm
[I] x11-misc/lightdm
     Available versions:  1.10.5^t 1.16.7^t ~1.17.6^t ~1.18.1^t ~1.19.0^t ~1.19.3^t {audit +gnome +gtk +introspection kde qt4 qt5}
     Installed versions:  1.16.7^t(04:11:41 23/08/16)(introspection kde qt4 qt5 -audit -gnome -gtk)
     Homepage:            https://www.freedesktop.org/wiki/Software/LightDM
     Description:         A lightweight display manager

[I] x11-misc/lightdm-kde
     Available versions:  (4) 0.3.2.1-r1
       {aqua debug L10N="bs cs da de el es et fi fr ga gl hu it ja km lt mr nds nl pl pt pt-BR ro ru sk sl sv tr uk"}
     Installed versions:  0.3.2.1-r1(4)(01:13:13 12/07/16)(-aqua -debug L10N="pt-BR -bs -cs -da -de -el -es -et -fi -fr -ga -gl -hu -it -ja -km -lt -mr -nds -nl -pl -pt -ro -ru -sk -sl -sv -tr -uk")
     Homepage:            https://projects.kde.org/projects/playground/base/lightdm
     Description:         LightDM KDE greeter

Found 2 matches

And this is what I had previously configured:

fitzcarraldo@clevow230ss ~ $ grep -v ^# /etc/lightdm/lightdm.conf
[LightDM]

session-wrapper=/etc/lightdm/Xsession
[Seat:*]
greeter-session=lightdm-kde-greeter
session-wrapper=/etc/lightdm/Xsession
display-setup-script=/etc/X11/Sessions/plasma

[XDMCPServer]

[VNCServer]
fitzcarraldo@clevow230ss ~ $ cat /etc/X11/Sessions/plasma
#!/bin/bash
GPU=`eselect opengl list | grep \* | awk '{ print $2 }'`
if [ "$GPU" = "nvidia" ]; then
    xrandr --setprovideroutputsource modesetting NVIDIA-0
    xrandr --auto
fi

Now, given that I had installed the LightDM KDE Greeter, I would have expected there to be a default configuration file lightdm-kde-greeter.conf for it, but there was none:

fitzcarraldo@clevow230ss ~ $ ls /etc/lightdm/
Xsession  keys.conf  lightdm.conf  users.conf

So I created the file /etc/lightdm/lightdm-kde-greeter.conf with the following contents:

[greeter]
theme-name=classic

[greeter-settings]
Background=/home/fitzcarraldo/Pictures/Wallpaper/Linux/kde-1920x1080.jpg
BackgroundKeepAspectRatio=true
GreetMessage=Welcome to %hostname%

I downloaded a nice KDE wallpaper file from the Web, which I saved as /home/fitzcarraldo/Pictures/Wallpaper/Linux/kde-1920x1080.jpg, but you can save it anywhere you like and give it any name you want.

I found that the package manager had installed two themes, so I could have specified either:

fitzcarraldo@clevow230ss ~ $ ls /usr/share/apps/lightdm-kde-greeter/themes/
classic  userbar

Anyway, the outcome is that the LightDM login screen (greeter) is no longer white and displays a wallpaper of my choice. Mission accomplished.

Getting KDE Plasma 5 to work with the NVIDIA closed-source driver in Gentoo Linux

Up until a few days ago I had avoided migrating from KDE 4 to KDE Plasma 5, Frameworks 5 and Applications 5 — I’ll refer to the latter three package categories collectively as ‘KDE:5’ — on my main laptop, a Clevo W230SS with NVIDIA Optimus hardware and Gentoo Linux Stable Branch installed. My reluctance to migrate to KDE:5 was because of various problems I experience in KDE:5 on my Compal NBLB2 laptop, which has Gentoo Testing Branch installed (currently Plasma 5.7.1, which you would expect to be less buggy than Plasma 5.5.5 in the Gentoo Stable Branch).

Recently the maintainers of Gentoo’s KDE ebuilds removed some of the KDE 4 ebuilds and made some of the other ebuilds dependent on KDE:5. It became more complicated and convoluted to keep KDE 4 going, so I reluctantly threw in the towel and migrated to KDE:5 on my main laptop. I wish I could have kept KDE 4 on that machine, as KDE 4 worked extremely well (and looked great too).

My first problem after migrating was the infamous black screen in X Windows at start-up. Trying the various suggestions in the Gentoo Wiki did not help and, for the first time since I’ve owned the Clevo laptop, I was glad it has NVIDIA Optimus hardware as I was able to change from using nvidia-drivers to using xf86-video-intel, which got me to a usable Desktop after I switched desktop managers from SDDM (see the system log file error messages below) to LightDM.

Jul 17 04:32:37 clevow230ss sddm-helper[3245]: PAM unable to dlopen(/lib64/security/pam_systemd.so): /lib64/security/pam_systemd.so: cannot open shared object file: No such file or directory
Jul 17 04:32:37 clevow230ss sddm-helper[3245]: PAM adding faulty module: /lib64/security/pam_systemd.so

Although I had merged x11-misc/sddm with USE="-systemd" because my installation uses OpenRC, the above error messages made me suspect that something is wrong with the sddm-0.13.0-r3 ebuild, which is why I switched to LightDM.

However, using solely the Intel driver is not a long-term solution for me because DraftSight CAD software is slower with the Intel driver, so I was keen to get Plasma 5 working with the closed-source NVIDIA driver (I do not want to use Bumblebee).

I managed to get LightDM and Plasma 5 working with nvidia-drivers by doing the following:

  1. Merge x11-misc/lightdm.
  2. Re-merge kde-plasma/plasma-meta with USE="-sddm".
  3. Remove the x11-misc/sddm package and kde-plasma/sddm-kcm package by using the command ‘emerge --ask --depclean‘.
  4. Edit the file /etc/lightdm/lightdm.conf to add the line ‘greeter-session=lightdm-kde-greeter‘ as specified in Gentoo Wiki article LightDM.
  5. Edit the file /etc/lightdm/lightdm.conf to add the line ‘display-setup-script=/etc/X11/Sessions/plasma‘ (any file name would do).
  6. Create the above-mentioned Bash script /etc/X11/Sessions/plasma containing the following:
#!/bin/bash
GPU=`eselect opengl list | grep \* | awk '{ print $2 }'`
if [ "$GPU" = "nvidia" ]; then
    xrandr --setprovideroutputsource modesetting NVIDIA-0
    xrandr --auto
fi

I can now switch between the NVIDIA closed-source driver and the Intel open-source driver using the method described in an earlier post: Switching between Intel and NVIDIA graphics processors on a laptop with NVIDIA Optimus hardware running Gentoo Linux.

Installing DraftSight 2016 Pre-Release in Gentoo Linux

Last year I posted about installing the 2015 Draftsight Free 2D CAD application in Gentoo Linux. Now a DraftSight 2016 Pre-Release is available, and it works in Gentoo. Dassault Systemes has fixed the annoying cursor lag in the 2015 Linux version. \o/

You can click on a link ‘Download DraftSight 2016 for Ubuntu (beta)’ on their Web page ‘DraftSight® FREE* CAD Software Download‘ and copy the downloaded file draftSight.deb to /usr/portage/distfiles/draftsight-1.7.0_beta.deb. Then rename the ebuild draftsight-bin-1.6.1_beta.ebuild to draftsight-bin-1.7.0_beta.ebuild in your local overlay directory /usr/local/portage/media-gfx/draftsight-bin/, but draftsight-bin-1.7.0_beta.ebuild is listed below anyway:

# Copyright 1999-2016 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

EAPI=5

inherit fdo-mime udev unpacker

MY_PN="draftsight"
MY_P="${MY_PN}-${PV}"
DESCRIPTION="Professional 2D CAD application, supporting DWT, DXF and DWG."
HOMEPAGE="http://www.3ds.com/products/draftsight/free-cad-software/"
SRC_URI="${MY_P}.deb"

LICENSE="${MY_PN}"
SLOT="0"
KEYWORDS="~amd64"
IUSE=""
S="${WORKDIR}"

QA_PRESTRIPPED="opt/dassault-systemes/${MY_PN}/bin/DWGConverter
	amd64? ( opt/dassault-systemes/${MY_PN}/lib/libaudio.so.2 )"
QA_TEXTRELS="opt/dassault-systemes/${MY_PN}/lib/libDDKERNEL.so.1"
QA_EXECSTACK="opt/dassault-systemes/${MY_PN}/bin/FxCrashRptApp
opt/dassault-systemes/${MY_PN}/lib/libDDKERNEL.so.1"

RESTRICT="fetch"
DEPEND=""
RDEPEND="amd64? (
		sys-libs/zlib
		net-print/cups
		dev-libs/expat
		dev-libs/glib:2
		media-libs/glu
		media-libs/phonon
		dev-qt/qtcore:4
		dev-qt/qtdbus:4
		dev-qt/qtgui:4
		dev-qt/qtopengl:4
		dev-qt/qtsql:4
		dev-qt/qtwebkit:4
		dev-qt/qtsvg:4
		media-libs/alsa-lib
		media-libs/fontconfig
		media-libs/freetype
		x11-libs/libICE
		x11-libs/libSM
		x11-libs/libX11
		x11-libs/libXext
		x11-libs/libXrender
		x11-libs/libXt
		media-libs/nas
		)"

pkg_nofetch() {
	einfo "Upstream has a mandatory EULA agreement to download this file."
	einfo "Please navigate your browser to:"
	einfo "http://www.3ds.com/products-services/draftsight-cad-software/free-download/"
	einfo "Click \"Download DraftSight 2015 for Ubuntu (beta)\""
	einfo "Download the deb file and move it to ${DISTDIR}/${MY_P}.deb"
}

src_install() {
	cp -R "${WORKDIR}/opt" "${D}"
	exeinto /usr/bin
	doexe "${FILESDIR}/${MY_PN}"

	# prepare for dongle
	udev_dorules "${FILESDIR}"/10-ft-rockey.rules
}

pkg_postinst() {
	elog "To use DraftSight as your default viewer for DWG, DXF, and DWT"
	elog "Please run the following commands respectively as your normal user:"
	elog "xdg-mime default \"dassault-systemes\"_\"draftsight.desktop\" \"application/vnd.dassault-systemes.draftsight-dwg\""
	elog "xdg-mime default \"dassault-systemes\"_\"draftsight.desktop\" \"application/vnd.dassault-systemes.draftsight-dxf\""
	elog "xdg-mime default \"dassault-systemes\"_\"draftsight.desktop\" \"application/vnd.dassault-systemes.draftsight-dwt\""

	fdo-mime_desktop_database_update
	fdo-mime_mime_database_update

	for size in 16 32 48 64 128 ; do
		local XDG_OPTS="--noupdate --novendor --mode system --size ${size}"
		xdg-icon-resource install ${XDG_OPTS} --context apps \
			"${ROOT}/opt/dassault-systemes/DraftSight/Resources/pixmaps/${size}x${size}/program.png" \
			"dassault-systemes.draftsight"
		xdg-icon-resource install ${XDG_OPTS} --context apps --theme gnome \
			"${ROOT}/opt/dassault-systemes/DraftSight/Resources/pixmaps/${size}x${size}/program.png" \
			"dassault-systemes.draftsight"
		for mimetype in dwg dxf dwt ; do
			xdg-icon-resource install ${XDG_OPTS} --context mimetypes \
				"${ROOT}/opt/dassault-systemes/DraftSight/Resources/pixmaps/${size}x${size}/file-${mimetype}.png" \
				"application-vnd.dassault-systemes.draftsight-${mimetype}"
			xdg-icon-resource install ${XDG_OPTS} --context mimetypes --theme gnome \
				"${ROOT}/opt/dassault-systemes/DraftSight/Resources/pixmaps/${size}x${size}/file-${mimetype}.png" \
				"application-vnd.dassault-systemes.draftsight-${mimetype}"
		done
	done
	xdg-icon-resource forceupdate
}

pkg_postrm() {
	fdo-mime_desktop_database_update
	fdo-mime_mime_database_update
	for size in 16 32 48 64 128 ; do
		xdg-icon-resource uninstall --noupdate --context apps --mode system \
			--size ${size} "dassault-systemes.draftsight"
		xdg-icon-resource uninstall --noupdate --context apps --mode system --theme gnome \
			--size ${size} "dassault-systemes.draftsight"
		for mimetype in dwg dxf dwt ; do
			xdg-icon-resource uninstall --noupdate --context mimetypes --mode system \
				--size ${size} "application-vnd.dassault-systemes.draftsight-${mimetype}"
			xdg-icon-resource uninstall --noupdate --context mimetypes --mode system --theme gnome \
				--size ${size} "application-vnd.dassault-systemes.draftsight-${mimetype}"
		done
	done
	xdg-icon-resource forceupdate
}

The files 10-ft-rockey.rules and draftsight in the directory /usr/local/portage/media-gfx/draftsight-bin/files/ can stay the same as for the previous ebuild draftsight-bin-1.6.1_beta.ebuild, but they are listed below anyway:

BUS=="usb", SYSFS{idVendor}=="096e", MODE=="0666"

#! /bin/bash
BASEDIR="/opt/dassault-systemes/DraftSight/Linux"

export LD_LIBRARY_PATH="${BASEDIR}${LD_LIBRARY_PATH:+:}${LD_LIBRARY_PATH}"

# work around DT_RPATH (.) security issue by chdir'ing into expected $LD_LIBRARY_PATH
cd "${BASEDIR}"

exec "${BASEDIR}/DraftSight" $*

Then generate the manifest as usual and merge the package.

Installing the DraftSight Free 2D CAD application in Gentoo Linux

I occasionally have to view AutoCAD files and had been using a 2009 version of VariCAD Viewer for Linux, installed from an RPM package using the rpm command in Gentoo Linux. It was the only version that I could get to work correctly in Gentoo Linux. Versions from more recent years would either not install at all or would install but not run correctly. And the 2009 version of VariCAD Viewer could not open more-recent AutoCAD files. So I had been looking for an alternative for quite a while.

Recently I found out about DraftSight, which is produced by Dassault Systèmes SolidWorks Corp. and is available for Windows, Mac OS and Linux. Apart from the commercial versions DraftSight Professional and DraftSight Enterprise, there is also a free version, DraftSight Free, which is billed as ‘straightforward 2D CAD software for students, hobbyists and other individuals’. I thought this would suit my purposes, as it can read and write DWG and DXF files (see the features page on the DraftSight Web site).

The Gentoo Linux betagarden overlay has ebuilds for releases of DraftSight Free. The package is a proprietary binary package, the Gentoo ebuild is named media-gfx/draftsight-bin and the current version in the betagarden overlay is 1.6.1_beta.

So I added the betagarden overlay using Layman, downloaded the file draftSight.deb (DraftSight 2015 beta) from the DraftSight Web site and copied it to /usr/portage/distfiles/draftsight-1.6.1_beta.deb as specified in the ebuild, and issued the usual emerge command to merge the package. However the ebuild would not install the package whatever I tried: Portage gave an error message that the .deb file could not be downloaded (despite it already being in the distfiles directory). In the end I copied the ebuild and its files sub-directory to /usr/local/portage/media-gfx/draftsight-bin/ in my local overlay, disconnected from the network and merged the package:

# layman -a betagarden
# rm /usr/portage/distfiles/draftsight*
# cp /home/fitzcarraldo/Downloads/draftSight.deb /usr/portage/distfiles/draftsight-1.6.1_beta.deb
# mkdir -p /usr/local/portage/media-gfx/draftsight-bin/files
# cp /var/lib/layman/betagarden/media-gfx/draftsight-bin/draftsight-bin-1.6.1_beta.ebuild /usr/local/portage/media-gfx/draftsight-bin/
# cp /var/lib/layman/betagarden/media-gfx/draftsight-bin/files/* /usr/local/portage/media-gfx/draftsight-bin/files/
# layman -d betagarden
# cd /usr/local/portage/media-gfx/draftsight-bin/
# ebuild draftsight-bin-1.6.1_beta.ebuild manifest
# emerge --ask draftsight-bin

This worked, and I can now launch DraftSight from the KDE launcher’s menu (the only additional thing I did was to specify an icon myself using the KDE Menu Editor, as the DraftSight entry in the KDE launcher menu was icon-less) or by issuing the command ‘draftsight‘ from the command line.

DraftSight is a big advance on using an old version of VariCAD Viewer, and I have finally found a decent 2D CAD application to use in Linux.

Update (March 13, 2016): A new version has been released; see my latest post Installing DraftSight 2016 Pre-Release in Gentoo Linux.

Switching between Intel and NVIDIA graphics processors on a laptop with NVIDIA Optimus hardware running Gentoo Linux

I have a Clevo W230SS laptop with an Intel HD 4600 IGP and an NVIDIA GeForce GTX 860M GPU, running KDE in Gentoo Linux. I could have installed Bumblebee in order to use the NVIDIA GPU with selected applications, but I decided instead to switch manually between the graphics processors. To achieve this I created two Desktop Configuration Files with nice icons on my Desktop, to launch two simple Bash scripts which configure my installation for the desired graphics processor, which will then be used when I next login to KDE. All the necessary files are listed below for Gentoo Linux. You would need to modify them if you are using a different distribution.

The Bash script ~/intel.sh contains the following:

#!/bin/bash
echo
echo "Your installation is currently configured to use the following graphics processor:"
echo
GPU=`eselect opengl list | grep \* | awk '{ print $2 }'`
if [ "$GPU" = "xorg-x11" ]; then
  echo "Intel HD 4600 Integrated Graphics Processor"
  echo
  echo "You do not need to do anything. Please close this window."
elif [ "$GPU" = "nvidia" ]; then
  echo "NVIDIA GeForce GTX 860M"
  echo
  echo "This script will configure your installation to use the"
  echo "Intel HD 4600 Integrated Graphics Controller all the time."
  echo
  echo "Enter your own password."
  echo
  sudo eselect opengl set xorg-x11
  sudo cp /home/fitzcarraldo/Xsetup.intel /usr/share/config/kdm/Xsetup
  sudo cp /home/fitzcarraldo/xorg.conf.intel /etc/X11/xorg.conf
  echo
  echo "Now you should logout to restart X Windows."
fi

The Bash script ~/nvidia.sh contains the following:

#!/bin/bash
echo
echo "Your installation is currently configured to use the following graphics processor:"
echo
GPU=`eselect opengl list | grep \* | awk '{ print $2 }'`
if [ "$GPU" = "nvidia" ]; then
  echo "NVIDIA GeForce GTX 860M"
  echo
  echo "You do not need to do anything. Please close this window."
elif [ "$GPU" = "xorg-x11" ]; then
  echo "Intel HD 4600 Integrated Graphics Processor"
  echo
  echo "This script will configure your installation to use the NVIDIA GeForce GTX 860M GPU all the time."
  echo
  echo "Enter your own password."
  echo
  sudo eselect opengl set nvidia
  sudo cp /home/fitzcarraldo/Xsetup.nvidia /usr/share/config/kdm/Xsetup
  sudo cp /home/fitzcarraldo/xorg.conf.nvidia /etc/X11/xorg.conf
  echo
  echo "Now you should logout to restart X Windows."
fi

I created two files, xorg.conf.intel and xorg.conf.nvidia, in my home directory. The corresponding Bash script copies the applicable file to the directory /etc/X11/ to create an xorg.conf file with the correct contents for the graphics processor.

The file ~/xorg.conf.intel contains the following:

Section "Device" 
   Identifier  "Intel Graphics" 
   Driver      "intel" 
   Option      "AccelMethod" "sna" 
   Option      "TearFree" "true" 
EndSection

The file ~/xorg.conf.nvidia contains the following:

Section "ServerLayout"
    Identifier     "Layout0"
    Screen      0  "nvidia" 0 0
    Inactive       "intel"
EndSection

Section "Monitor"
    Identifier     "Monitor0"
    Option         "DPMS"
EndSection

Section "Device"
    Identifier     "nvidia"
    Driver         "nvidia"
    BusID          "PCI:1:0:0"
EndSection

Section "Device"
    Identifier     "intel"
    Driver         "modesetting"
    BusID          "PCI:0:2:0"
EndSection

Section "Screen"
    Identifier     "nvidia"
    Device         "nvidia"
    Monitor        "Monitor0"
    DefaultDepth    24
    Option         "UseDisplayDevice" "none"
    SubSection     "Display"
        Depth       24
#        Modes      "nvidia-auto-select"
        Virtual     1920 1080
    EndSubSection
EndSection

Section "Screen"
    Identifier     "intel"
    Device         "intel"
    Monitor        "Monitor0"
EndSection

I created two files, Xsetup.intel and Xsetup.nvidia, in my home directory. The corresponding Bash script copies the applicable file to the directory /usr/share/config/kdm/ to create an Xsetup file with the correct contents for the graphics processor.

The file ~/Xsetup.intel is listed below. As you can see, everything is commented out in the file.

#! /bin/sh
# Xsetup - run as root before the login dialog appears

#xconsole -geometry 480x130-0-0 -notify -verbose -fn fixed -exitOnFail -file /dev/xconsole &

The file Xsetup.nvidia is listed below. As you can see, it contains two xrandr commands.

#! /bin/sh
# Xsetup - run as root before the login dialog appears

#xconsole -geometry 480x130-0-0 -notify -verbose -fn fixed -exitOnFail -file /dev/xconsole &
xrandr --setprovideroutputsource modesetting NVIDIA-0
xrandr --auto

I downloaded nice icons from the Web for the Desktop Configuration Files and put them in the directory ~/Pictures/Icons/.

The file ~/Desktop/Select\ Intel\ HD\ Graphics.desktop is listed below.

[Desktop Entry]
Comment[en_GB]=Run a script to configure your installation to use Intel Integrated Graphics when you restart X Windows
Comment=Run a script to configure your installation to use Intel Integrated Graphics when you restart X Windows
Exec=/home/fitzcarraldo/intel.sh
GenericName[en_GB]=Configure your installation to use Intel HD Graphics
GenericName=Configure your installation to use Intel HD Graphics
Icon=/home/fitzcarraldo/Pictures/Icons/intel_hd_graphics_icon.png
MimeType=
Name[en_GB]=Intel HD Graphics
Name=Intel HD Graphics
Path=
StartupNotify=true
Terminal=true
TerminalOptions=\s--noclose
Type=Application
X-DBUS-ServiceName=
X-DBUS-StartupType=none
X-KDE-SubstituteUID=false
X-KDE-Username=fitzcarraldo

The file ~/Desktop/Select\ NVIDIA\ GPU.desktop is listed below.

[Desktop Entry]
Comment[en_GB]=Run a script to configure your installation to use the NVIDIA GeForce GTX 860M GPU when you restart X Windows
Comment=Run a script to configure your installation to use the NVIDIA GeForce GTX 860M GPU when you restart X Windows
Exec=/home/fitzcarraldo/nvidia.sh
GenericName[en_GB]=Configure your installation to use the NVIDIA GeForce GTX 860M GPU
GenericName=Configure your installation to use the NVIDIA GeForce GTX 860M GPU
Icon=/home/fitzcarraldo/Pictures/Icons/nvidia_icon.png
MimeType=
Name[en_GB]=NVIDIA GPU
Name=NVIDIA GPU
Path=
StartupNotify=true
Terminal=true
TerminalOptions=\s--noclose
Type=Application
X-DBUS-ServiceName=
X-DBUS-StartupType=none
X-KDE-SubstituteUID=false
X-KDE-Username=fitzcarraldo

Don’t forget to make all the Bash script files and .desktop files executable. All I have to do is double-click on either icon on the Desktop and a Konsole window pops up and tells me what to do. Next time I log in, the graphics processor I selected will be active.

My thanks go to Gentoo Linux user arthanis for showing me the way in the Gentoo Forums thread [SOLVED] Optimus and Nvidia.

Update (September 24, 2016): I upgraded xorg-server from 1.17.4 to 1.18.4 today and had to change the following line in /etc/X11/xorg.conf:

Screen 0 "nvidia" 0 0

to:

Screen 1 "nvidia" 0 0

See the Gentoo Forums post What’s up with xorg-server 1.18 and Optimus? for further details

More tools for creating QR Codes in Linux

In my previous post I showed how to install CuterCode and Qreator, two simple GUI applications for producing QR Codes, in Gentoo Linux. I have now found a couple of other GUI applications, both of which offer more features than the aforementioned two, such as allowing you to specify the amount of error correction to be incorporated into the QR Code. QR Code codewords are 8 bits long and use the Reed–Solomon error correction algorithm, with four error correction levels possible in the case of QR Codes:

Level L (Low): 7% of codewords can be restored.
Level M (Medium): 15% of codewords can be restored.
Level Q (Quartile): 25% of codewords can be restored.
Level H (High): 30% of codewords can be restored.

The higher the level of error correction, the lower the storage capacity of the QR Code.

And now to the two applications …

Portable QR-Code Generator

This is a Java application, so first make sure you have installed a Java run-time environment (or Java Development Toolkit, which will include the JRE) via Portage.

Download to your home directory the archive qrcodegen_1.14.2.zip containing the compiled Java application, not the archive qrcodegen_1.14.2_src.zip with the source code (‘quellcode’ in German), from the application’s Web site. Unzip it to the directory ~/qrcodegen_1.14.2/ then enter the directory and launch the Java application from the command line as shown below:

$ cd ~/qrcodegen_1.14.2/qrcodegen
$ java -jar QRCodeGen.jar

Alternatively you can create a Desktop Configuration file QRCodeGen.desktop containing the following (change ‘fitzcarraldo’ to your own user name, of course):

[Desktop Entry]
Categories=Graphics
Comment[en_GB]=QR Code Generator is a program that lets you generate and print QR Codes easily.
Comment=QR Code Generator is a program that lets you generate and print QR Codes easily.
Exec=java -jar /home/fitzcarraldo/qrcodegen_1.14.2/qrcodegen/QRCodeGen.jar
GenericName[en_GB]=QRCodeGen
GenericName=QRCodeGen
Icon=/home/fitzcarraldo/qrcodegen_1.14.2/qrcodegen/icon.png
MimeType=
Name[en_GB]=QRCodeGen
Name=QRCodeGen
Path=/home/fitzcarraldo/qrcodegen_1.14.2/qrcodegen/
StartupNotify=true
Terminal=false
TerminalOptions=
Type=Application
X-DBUS-ServiceName=
X-DBUS-StartupType=
X-KDE-SubstituteUID=false
X-KDE-Username=

and make it executable:

$ chmod +x QRCodeGen.desktop

You can choose a nice PNG icon by using Google Images to search for ‘qr code icon png’ and save the image with the file name icon.png in the same directory. Then you can launch QR code Generator by double-clicking on the Desktop Configuration file.

QtQR – QR Code Generator

Download the tarball qr-tools-1.2.tar.gz from the application’s Web site, unpack it to the directory ~/qr-tools-1.2/ and make the Python scripts executable:

$ cd ~/qr-tools-1.2/qr-tools
$ chmod +x qtqr.py
$ chmod +x qrtools.py

Make sure you have installed the package media-gfx/zbar with the python USE flag set, so that the Python zbar module is also installed:

# USE="python" emerge zbar

(You may as well add the python USE flag in the line for media-gfx/zbar in the Portage package.use file so that ZBar’s Python module is installed if you upgrade or re-install ZBar via Portage in future).

Check if the Python Imaging Library (fork) dev-python/pillow is already installed:

# emerge --search pillow

If it is not already installed, install it:

# emerge pillow

Now you can launch QtQR from the command line as follows:

$ cd ~/qr-tools-1.2/qr-tools
$ LD_PRELOAD=/usr/lib/libv4l/v4l1compat.so PYTHONPATH=/usr/lib/python2.7/site-packages:/usr/lib/python2.7/site-packages/PIL ./qtqr.py

Alternatively, you can create a Desktop Configuration file qtqr.desktop with the following contents (change ‘fitzcarraldo’ to your own user name, of course):

[Desktop Entry]
Categories=Graphics
Comment[en_GB]=QtQR is a Qt based software that lets you generate QR Codes easily, scan an image file for a QR Code and decode it or use your webcam to scan a printed one.
Comment=QtQR is a Qt based software that lets you generate QR Codes easily, scan an image file for a QR Code and decode it or use your webcam to scan a printed one.
Exec=LD_PRELOAD=/usr/lib/libv4l/v4l1compat.so PYTHONPATH=/usr/lib/python2.7/site-packages:/usr/lib/python2.7/site-packages/PIL /home/fitzcarraldo/qr-tools-1.2/qr-tools/qtqr.py
GenericName[en_GB]=QtQR
GenericName=QtQR
Icon=/home/fitzcarraldo/qr-tools-1.2/qr-tools/icon.png
MimeType=
Name[en_GB]=QtQR
Name=QtQR
Path=/home/fitzcarraldo/qr-tools-1.2/qr-tools/
StartupNotify=true
Terminal=false
TerminalOptions=
Type=Application
X-DBUS-ServiceName=
X-DBUS-StartupType=
X-KDE-SubstituteUID=false
X-KDE-Username=

and make it executable:

$ chmod +x qtqr.desktop

Then you can launch QtQR by double-clicking on the Desktop Configuration file.

The QtQR GUI has a feature for decoding a QR Code in an image file and for decoding a printed QR Code held in front of a Webcam. If I select ‘Decode’ > ‘Decode from Webcam’, QtQR launches ZBar and, although it is a bit fiddly, I can successfully decode a printed QR Code. However, I cannot get QtQR to decode a QR Code in an image file that QtQR itself created (or to decode a QR Code in a file created by any other application, for that matter), so there is a bug in QtQR. Looking at the application’s bug reports this appears to be Bug No. 811576. It’s not a big deal, though, because the zbarimg command provided by ZBar can be used to decode QR Codes (see my post Installing and using ZBar in Linux to scan bar codes with your Webcam).

$ cd ~/qr-tools-1.2/qr-tools
$ LD_PRELOAD=/usr/lib/libv4l/v4l1compat.so PYTHONPATH=/usr/lib/python2.7/site-packages:/usr/lib/python2.7/site-packages/PIL ./qtqr.py
/usr/lib64/python2.7/site-packages/gtk-2.0/gtk/__init__.py:127: RuntimeWarning: PyOS_InputHook is not available for interactive use of PyGTK
  set_interactive(1)
Object::connect: No such signal org::freedesktop::UPower::DeviceAdded(QDBusObjectPath)
Object::connect: No such signal org::freedesktop::UPower::DeviceRemoved(QDBusObjectPath)
kfilemodule(32309) KSambaSharePrivate::testparmParamValue: Running testparm ("-d0", "-s", "--parameter-name", "usershare path")
Traceback (most recent call last):
  File "./qtqr.py", line 481, in decodeFile
    if qr.decode():
  File "/home/fitzcarraldo/qr-tools-1.2/qr-tools/qrtools.py", line 147, in decode
    pil = Image.open(self.filename).convert('L')
  File "/usr/lib/python2.7/site-packages/PIL/Image.py", line 2256, in open
    % (filename if filename else fp))
IOError: cannot identify image file u'/home/fitzcarraldo/qr-tools-1.2/qr-tools/test.png'

Linux Magazine has a good article on these and other QR Code tools: Generating QR Codes in Linux.

UPDATE (March 30, 2015): You can download an updated working revision (Revision 20) of the Python script qrtools.py, and an updated working revision (Revision 21) of the Python script qtqr.py, from the QtQR and QR Tools developers’ repository where they have been working on an as-yet unreleased Version 1.4 of QtQR and QR Tools:

http://bazaar.launchpad.net/~qr-tools-developers/qr-tools/trunk/files

I have briefly tested qrtools.py Revision 20 and qtqr.py Revision 21 with the other QR Tools Version 1.2 files I downloaded earlier. I simply downloaded the Revison 20 qrtools.py file and the Revision 21 qtqr.py file and overwrote the qrtools.py and qtqr.py files I had extracted earlier from qr-tools-1.2.tar.gz into the directory /home/fitzcarraldo/qr-tools-1.2/qr-tools/ (and made them executable). With the new qrtools.py and new qtqr.py it is now possible for QtQR to decode QR Codes in image files as well as QR Codes scanned via a Webcam, so the bug I mentioned above should be fixed in the next official release of QtQR/QR Tools. So you may as well skip the official Version 1.2 and download all the files from the above-mentioned developers’ repository for the future Version 1.4.