Tweaking Gentoo’s Greeting Message

Add a comment

Articles tagged with gentoo may not totally apply to your preferred flavor of Linux.

Gentoo’s standard greeting message on the console looks like this:

This is <my_hostname>.<my_domain> (Linux x86_64 4.3.3-gentoo) 12:00:00

While informative, it isn’t really pretty. Modifying it turns out to be quite easy, though: just edit /etc/issue! By default, it contains:

This is \n.\O (\s \m \r) \t

Simply adjust this to your needs, and you are done. Especially removing .\O might be of interest, as this gets rid of the ugly .unknown_domain part which you get in case you don’t have a domain configured.

Custom CSS and JS for Sphinx-Generated Documentation

Add a comment

When generating HTML documentation with Sphinx, it is possible to adjust a couple of theme-related settings by defining html_theme_options in your conf.py, e.g.:

html_theme_options = {
    'rightsidebar': True,
    'textcolor': '#333',

However, the available options that can be customized are (a) rather restricted, and (b) specific to each theme. The [options] section of a theme’s theme.conf sheds light on what can be done (and what not).

On a global basis, though, you can define html_context to add some custom CSS and JavaScript files:

html_context = {
    'css_files': ['_static/custom.css'],
    'script_files': ['_static/custom.js'],

The files listed there will be included last in the generated HTML files’ sources, so it is easy to directly tweak the generated documentation’s final appearance (and, if needed, behavior).

For reference, have a look at Sphinx’s builders.html.StandaloneHTMLBuilder.prepare_writing() and see how self.globalcontext gets populated there.

Microsoft’s Natural Ergonomic Keyboard 4000 and its Zoom Slider

Add a comment

Articles tagged with gentoo may not totally apply to your preferred flavor of Linux.

If you are using Microsoft’s excellent Natural Ergonomic Keyboard 4000—at least one product that Microsoft got right—under Linux, chances are that the zoom slider in the middle of the keyboard does not work out of the box. The problem is that the zoom slider uses keycodes greater than 255, which the evdev driver cannot handle.

Fortunately, you can use udev to remap the keys. The default keyboard mappings are contained in /lib/udev/hwdb.d/60-keyboard.hwdb, where you will also find detailed documentation comments on the file format in the header, including:

# To update this file, create a new file
#   /etc/udev/hwdb.d/70-keyboard.hwdb
# and add your rules there. To load the new rules execute (as root):
#   udevadm hwdb --update
#   udevadm trigger /dev/input/eventXX
# where /dev/input/eventXX is the keyboard in question. If in
# doubt, simply use /dev/input/event* to reload all input rules.

You might even already find a section for the Natural Ergonomic Keyboard 4000 in this file. If that is the case, copy its definition and use it as a starting point for the new /etc/udev/hwdb.d/70-keyboard.hwdb. If you want the zoom slider keys to be mapped as “Page Up” and “Page Down” keys, use the following:


Of course, you can map it to anything you like. For example, to emulate a mouse wheel scroll, you could define your custom mapping as:


This should result in Xorg receiving the zoom slider keys as XF86ScrollUp and XF86ScrollDown. Finally, make things work with xdotool1 by binding those keys within your window manager to run xdotool click 4 (scroll up) and xdotool click 5 (scroll down).

  1. Gentoo package x11-misc/xdotool