Skip to content

Instantly share code, notes, and snippets.

@bcho
Created November 22, 2012 12:00
Show Gist options
  • Select an option

  • Save bcho/4130791 to your computer and use it in GitHub Desktop.

Select an option

Save bcho/4130791 to your computer and use it in GitHub Desktop.
# 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
import os
from libqtile.manager import Key, Screen, Group, Drag, Click
from libqtile.command import lazy
from libqtile import layout, bar, widget
# 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='border', borderwidth=1,
highlight_method='block', fontsize=11),
# A prompt for spawning processes or switching groups. This will be
# invisible most of the time.
widget.Prompt(fontsize=11),
# Current window name.
widget.WindowName(fontsize=11),
widget.Battery(
energy_now_file='charge_now',
energy_full_file='charge_full',
power_now_file='current_now',
fontsize=11,
),
widget.Systray(),
widget.Clock('%H:%M', fontsize=11),
], 30))
]
# 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], "f", 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("chromium")),
Key([mod], "Return", lazy.spawn("terminator")),
# 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, name in enumerate(['alpha', 'beta', 'gamma', 'delta']):
groups.append(Group(name))
keys.append(
Key([mod], str(i + 1), lazy.group[name].toscreen())
)
keys.append(
Key([mod, "mod1"], str(i + 1), lazy.window.togroup(name))
)
layouts = [
layout.Stack(stacks=2, border_width=1),
layout.Max(),
layout.RatioTile(),
layout.MonadTall(),
layout.Tile(),
layout.Floating(),
layout.Slice(side='left', width='100'),
layout.TreeTab(),
layout.Zoomy()
]
def main(foo):
os.system('feh --bg-fill ~/Documents/Pictures/wallpaper')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment