Customizing Arch Linux

Feb 11, 2018 10:56 · 741 words · 4 minute read Arch Linux

You’ve installed Arch Linux and now you are looking to start customizing. There’s a plethora of tutorials and so much to look into. The is another minimal instructions on how to get things looking useable

Window Management

I’m running xorg and i3. This might be overkill for installs but will give you everything you need.

$ pacman -Syu i3 dmenu xorg xorg-{server,xinit,xinput,xwininfo,xlogo,xauth,xclock,twm}

Modify your ~/.xinitrc to the following:

exec i3

Now type startx and you should be presented with i3 config settings. These get stored in ~/.config/i3/config. To exit type modifer+shift+e and click exit.

Terminal Emulator

I don’t know much about the difference between xterm and rxvt but I just went with rxvt.

$ pacman -Syu rxvt-unicode rxvt-unicode-terminfo

You can see which fonts are available on your system for use with fc-list and search for packages to install fonts from using pacman -Ss fonts or pacman -Ss ttf. Then install the ones you want

pacman -Syu ttf-bitstream-vera

The settings for rxvt, such as which font to use, are stored in ~/.Xdefaults. If you are using a patched font of some sort and are having trouble getting symbols to render you may have to add:

export LANG=en_US.UTF-8

into your ~/.xinitrc

Keyboard Shortcut Modifications

Disclaimer: I hacked this until it worked, not guaranteed to be pretty.

On mac I used Jason Rudolf’s keyboard repo and now I can’t live with some of tips I picked up from that. Using xorg I tried to replicate most of what I needed through xmodmap but found that xkbcomp was much a bit easier.

Testing Keystrokes

You can use a program called xev at anytime to test what the incoming keypresses are being registered as. This is useful to have absolute truth in knowing what symbol is being sent to your computer. Control + C to exit.

Caps Lock as ‘Hyper Mode’

Create a ‘current’ version of the keyboard as well as a backup in case things go south.

$ mkdir -p ~/.xkb/keymap
$ xkbcomp $DISPLAY ~/.xkb/keymap/keymap.xkb
$ xkbcomp $DISPLAY ~/.xkb/keymap/keymap.xkb-bck

First remap look for a similar line and change Capslock to Mode_switch:

key <CAPS> { [ Mode_switch, Mode_switch ] );

This turns Capslock into a special modifiey. I’m not sure if overwriting mode_switch is correct but it does what I want. Next you can look for different letters and add the following:

key <AC07> {
    type= "ALPHABETIC",
    symbols[Group1]= [    j,    J],
    # This is the new line to add
    symbols[Group2] = [ Down ]

Without too much details, Group1 characters <AC07> is the signal recieved from the keyboard and it maps to j and if you press Shift + <AC07> you will get J. The is explained a bit on the wiki for xmodmap under the heading keymap. Now Group2 is what happens when you hit mode_switch + <AC07>, and we mapped mode_switch to Capslock. I use this to make Capslock + h, j, k, or l equivalent of hitting the arrow keys. This is super useful for not having to leave the homerow to get additional key functionality.

Changing modifier keys

I also prefer a Mac style layout of keys with the addition of the right super being converted into right control, I found I wasn’t using the right super for much of anything anyways. I also wanted to make sure that my left super was activating i3 commands but the left one was not. Type xmodmap to get a current mapping of your keys (This is mine it will be different):

xmodmap:  up to 3 keys per modifier, (keycodes in parentheses):

shift       Shift_L (0x32),  Shift_R (0x3e)
control     Control_L (0x25),  Control_R (0x69),  Super_R (0x86)
mod1        Alt_L (0x40),  Alt_R (0x6c),  Meta_L (0xcd)
mod2        Num_Lock (0x4d)
mod4        Super_L (0x85),  Super_L (0xce),  Hyper_L (0xcf)
mod5        ISO_Level3_Shift (0x5c),  Mode_switch (0xcb)

Yours will probably have mod4 include the Super_R and lock will have capslock. mod4 or mod1 are the modifiers that you choose from when you set your initial i3 configuration. Look inside your keymap file for lines similar to these:

modifier_map Mod2 { <NMLK> };
modifier_map Mod5 { <LVL3> };
modifier_map Control { <RCTL> };
modifier_map Mod1 { <RALT> };
modifier_map Mod4 { <LWIN> };
# My Cusomizations
# modifier_map Lock { <CAPS> };
modifier_map Control { <RWIN> };

I’ve removed CAPS as well as added RWIN to the control group. To source this maping when you startx add this to your xinitrc:

xkbcomp -I$HOME/.xkb $HOME/.xkb/keymap/keymap.xkb $DISPLAY

and now you should have have custom keyboard shortcuts.