Skip to content

Instantly share code, notes, and snippets.

Created April 14, 2016 00:56
Show Gist options
  • Save anonymous/01650115187e1568a3c7591da06de35f to your computer and use it in GitHub Desktop.
Save anonymous/01650115187e1568a3c7591da06de35f to your computer and use it in GitHub Desktop.
from libqtile.config import Key, Screen, Group, Drag, Click
from libqtile.command import lazy
from libqtile import layout, bar, widget, hook
import os
import subprocess
mod = "mod4"
terminal = "terminology"
keys = [
# Switch between windows in current stack pane
Key(
[mod], "s",
lazy.layout.down()
),
Key(
[mod], "w",
lazy.layout.up()
),
Key(
[mod], "a",
lazy.layout.left()
),
Key(
[mod], "d",
lazy.layout.right()
),
# Move windows up or down in current stack
Key(
[mod, "shift"], "s",
lazy.layout.shuffle_down()
),
Key(
[mod, "shift"], "w",
lazy.layout.shuffle_up()
),
Key(
[mod, "shift"], "a",
lazy.layout.shuffle_left()
),
Key(
[mod, "shift"], "d",
lazy.layout.shuffle_right()
),
Key(
[mod, "control"], "w",
lazy.layout.grow_down()
),
Key(
[mod, "control"], "s",
lazy.layout.grow_up()
),
Key(
[mod, "control"], "a",
lazy.layout.grow_left()
),
Key(
[mod, "control"], "d",
lazy.layout.grow_right()
),
Key(
[mod], "n",
lazy.layout.normalize()
),
# Switch window focus to other pane(s) of stack
Key(
[mod], "space",
lazy.layout.next()
),
# Swap panes of split stack
Key(
[mod, "shift"], "space",
lazy.layout.rotate()
),
# Toggle between split and unsplit sides of stack.
# Split = all windows displayed
# Unsplit = 1 window displayed, like Max layout, but still with
# multiple stack panes
Key(
[mod, "shift"], "Return",
lazy.layout.toggle_split()
),
Key([mod], "Return", lazy.spawn(terminal)),
# Toggle between different layouts as defined below
Key([mod], "Tab", lazy.next_layout()),
Key([mod], "q", lazy.window.kill()),
Key([mod, "control"], "r", lazy.restart()),
Key([mod, "control"], "q", lazy.shutdown()),
Key([mod], "r", lazy.spawncmd()),
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")
),
# Switch focus to other screens
Key([mod], "x", lazy.to_screen(0)), # left
Key([mod], "y", lazy.to_screen(1)) # right
]
groups = [Group(i) for i in "12345678"]
for i in groups:
# mod1 + letter of group = switch to group
keys.append(
Key([mod], i.name, lazy.group[i.name].toscreen())
)
# mod1 + shift + letter of group = switch to & move focused window to group
keys.append(
Key([mod, "shift"], i.name, lazy.window.togroup(i.name))
)
layouts = [
layout.Columns(
border_focus="#ff5050", border_normal="#666699",
border_width=4, margin=10
),
layout.Stack(num_stacks=2)
]
widget_defaults = dict(
font='Droid Sans',
fontsize=16,
padding=3,
)
screens = [
Screen(
top=bar.Bar(
[
widget.GroupBox(inactive="#262626", active="#e6e6e6",
this_current_screen_border="#4b99ce",
this_screen_border="#4b99ce"
),
widget.sep.Sep(foreground="#0033cc", linewidth=1, padding=8),
widget.Prompt(),
widget.WindowName(),
widget.Systray(),
# widget.KeyboardLayout(configured_keyboards=["de", "us"]),
widget.DF(),
widget.Notify(),
widget.sep.Sep(foreground="#0033cc", linewidth=1, padding=8),
widget.Net(interface="enp3s0"),
widget.NetGraph(),
widget.sep.Sep(foreground="#0033cc", linewidth=1, padding=8),
widget.Clock(format='%I:%M %p'),
],
30,
background='#15639E',
opacity=0,
),
),
Screen(
top=bar.Bar(
[
widget.GroupBox(inactive="#262626", active="#e6e6e6",
this_current_screen_border="#4b99ce",
this_screen_border="#4b99ce"
),
widget.Prompt(),
widget.WindowName(),
widget.Systray(),
widget.sep.Sep(foreground="#0033cc", linewidth=1, padding=8),
widget.TextBox(text="Upgradeable Packages: ",
font='Droid Sans',
fontsize=16),
widget.Pacman(unavailable="#e6e6e6")
],
30,
background='#15639E',
opacity=0,
)
)
]
# Drag floating layouts.
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())
]
dgroups_key_binder = None
dgroups_app_rules = []
main = None
follow_mouse_focus = True
bring_front_click = False
cursor_warp = False
floating_layout = layout.Floating()
auto_fullscreen = True
focus_on_window_activation = "smart"
# XXX: Gasp! We're lying here. In fact, nobody really uses or cares about this
# string besides java UI toolkits; you can see several discussions on the
# mailing lists, github issues, and other WM documentation that suggest setting
# this string if your java app doesn't work correctly. We may as well just lie
# and say that we're a working one by default.
#
# We choose LG3D to maximize irony: it is a 3D non-reparenting WM written in
# java that happens to be on java's whitelist.
wmname = "LG3D"
@hook.subscribe.startup_once
def autostart():
home = os.path.expanduser('~/.config/qtile/autostart.sh')
subprocess.call([home])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment