Skip to content

Instantly share code, notes, and snippets.

@AeroNotix
Created February 6, 2012 19:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AeroNotix/1754315 to your computer and use it in GitHub Desktop.
Save AeroNotix/1754315 to your computer and use it in GitHub Desktop.
from libqtile.manager import Key, Screen, Group
from libqtile.command import lazy
from libqtile import layout, bar, widget, hook
keys = [
# SWAP MASTER WINDOWS AROUND
Key(["mod1"], "n", lazy.layout.down()),
Key(["mod1"], "m", lazy.layout.up()),
# LAYOUT CHANGERS
# move to next layout in the stack
Key(["mod1"], "space", lazy.nextlayout()),
# switch master windows
Key(["mod1", "shift"], "space", lazy.layout.rotate()),
# MOVEMENT KEYS
# windows style alt-tab/alt-shift-tab
Key(["mod1"], "Tab", lazy.layout.next()),
Key(["mod1", "shift"], "Tab", lazy.layout.previous()),
# kill current window
Key(["mod1", "shift"], "c", lazy.window.kill()),
# dec ratio of current window
Key(["mod1"], "q", lazy.layout.decrease_ratio()),
# inc ratio of current window
Key(["mod1"], "e", lazy.layout.increase_ratio()),
# APPLICATION LAUNCHERS
Key(["mod1", "shift"], "Return", lazy.spawn("urxvt")),
Key(["mod1", "shift"], "f", lazy.spawn("firefox-aurora")),
Key(["mod1", "shift"], "e", lazy.spawn("emacs")),
Key(["mod1", "shift"], "v", lazy.spawn("vlc")),
Key(["mod1", "shift"], "t", lazy.spawn("thunderbird")),
Key(["mod1", "shift"], "i", lazy.spawn("weechat-curses")),
Key(["mod1", "shift"], "s", lazy.spawn("skype")),
# AUDIO
Key(["mod1"], "F12", lazy.spawn("amixer --quiet set Master 1+")),
Key(["mod1"], "F11", lazy.spawn("amixer --quiet set Master 1-")),
Key(["mod1"], "F6", lazy.spawn("amixer --quiet set Master mute")),
Key(["mod1"], "F7", lazy.spawn("amixer --quiet set Master unmute")),
Key(["mod1"], "F5", lazy.spawn("ncmpcpp pause")),
Key(["mod1"], "F8", lazy.spawn("ncmpcpp play")),
Key(["mod1"], "F4", lazy.spawn("ncmpcpp prev")),
Key(["mod1"], "F9", lazy.spawn("ncmpcpp next")),
# PRINT SCREEN
Key(["mod1"], "F10", lazy.spawn("import -window root ~/screenshot.png")),
# BASE COMMANDS
# shutdown
Key(["mod1", "shift"], "q", lazy.spawn('unlogin')),
# restart qtile
Key(["mod1", "shift"], "p", lazy.restart())
]
# Next, we specify group names, and use the group position to generate
# a key binding for it.
groups = [
Group('home'),
Group('emacs'),
Group('mail'),
Group('stats'),
Group('terminal'),
Group('weechat'),
Group('music'),
Group('skype'),
]
for index, grp in enumerate(groups):
# index is the position in the group list x is the group objects.
# We assign each group object a set of keys based on it's
# position in the list.
# Eventually we will implement a function to change the name based
# on what window is active in that group.
keys.extend([
# switch to group
Key(["mod1"], str(index+1), lazy.group[grp.name].toscreen()),
# send to group
Key(["mod1", "shift"], str(index+1), lazy.window.togroup(grp.name))
])
# Two simple layout instances:
layouts = [
layout.Max(),
layout.Stack(stacks=2),
layout.Tile(ratio=0.25)
]
default_data = dict(fontsize=12,
foreground="FF6600",
background="1D1D1D",
font="ttf-droid")
screens = [
Screen(bottom = bar.Bar([widget.GroupBox(**default_data),
widget.WindowName(**default_data),
widget.Clock(**default_data)],
30,))]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment