Qtile 0.4 - Configuration

Qtile is configured in Python. A script (~/.qtile/config.py by default) is evaluated, and a small set of configuration variables (groups, keys, layouts, and screens) are pulled from its global namespace.

Variables

groups

A list of libqtile.manager.Group objects which defines the group names.

keys

A list of libqtile.manager.Key objects which defines the keybindings. At a minimum, this will probably include bindings to switch between windows, groups and layouts.

layouts

A list layout objects, configuring the layouts you want to use.

screens

A list of libqtile.manager.Screen objects, which defines the physical screens you want to use, and the bars and widgets associated with them. Most of the visible "look and feel" configuration will happen in this section.

Complete example

from libqtile.manager import Key, Screen, Group
from libqtile.command import lazy
from libqtile import layout, bar, widget

# The bindings below are for use with a Kinesis keyboard, and may not make
# sense for standard keyboards.
keys = [
    # First, a set of bindings to control the layouts
    Key(
        ["mod1"], "k",
        lazy.layout.down()
    ),
    Key(
        ["mod1"], "j",
        lazy.layout.up()
    ),
    Key(
        ["mod1", "control"], "k",
        lazy.layout.shuffle_down()
    ),
    Key(
        ["mod1", "control"], "j",
        lazy.layout.shuffle_up()
    ),
    Key(
        ["mod1"], "space",
        lazy.layout.next()
    ),
    Key(
        ["mod1", "shift"], "space",
        lazy.layout.rotate()
    ),
    Key(
        ["mod1", "shift"], "Return",
        lazy.layout.toggle_split()
    ),

    Key(["mod1"], "n",      lazy.spawn("firefox")),
    Key(["mod1"], "h",      lazy.to_screen(1)),
    Key(["mod1"], "l",      lazy.to_screen(0)),
    # ~/bin/x starts a terminal program
    Key(["mod1"], "Return", lazy.spawn("~/bin/x")),
    Key(["mod1"], "Tab",    lazy.nextlayout()),
    Key(["mod1"], "w",      lazy.window.kill()),

    # The bindings below control Amarok, and my sound volume.
    Key(
        ["mod1", "shift"], "k",
        lazy.spawn("amixer -c 1 -q set Speaker 2dB+")
    ),
    Key(
        ["mod1", "shift"], "j",
        lazy.spawn("amixer -c 1 -q set Speaker 2dB-")
    ),
    Key(
        ["mod1", "shift"], "n",
        lazy.spawn("amarok -t")
    ),
    Key(
        ["mod1", "shift"], "l",
        lazy.spawn("amarok -f")
    ),
    Key(
        ["mod1", "shift"], "h",
        lazy.spawn("amarok -r")
    ),
]

# Next, we specify group names, and use the group name list to generate an appropriate
# set of bindings for group switching.
groups = [
    Group("a"),
    Group("s"),
    Group("d"),
    Group("f"),
    Group("u"),
    Group("i"),
    Group("o"),
    Group("p"),
]
for i in groups:
    keys.append(
        Key(["mod1"], i.name, lazy.group[i.name].toscreen())
    )
    keys.append(
        Key(["mod1", "shift"], i.name, lazy.window.togroup(i.name))
    )


# Two simple layout instances:
layouts = [
    layout.Max(),
    layout.Stack(stacks=2)
]


# I have two screens, each of which has a Bar at the bottom. Each Bar has two
# simple widgets - a GroupBox, and a WindowName.
screens = [
    Screen(
        bottom = bar.Bar(
                    [
                        widget.GroupBox(),
                        widget.WindowName()
                    ],
                    30,
                ),
    ),
    Screen(
        bottom = bar.Bar(
                    [
                        widget.GroupBox(),
                        widget.WindowName()
                    ],
                    30,
                ),
    )
]
(examples/config/cortesi-config.py)

Copyright (c) 2010 Aldo Cortesi