Permalink
Browse files

Initial commit.

Imported the examples/ directory in the main repo, as well as my configs. Also
wrote an example config and some documentation to go along with it.
  • Loading branch information...
0 parents commit 082b4a82c1f3b4cf3f674512df8943ac73c215d3 @tych0 tych0 committed Mar 2, 2012
11 README
@@ -0,0 +1,11 @@
+This is a repository for examples of how to use qtile, it is structured as
+follows:
+
+config/ -- demonstration of basic configuration
+scripts/ -- basic scripting with qsh
+user-configs/ -- configurations from various users (typically more customized
+ and advanced)
+user-scripts/ -- scripts written by various users
+
+To contribute please for the repo on github and make a pull request.
+
@@ -0,0 +1,6 @@
+config.py: Example basic qtile configuration file, should work with most
+ distros and the Windows key.
+
+xsession: Example xsession file. To run anything besides qtile when your X
+ session starts, you'll need to define one of these in ~/.xsession, and chmod +x
+ it.
@@ -0,0 +1,113 @@
+# Note that since qtile configs are just python scripts, you can check for
+# syntax and runtime errors by just running this file as is from the command
+# line, e.g.:
+#
+# python config.py
+
+from libqtile.manager import Key, Screen, Group, Drag, Click
+from libqtile.command import lazy
+from libqtile import layout, bar, widget, hook
+
+# The screens variable contains information about what bars are drawn where on
+# each screen. If you have multiple screens, you'll need to construct multiple
+# Screen objects, each with whatever widgets you want.
+#
+# Below is a screen with a top bar that contains several basic qtile widgets.
+screens = [Screen(top = bar.Bar([
+ # This is a list of our virtual desktops.
+ widget.GroupBox(urgent_alert_method='text'),
+
+ # A prompt for spawning processes or switching groups. This will be
+ # invisible most of the time.
+ widget.Prompt(),
+
+ # Current window name.
+ widget.WindowName(),
+ widget.Volume(),
+ widget.Battery(
+ energy_now_file='charge_now',
+ energy_full_file='charge_full',
+ power_now_file='current_now',
+ ),
+ widget.Systray(),
+ widget.Clock('%Y-%m-%d %a %I:%M %p'),
+ ], 30)) # our bar is 30px high
+]
+
+# Super_L (the Windows key) is typically bound to mod4 by default, so we use
+# that here.
+mod = "mod4"
+
+# The keys variable contains a list of all of the keybindings that qtile will
+# look through each time there is a key pressed.
+keys = [
+ # Log out; note that this doesn't use mod4: that's intentional in case mod4
+ # gets hosed (which happens if you unplug and replug your usb keyboard
+ # sometimes, or on system upgrades). This way you can still log back out
+ # and in gracefully.
+ Key(["shift", "mod1"], "q", lazy.shutdown()),
+
+ Key([mod], "k", lazy.layout.down()),
+ Key([mod], "j", lazy.layout.up()),
+ Key([mod], "h", lazy.layout.previous()),
+ Key([mod], "l", lazy.layout.previous()),
+ Key([mod, "shift"], "space", lazy.layout.rotate()),
+ Key([mod, "shift"], "Return",lazy.layout.toggle_split()),
+ Key(["mod1"], "Tab", lazy.nextlayout()),
+ Key([mod], "x", lazy.window.kill()),
+
+ # interact with prompts
+ Key([mod], "r", lazy.spawncmd()),
+ Key([mod], "g", lazy.switchgroup()),
+
+ # start specific apps
+ Key([mod], "n", lazy.spawn("firefox")),
+ Key([mod], "Return", lazy.spawn("xterm")),
+
+ # Change the volume if your keyboard has special volume keys.
+ Key(
+ [], "XF86AudioRaiseVolume",
+ lazy.spawn("amixer -c 0 -q set Master 2dB+")
+ ),
+ Key(
+ [], "XF86AudioLowerVolume",
+ lazy.spawn("amixer -c 0 -q set Master 2dB-")
+ ),
+ Key(
+ [], "XF86AudioMute",
+ lazy.spawn("amixer -c 0 -q set Master toggle")
+ ),
+
+ # Also allow changing volume the old fashioned way.
+ Key([mod], "equal", lazy.spawn("amixer -c 0 -q set Master 2dB+")),
+ Key([mod], "minus", lazy.spawn("amixer -c 0 -q set Master 2dB-")),
+]
+
+# This allows you to drag windows around with the mouse if you want.
+mouse = [
+ Drag([mod], "Button1", lazy.window.set_position_floating(),
+ start=lazy.window.get_position()),
+ Drag([mod], "Button3", lazy.window.set_size_floating(),
+ start=lazy.window.get_size()),
+ Click([mod], "Button2", lazy.window.bring_to_front())
+]
+
+# Next, we specify group names, and use the group name list to generate an appropriate
+# set of bindings for group switching.
+groups = []
+for i in ["a", "s", "d", "f", "u", "i", "o", "p"]:
+ groups.append(Group(i))
+ keys.append(
+ Key([mod], i, lazy.group[i].toscreen())
+ )
+ keys.append(
+ Key([mod, "mod1"], i, lazy.window.togroup(i))
+ )
+
+# Two basic layouts.
+layouts = [
+ layout.Stack(stacks=2, border_width=1),
+ layout.Max(),
+]
+
+# vim: tabstop=4 shiftwidth=4 expandtab
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+# Java apps are broken and need a WM on their hardcoded list. For maximum
+# irony, you should impersonate LG3D, a window manager written by Sun in Java.
+# Available from http://tools.suckless.org/wmname
+wmname LG3D
+
+exec qtile
@@ -0,0 +1,118 @@
+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,
+ ),
+ )
+]
Oops, something went wrong.

0 comments on commit 082b4a8

Please sign in to comment.