How to add printers in Wine

If you search on the Internet for “how to install printers on Wine”, practically all the results will call you an idiot: “you can’t install printers on Wine, the system does it automatically”.

It must mean that I’m an idiot, because they don’t appear to me!

Actually, the problem is that Linux is usually installed in 64-bit, and it is usually recommended to run programs in Wine in a 32-bit prefix.

So, by default, no printers appear!

So you need to install the 32-bit CUPS library (CUPS is the print manager in Linux).

In Ubuntu, it is done like this:

sudo apt install libcups2:i386

While we’re at it, you can also add a PDF printer by adding:

sudo apt-get install printer-driver-cups-pdf

and then in the printer panel insert a new printer that has as address:

cups-pdf:/

Like all “typical Linux” things (not very friendly…), when a document will be sent to this printer, it seems that nothing happens, nothing appears on screen, no confirmation. But, actually, a file is saved in ~/PDF (in the home directory). You have to be careful because it decides the name of the file automatically and it happened to me many times printing from Wine that the file was overwritten.

How to clean up the space used by Flatpak

If you have any Flatpak programs installed on your Linux desktop, you will notice that /var/lib/flatpak takes up several gigabytes. This is because, as a concept, a Flatpak package contains all possible libraries that the program could ever load.

However, when you uninstall the program, these packages remain on the startup disk because you may need them in the future. In my case, after installing a dozen very simple programs the directory was over 8 gigs…

To ask the system to clean up unused packages, the command is:

flatpak uninstall --unused

How to change the wallpaper automatically in Linux

There are many ways to change wallpaper automatically in Linux, here’s a very simple and fast one: by using a program called Variety.

Available in all repositories of the most common distributions under the name variety, it is very easy to use compared to other methods.

It inserts an indicator in GNOME:

The indicator on the taskbar

And there are a lot of options available:

Screenshot of the program

Download from the internet, from a subreddit, take it from a directory, make specific filters (ex: always blur, or make grayscale), add a clock or a motivational phrase.

Or: choose only light backgrounds, or only dark backgrounds, or have a shade of color to your liking!

Finally: don’t like the background that was randomly chosen? Just give a “roll” with the mouse wheel over the indicator icon and it will go to the next one!

How to merge many mp4 videos with FFMPEG in a few seconds

I got a video, splitted into lots of files, each only 5 minutes long. I had only two options: either I wasted 30 minutes manually inserting them into a windowed program, or I wasted 2 hours figuring out a command line solution.

Obviously I chose the second option, so in the future the conversion will be more immediate, just follow this post 😉

First of all you have to create a text file that contains the list of files to convert.We have the computer do it. Assuming that all the files to be merged are all located in the same directory and are *.mp4 files, you have to type:

find *.mp4 | sed 's:\ :\ :g'| sed 's/^/file /' > list.txt

This creates a text file called list.txt which contains the file name (preceded by the keyword file).

Then, you pass the list of files to join to FFMPEG, with the command:

ffmpeg -safe 0 -f concat -i list.txt -c copy video-merge.mp4

Done!

Linux and OpenVPN, how to save the password

I recently purchased a VPN subscription from Fastest VPN, with the purpose of using it on Linux, via SSH, command line only. They don’t offer anything special about Linux and the command line, they just use OpenVPN.

How it works: simply install OpenVPN (for example with sudo apt install openvpn), then download the configuration files (for example, these are the files for Fastest VPN) and just write sudo openvpn nomeserver.ovpn to connect.

But there is a big problem: each time you have to write the password by hand! Intolerable, especially with a complex password. Luckily there is a shortcut.

You can create a file with credentials. In a directory accessible only to you, create a file called login.conf and enter, on two lines, username and password, like this:

Username
Password

At this point we modify the *.ovpn files of the configuration. For example, open Luxembourg-UDP.ovpn and see the auth-user-pass entry. We replace it with auth-user-pass login.conf, so when we load the configuration with openvpn, our credentials are auto-filled. Now though, here are 50 files, one for each server. Do we open the files one by one and edit them by hand? No way! sed was invented on purpose.

Just write it down:

sed -i 's/auth-user-pass/auth-user-pass login.conf/g' *.ovpn

and automatically all lines with auth-user-pass will be changed with auth-user-pass login.conf. So, when we download the updated server configurations, they will continue to work perfectly!