Skip to content

Instantly share code, notes, and snippets.

@tzbob
Created April 17, 2012 22:14
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 tzbob/2409414 to your computer and use it in GitHub Desktop.
Save tzbob/2409414 to your computer and use it in GitHub Desktop.
Qtile config
from libqtile.manager import Key, Screen, Drag, Group
from libqtile.command import lazy
from libqtile import layout, bar, widget, hook
mod = "mod1"
win = "mod4"
# Keybinds: Key([modifiers], "key", action())
keys = [
Key([mod], "space", lazy.nextlayout()),
Key([mod], "j", lazy.layout.previous()),
Key([mod], "k", lazy.layout.next()),
Key([mod], "l", lazy.layout.increase_ratio()),
Key([mod], "h", lazy.layout.decrease_ratio()),
Key([mod], "t", lazy.window.toggle_floating()),
Key([mod, "shift"], "j", lazy.layout.up()),
Key([mod, "shift"], "k", lazy.layout.down()),
Key([mod, "shift"], "h", lazy.layout.increase_nmaster()),
Key([mod, "shift"], "l", lazy.layout.decrease_nmaster()),
Key([mod, "shift"], "c", lazy.window.kill()),
Key([mod, "shift"], "q", lazy.restart()),
Key([mod, "control"], "j", lazy.spawn("amixer sset Master 5%-")),
Key([mod, "control"], "k", lazy.spawn("amixer sset Master 5%+")),
Key([mod, "control"], "m", lazy.spawn("amixer sset Master toggle ")),
Key([win], "v", lazy.spawn("mplayer -profile corner -shuffle ~/Videos/Playlist/*")),
Key([win], "l", lazy.spawn("luakit")),
Key([win], "i", lazy.spawn("urxvtc -e sh -c irssi")),
Key([win], "c", lazy.spawn("chromium")),
Key([win, "shift"], "c", lazy.spawn("chromium --incognito")),
Key([mod], "n", lazy.spawn("nmcon")),
Key([mod], "m", lazy.spawn("dmount")),
Key([mod, "shift"], "Return", lazy.spawn("urxvtc")),
Key([mod], "Return", lazy.spawn("dmenu_run -b")),
Key([mod, "shift"], "space", lazy.spawn("xdotool click 1")),
]
# Mousebinds: Operation([modifiers], "Button", action())
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()),
]
# 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 ", layout="max"),
]
for i in groups:
keys.append(
Key([mod], i.name.strip(), lazy.group[i.name].toscreen())
)
keys.append(
Key([mod, "shift"], i.name.strip(), lazy.window.togroup(i.name))
)
# Activate mouse follows focus
cursor_warp = True
# Activate focus follows mouse
follow_mouse_focus = True
border = {
"border_normal":"#efefef"
, "border_focus":"#4A8BF5"
, "border_width":1
}
# Two simple layout instances:
layouts = [
layout.Tile(
shift_windows = True # Activate XMonad style window shifting
, add_on_top = False # Deactive 'new windows go to top' feature
, **border
),
layout.Max(),
]
# Remove borders from the floating layout
floating_layout = layout.Floating(
border_width=0
,max_border_width=0
,fullscreen_border_width=0
)
# Create a general theme
theme = {
"font":"inconsolata"
,"fontsize":11
,"background":"#efefef"
,"foreground":"#000000"
}
# I have 1 screen with 1 bar
screens = [
Screen(
top = bar.Bar(
[
widget.GroupBox(
borderwidth=1
, this_screen_border=border["border_focus"]
, active=border["border_focus"]
, inactive=theme["foreground"]
, padding=3
, margin_x=2
, margin_y=-1
, **theme
),
widget.Sep(**theme),
widget.WindowName(
margin_x=5
, **theme
),
widget.Sep(**theme),
widget.CurrentLayout(**theme),
widget.Sep(**theme),
widget.Volume(
**theme
),
widget.Sep(**theme),
widget.Battery(
energy_now_file="charge_now"
, energy_full_file="charge_full"
, power_now_file="current_now"
, update_delay=5
, format="{char} {percent:2.0%} {hour:d}:{min:02d}"
, **theme
),
widget.Sep(**theme),
widget.Clock(
fmt="%H:%M %d %B %Y"
, **theme
),
],
16,
),
)
]
# Hook a function to the client_new event to float dialogs
# Do whatever you want to your new windows here
def new_windows(window):
print(window.window.get_wm_class())
if window.window.get_wm_type() == "dialog" or window.window.get_wm_transient_for() or "sun-awt-X11-XDialogPeer" == window.window.get_wm_class():
window.floating = True
hook.subscribe.client_new(new_windows)
# Hook a function to the startup event
def startup():
import subprocess
#subprocess.Popen("/home/tzbob/bin/dropbox-qtile.py")
hook.subscribe.startup(startup)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment