Interrogation marks and keyboard layouts

I recently switched from KDE to XFCE because I could not stand KDE bugs anymore. The upside is that XFCE is super simple, fast, and minimalist. The downside is that everything looks "blocky" (as in "lego blocks").

Anyway, two issues have been bugging me these past few days and I finally got around them today.

Accented characters displayed as interrogation marks in terminal

I write in French and English so I sometimes need to type accented characters on the command line. Unfortunately, after installing XFCE on archlinux, I found that every time I typed an accented character in the terminal, it was replaced by an interrogation mark.

After messing around with my configuration files for three days, I finally found the solution on the archlinux wiki:

    # in ~/.bashrc
    export LC_ALL=
    export LC_COLLATE="C"
    export LANG=en_US.utf8

    # in /etc/environment

I believe that only the /etc/environment is necessary, but setting your language in your bash file is considered to be a good practice and other programs might use these variables to determine your locale. Obviously, this is in complement of configuring your /etc/locale.gen file properly.

Keyboard layouts and xfce4-xkb-plugin

This was an extremely annoying bug that probably cost me a few years of my life expectancy in stress. After installing the xfce4-xkb-plugin, I added an extra keyboard layout (English Canada) and I set the layout switch key combination to alt-shift. Unfortunately, the plugin, as other users have
has a tendency to "forget" the layout and/or the key combination every once in a while.

The plugin seems to be patched in various distributions, but since archlinux rarely patch programs (which is a generally a good thing), I was stuck with a buggy version.

After some research, I uninstalled the plugin and added this script in /etc/X11/xinit/xinitrc.d/50-keyboard-bart


    # Reset keyboard options
    setxkbmap -option ""
    # Set layout
    setxkbmap -layout "us,ca"
    # Set international keyboard
    setxkbmap -model "pc105"
    # Use alt-shift to switch layout
    setxkbmap -option "grp:alt_shift_toggle"

If you go down that path, don't forget to make the script executable. You also need to restart your X session (or you can just execute the script in the current session). The downside is that you do not see your current layout on your panel, but I see this as less clutter :-)