Using NetworkManager in Gentoo Linux

, 04/03/2021 | Source: Fitzcarraldo's Blog

My current two laptops running Gentoo Linux (both with OpenRC, elogind, eudev and wpa_supplicant) use NetworkManager rather than Netifrc. (Actually, my desktop machines also use NetworkManager even though they are always connected to the same network.) NetworkManager has worked with wired and wireless networking on these laptops without any issues for over five years now. […]

Enabling other users to login from the xscreensaver lockscreen in Lubuntu 20.10

, 25/02/2021 | Source: Fitzcarraldo's Blog

If Lubuntu 20.10 suspends to RAM, xscreensaver displays a lockscreen with login window when the system resumes. However, LXQt and SDDM currently do not provide a ‘Switch User’ option, so, if you are not the currently logged-in user and you do not know that user’s password, you will be stuck on the xscreensaver lockscreen. If […]

Coloured manual pages

It’s easy to take a lot of things for granted when you’ve been using them for longer than you can remember. Coloured manual pages is one of those things.

By default, there’s no colours for the manual pages, which can make it more difficult to distinguish parts and sections of the documentation than it has to be.

This is what my manual pages looks like.

If you want to put some colours on your own manual pages; simply add this to your configuration file for your shell:

man() {
    env LESS_TERMCAP_mb=$'\E[01;31m' \
    LESS_TERMCAP_md=$'\E[01;33;5;74m' \
    LESS_TERMCAP_me=$'\E[0m' \
    LESS_TERMCAP_se=$'\E[0m' \
    LESS_TERMCAP_so=$'\E[38;5;246m' \
    LESS_TERMCAP_ue=$'\E[0m' \
    LESS_TERMCAP_us=$'\E[04;39;5;146m' \
    man "$@"

If you want to change the colour of the yellow text, you have to change the value 33 on line 3 and if you want to change the cyan colour, you then have to change the value 36 on line 8.

Here are the codes if you haven’t memorised them:

Colour Code
Black 30
Red 31
Green 32
Yellow 33
Blue 34
Purple 35
Cyan 36
Light Gray 37

Implementing a scheme for system-wide automatic Suspend to RAM in Lubuntu 20.10

, 13/02/2021 | Source: Fitzcarraldo's Blog

Lubuntu 20.10 is installed on my family’s desktop PC (single-seat, multi-user). This version of the distribution uses the SDDM display manager and the LXQt desktop environment. Previously the machine had Lubuntu 18.04 installed, which used the LightDM display manager and the LXDE desktop environment. In Lubuntu 18.04 each user could configure the power manager in […]

How I print my text documents with fancy colours

I often read my plain text documents using cat. For the most part that works just fine, but for some larger documents—especially documents with documentation that contains a lot of headers, lists and folds—it can be somewhat difficult to read the document.

That’s why I’m using Supercat for things like this. It works just like cat (hence the name), but it also supports colours using regular expressions.

A compact demo with a Markdown document.

The markers “{{{” and “}}}” are Neovim folds. I can’t imagine living without folds. I use them all the time, even though they do make the file ‘cluttery’ to read with any other standard tool.

It should be noted that this works with a pager as well. If the document is really large, I will page it to less.

Supercat works by specifying a configuration file and the file you want to print:

$ spc -c ~/.config/supercat/markdown.conf

My configuration file for my Markdown documents looks like this:

# spc configuration file
# col - color (blk, red, grn, yel, blu, mag, cya, whi)
#   a - color attribute (console_code)
#         ' ':normal          (0)
#         '-':normal          (0)
#         'b':bold            (1)
#         'u':underline       (4)
#         'r':reverse-video   (7)
#         'k':blink           (5)
#   n - number of matches,  (' ':1, '1'-'9':1-9, '0':all)
#   t - pattern type
#         'c':chars     (strchr)
#         's':string    (strstr)
#         't':regexp    (regcomp) (convert 10-digit unix time to MMDDHHMMSS)
#         'r':regexp    (regcomp)
#         ' ':regexp    (regcomp)
#                    col a n t pattern
#################### ### # # # ########################################
H1                   red   1   (^#\s.*$)
H2                   yel   1   (^##\s.*$)
H3                   yel   1   (^###\s.*$)
H4                   yel   1   (^####\s.*$)
Header               red   1   (^---.*$)
Fold                 blk   1   (# \}\}\})
Fold                 blk   1   (\}\}\})
Fold                 blk   1   (\{\{\{)
List                 blu   1   (^\s*\*)

It only supports headers, lists and folds, which is all that I use for formatting my plaintext documents.

My Rofi plugin for wtwitch

I recently wrote about wtwitch (a CLI-client for Twitch) and while it’s a really good client, I was missing the ability to launch the streams via Rofi like I used to be able to do in the past with Twitchy.

That’s why I adapted my current Rofi script for wtwitch instead of Twitchy:

And here’s the script itself:


handle_selection() {
    if [[ $1 ]]; then
        name=$(echo $1 | awk {'print $1'} | sed 's/\://')
    	notify-send "wtwitch" "Launching the livestream with $name"
        streamlink$name --title "{author}: {title} ({category})"
        exit 1

handle_selection "$( wtwitch check | sed -n '/Live/,/Settings/p' | sed '/Live channels/d;/Settings/d' | sed 's/\x1B\[[0-9;]\{1,\}[A-Za-z]//g;s/   //;' | rofi -font "xos4terminus 12" -bw 3 -dmenu -i -p 'wtwitch' )"

The only thing it’s missing is the current online time of the channels, but that’s a limitation of wtwitch and not my script.

And I know, I haven’t made a post about Rofi itself yet. I’ve been using it for years now, perhaps it’s time for it soon.

Doas - A lightweight alternative to sudo

I was recently made aware of doas, a simplified and lightweight alternative to sudo, which are two utilities to execute commands as another user. The most common use case for these utilities is to execute commands as the “super user” also known as the root user.

doas was originally written for OpenBSD, but are now ported to Linux, FreeBSD, NetBSD and illumos.

In terms of disk usage, the binary file for doas is about four times smaller than sudo on my computer with Gentoo and about 27 (!) times smaller on my computer with Alpine Linux (1216 KiB vs 44 KiB).

When it comes to the configuration, I would say it’s a bit more straightforward, but not enough to be a dealbreaker. In terms of functionality, it seems like doas have some features that sudo is currently lacking, like denying a user access to a specific command.

Example usage

To allow all users in the wheel group to gain access to root, add this to the configuration file /etc/doas.conf:

permit :wheel

Allow a user to execute a command without entering the password:

permit nopass <user> cmd <command>

Deny users access to commands (even if they’re in the wheel group):

deny <user> cmd <command>

Installing the Interactive Deep Colorization application in Linux

, 30/01/2021 | Source: Fitzcarraldo's Blog

There are plenty of articles and videos on the Web regarding colourising old black and white photographs. Some of the resulting colourised photographs look amazing. Several Web sites offer free or commercial automated colourisation of B&W photographs using AI (artificial intelligence) techniques. The free-use sites watermark the result or limit the size of the original […]

How to count the number of online channels via wtwitch

I recently wrote about my new Twitch client wtwitch. It’s been a good replacement for my previous client Twitchy (which has been abandoned and stopped working last year), but there has been one thing that I’ve been missing from my previous client, and that’s the ability to count and print the online channels.

With twitchy it was as easy as:

$ twitchy --non-interactive | wc -l

I used this command to display the online channels in Polybar like this:

inherit = script/defaults

exec = twitchy --non-interactive | wc -l
format-prefix = " "
format-prefix-foreground = ${colors.magenta}

And this is what it looks like:

A part screenshot of my Polybar panel showing the amount of online channels on Twitch

This is also possible with wtwitch, even though it doesn’t support it, I just had to use a few tools to get around it:

$ wtwitch check | sed -n '/Live/,/Settings/p' | sed '/Live channels/d;/Settings/d' | head -n -1 | wc -l

A farewell to Sabayon Linux

, 20/01/2021 | Source: Fitzcarraldo's Blog

After a hiatus of thirty-four months in the blog posts on the Sabayon Linux Website, a couple of posts on 20 November 2020 announced that the distribution was switching its base distribution from Gentoo Linux to Funtoo Linux (‘Sabayon and Funtoo Linux Merge Projects’), and that the distribution was rebranding (‘Sabayon project is rebranding to […]