Created
March 17, 2014 02:24
-
-
Save francisbrito/9592916 to your computer and use it in GitHub Desktop.
My QTile config (Laptop).
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from libqtile.config import Key, Screen, Group | |
from libqtile.command import lazy | |
from libqtile import layout, bar, widget, hook | |
import subprocess | |
import re | |
mod = "mod4" | |
keys = [ | |
# Switch between windows in current stack pane | |
Key( | |
[mod], "k", | |
lazy.layout.next() | |
), | |
Key( | |
[mod], "j", | |
lazy.layout.last() | |
), | |
# Move windows up or down in current stack | |
Key( | |
[mod, "control"], "k", | |
lazy.layout.shuffle_down() | |
), | |
Key( | |
[mod, "control"], "j", | |
lazy.layout.shuffle_up() | |
), | |
# 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("xterm")), | |
# toggle_split between different layouts as defined below | |
Key([mod], "Tab", lazy.nextlayout()), | |
Key([mod], "w", lazy.window.kill()), | |
Key([mod, "control"], "r", lazy.restart()), | |
Key([mod], "r", lazy.spawncmd()), | |
Key([mod], "l", lazy.spawn("logout")), | |
] | |
groups = [ | |
Group("1"), | |
Group("2"), | |
Group("3"), | |
Group("4"), | |
Group("0"), | |
Group("9"), | |
Group("8"), | |
Group("7"), | |
] | |
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)) | |
) | |
dgroups_key_binder = None | |
dgroups_app_rules = [] | |
layouts = [ | |
layout.Max(), | |
layout.TreeTab(), | |
] | |
base_graph_opts = { | |
'graph_color': 'FF550E', | |
'fill_color': '7F2A07', | |
'background': '000000', | |
'border_color': 'FF550E', | |
'border_width': 1.5, | |
'line_width': 1.5, | |
'width': 48 | |
} | |
mem_graph_opts = { | |
'graph_color': 'FFCE24', | |
'fill_color': '7F6712', | |
'border_color': 'FFCE24' | |
} | |
net_graph_opts = { | |
'graph_color': '70BF1E', | |
'fill_color': '4B7F14', | |
'border_color': '70BF1E' | |
} | |
hdd_busy_graph_opts = { | |
'graph_color': '148CCC', | |
'fill_color': '3D7999', | |
'border_color': '148CCC' | |
} | |
def mix_in(*dicts): | |
""" | |
Merges two or more dictionaries into a single one. | |
Operation is done in order, so last keys override others. | |
""" | |
result = {} | |
for d in list(dicts): | |
result.update(d) | |
return result | |
mem_graph_opts = mix_in(base_graph_opts, mem_graph_opts) | |
net_graph_opts = mix_in(base_graph_opts, net_graph_opts) | |
hdd_busy_graph_opts = mix_in(base_graph_opts, hdd_busy_graph_opts) | |
base_text_opts = { | |
'fontsize': 12, | |
'padding': 1 | |
} | |
cpu_label_opts = { | |
'fontsize': 8, | |
'foreground': base_graph_opts['graph_color'] | |
} | |
cpu_label_opts = mix_in(base_text_opts, cpu_label_opts) | |
mem_label_opts = { | |
'fontsize': 8, | |
'foreground': mem_graph_opts['graph_color'] | |
} | |
mem_label_opts = mix_in(base_text_opts, mem_label_opts) | |
net_label_opts = { | |
'fontsize': 8, | |
'foreground': net_graph_opts['graph_color'] | |
} | |
net_label_opts = mix_in(base_text_opts, net_label_opts) | |
hdd_busy_label_opts = { | |
'fontsize': 8, | |
'foreground': hdd_busy_graph_opts['graph_color'] | |
} | |
hdd_busy_label_opts = mix_in(base_text_opts, hdd_busy_label_opts) | |
battery_opts = { | |
'battery_name': 'BAT1', | |
'energy_now_file': 'charge_now', | |
'energy_full_file': 'charge_full', | |
'power_now_file': 'current_now', | |
'format': '{percent:2.1%}' | |
} | |
battery_opts = mix_in(base_text_opts, battery_opts) | |
bottom_bar_widgets = [ | |
widget.GroupBox(**base_text_opts), | |
widget.Prompt(), | |
widget.Spacer(), | |
widget.Systray(), | |
widget.Battery(**battery_opts), | |
widget.Clock(**base_text_opts), | |
] | |
bottom_bar = bar.Bar(bottom_bar_widgets, 20, opacity=0.75) | |
screens = [ | |
Screen( | |
bottom=bottom_bar, | |
top=bar.Bar( | |
[ | |
widget.Spacer(), | |
widget.TextBox('CPU', **cpu_label_opts), | |
widget.CPUGraph(**base_graph_opts), | |
widget.TextBox('MEM', **mem_label_opts), | |
widget.MemoryGraph(**mem_graph_opts), | |
widget.TextBox('NET', **net_label_opts), | |
widget.NetGraph(**net_graph_opts), | |
widget.TextBox('HDD', **hdd_busy_label_opts), | |
widget.HDDBusyGraph(**hdd_busy_graph_opts), | |
], | |
20, | |
opacity=0.75 | |
), | |
), | |
] | |
main = None | |
follow_mouse_focus = True | |
bring_front_click = False | |
cursor_warp = False | |
floating_layout = layout.Floating() | |
mouse = () | |
auto_fullscreen = True | |
widget_defaults = {} | |
# Shamelessly taken from Wiki. | |
def is_running(process): | |
s = subprocess.Popen(["ps", "axw"], stdout=subprocess.PIPE) | |
for x in s.stdout: | |
if re.search(process, x): | |
return True | |
return False | |
def execute_once(process): | |
if not is_running(process): | |
return subprocess.Popen(process.split()) | |
def execute(process): | |
return subprocess.Popen(process.split()) | |
def is_dialog(window): | |
return window.get_wm_type() == "dialog" or window.get_wm_transient_for() | |
def center_window(window): | |
screen_width = 1024 | |
screen_height = 800 | |
window.x = screen_width / 2 - window.x / 2 | |
window.y = screen_height / 2 - window.y / 2 | |
def make_transparent(window): | |
# TODO: Find window id some how and use it instead. | |
command = "transset-df -a" | |
execute(command) | |
@hook.subscribe.client_new | |
def on_client_new(window): | |
# Floating dialogs. | |
if is_dialog(window.window): | |
window.floating = True | |
# start the applications at Qtile startup | |
@hook.subscribe.startup | |
def startup(): | |
execute_once("parcellite") | |
execute_once("feh --bg-scale /home/francis/Wallpapers/") | |
execute_once("xcompmgr") | |
execute_once("devilspie -a") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Saludos,
Esta es la configuracion para iniciarlo desde gnome?