Typing Portuguese Accents on a UK Mac Keyboard in Arch Linux

I use Arch Linux with KDE Plasma (6.2.4) on a 2015 MacBook with a UK Mac keyboard. I wanted to type Portuguese accents (like á, ç, õ) while keeping my system language in English. On macOS, the “Brazilian Pro” layout, changed to “Brazilian” in newer versions, made this easy. But in Linux, it took some tweaking.

What didn’t work

My first choice was to try to find something similar to the layout I was using on macOS. Using the UK Macintosh Intl. layout gave me dead keys, but not all combinations worked. For example, ´ + c gave me ć, not ç.

I tried combining English and Portuguese compose files in ~/.XCompose, but results were inconsistent across apps like Firefox and VS Code.

What kind of worked

Using the UK Macintosh Intl. layout and setting my desktop language to Brazilian Portuguese worked. Changing the language would set different compose rules.

en_US.UTF-8/Compose, for example, had this line:`

<dead_acute> <c>			: "ć"	U0107 # LATIN SMALL LETTER C WITH ACUTE

While pt_BR.UTF-8/Compose has these rules:

<dead_acute> <c>      : "ç" ccedilla  # LATIN SMALL LETTER C WITH CEDILLA

What finally worked

The graphic interface on Linux uses a mix of stuff to make your keyboard work, and it seems there’s no user-friendly way to set that. Here’s what I had to do to get it done:

  1. Set my keyboard layout to English (UK, Macintosh, intl.). It can be easily done using your desktop environment settings. Here’s where I set it on KDE. Ops, they call it Plasma nowadays.

    Setting the keyboard input on KDE

  2. Added this to my ~/.XCompose file. These settings make the key combinations for cedilla work, and also allow us to type ' + s to get 's, which is very used in English, without having to type ' + space + s.

    include "/usr/share/X11/locale/pt_BR.UTF-8/Compose"

    <dead_acute> <s> : "'s"
    <dead_acute> <S> : "'S"
    <dead_acute> <t> : "'t"
    <dead_acute> <T> : "'T"
  3. Added this to ~/.config/environment.d/im.conf:

    GTK_IM_MODULE=cedilla
    QT_IM_MODULE=cedilla
    These lines will fix the inconsistent cedilla behaviour across applications.

Links

Listing the packages on Debian/Ubuntu in one line

You can use dpkg to list all the packages that are selected on your Debian or Ubuntu system:

[sourcecode language=”plain”]# dpkg –get-selections[/sourcecode]

But today I needed a way to list only the installed packages in just one line, so I could copy their names and use apt-get to install the same packages on another system. So I used the following command:

[sourcecode language=”plain”]# dpkg –get-selections | grep "[ \t]*install$" | sed ‘s/[ \t]*install$//g’ | awk ‘BEGIN { packages = "" } { packages = packages " " $1 } END { print packages }’
acpi-support-base acpid adduser apt apt-utils […] long list of packages […] xsltproc xz-utils yelp zenity zlib1g zlib1g-dev[/sourcecode]

You can use the output above to easily install the same packages on another system using apt-get install <packages>.

How to fix ugly fonts in Qt-based applications

I was using Qt Creator and tried to change the editor’s font to Monaco, 9. But hey, Monaco is not that ugly:

Monaco before fix

So I googled a way to fix for this problem, and found the fix at Arch Linux forums. You’ll need to create a file called .fonts.conf in your home directory with this content:

[sourcecode language=”xml”]
<?xml version=’1.0′?>
<!DOCTYPE fontconfig SYSTEM ‘fonts.dtd’>
<fontconfig>
<match target="font" >
<edit mode="assign" name="rgba" >
<const>rgb</const>
</edit>
</match>
<match target="font" >
<edit mode="assign" name="hinting" >
<bool>true</bool>
</edit>
</match>
<match target="font" >
<edit mode="assign" name="hintstyle" >
<const>hintslight</const>
</edit>
</match>
<match target="font" >
<edit mode="assign" name="antialias" >
<bool>true</bool>
</edit>
</match>
</fontconfig>
[/sourcecode]

I closed Qt Creator and reopened it. The result was this:

Monaco after fix

Instalando o bom e velho StarCraft no (argh) Windows Vista ou 7

Hoje vou falar de algo que nunca achei que citaria aqui: Windows. Fazer o quê, o Windows é um bom video game. E, enquanto o novo StarCraft II não sai, a gente fala do bom e velho StarCraft e sua expansão Brood War, que continuam divertidos.


Ontem, no trabalho, um colega meu me mostrou na internet um site vendendo o antigo StarCraft + expansão Brood War, juntos(!) por US$ 5,99 (cerca de R$ 10,50 na cotação do dólar de hoje). Esquema simples: você paga, baixa o jogo e consegue uma CD-key válida para jogar online.

No caso do StarCraft, você compra no link citado acima, cria uma conta na Battle.net, informa o código que você recebe por e-mail da loja onde você comprou o jogo, recebe uma CD-key válida e baixa o jogo.

Depois de algumas horas apanhando, aqui vão algumas considerações para você que deseja instalar o StarCraft, essa pérola de 1998, atual e divertido até hoje:

  • Quando for conectar na Battle.net pela primeira vez, ele vai reclamar que você está usando uma versão antiga e tentar instalar um patch. Desista. Baixe o patch e instale-o manualmente, como administrador: