Skip to content

Instantly share code, notes, and snippets.

View tych0's full-sized avatar

Tycho Andersen tych0

View GitHub Profile
@tych0
tych0 / qtile.desktop
Created March 1, 2012 23:37
.destkop file for qtile
[Desktop Entry]
Encoding=UTF-8
Name=Qtile
Comment=Qtile Session
Exec=qtile
Type=Application
@tych0
tych0 / TODO
Created March 22, 2012 22:22
Qtile TODO
new windows don't steal focus from prompt widget
* make new windows stealing focus configurable
default config in /etc/qtile/config.py
@tych0
tych0 / gist:2184681
Created March 24, 2012 16:10
Run arbitrary python codeon keypress
diff --git a/libqtile/manager.py b/libqtile/manager.py
index 69f1c61..8034430 100644
--- a/libqtile/manager.py
+++ b/libqtile/manager.py
@@ -1597,6 +1597,12 @@ class Qtile(command.CommandObject):
"""
return "OK"
+ def cmd_run(self, closure):
+ """
@tych0
tych0 / gross.py
Created March 28, 2012 01:45
Generating pkg config files inside of disutils' setup.py
### XXX: The following is a hack. py2cairo looks for xpyb.pc when configuring.
### However (as near as I can find) there is no way to get it to install with
### distutils, so we fake it here.
# make xpyb.pc file
class PCOpt(object):
def __init__(self, replace_str, val):
self.replace_str = replace_str
self.val = val
def gen_pc():
@tych0
tych0 / xpyb.pc
Created April 15, 2012 22:16
Sample xpyb-ng pkg-config file
prefix=/usr/local
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include/python2.7/xpyb
Name: XPyB
Description: X-protocol Python Binding
Version: 1.3
Libs: -L${libdir} -lxcb
Cflags: -I${includedir}
Message: Server Error: BadWindow
bad_value: 94371843
major_opcode: 20
minor_opcode: 0
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/libqtile/manager.py", line 1077, in _xpoll
ename = ename[:-5]
File "/usr/local/lib/python2.7/dist-packages/libqtile/manager.py", line 1294, in handle_MapRequest
screen = self.currentScreen
File "/usr/local/lib/python2.7/dist-packages/libqtile/manager.py", line 968, in manage
@tych0
tych0 / gist:4527313
Last active December 11, 2015 01:59
# untested
def null_switch(group):
def f(qtile):
for scr in qtile.screens:
if scr.group == group:
return
qtile.groupMap[group].cmd_toscreen()
return f
Key(..., lazy.function(null_switch('a')))
buildSite :: String -> String -> IO [IO ()]
buildSite src tgt = do
templates <- readTemplates $ src </> "templates"
actions <- foldWithHandler
ignoreExceptions
always
(\acc info -> makeAction info : acc)
[]
src
return $ reverse actions
@tych0
tych0 / gist:5267461
Last active December 15, 2015 13:29
# put a Prompt widget in your bar
def my_func(prompt_result):
pass
def start_prompt(qtile):
p = qtile.widgetMap["prompt"]
p.startInput("hax> ", my_func)
Key(["mod4"], "r", lazy.function(start_prompt))
diff --git a/libqtile/widget/volume.py b/libqtile/widget/volume.py
index da0a97a..5cbb494 100644
--- a/libqtile/widget/volume.py
+++ b/libqtile/widget/volume.py
@@ -57,7 +57,7 @@ class Volume(base._TextBox):
vol = self.get_volume()
if vol != self.volume:
self.volume = vol
- self.draw()
+ self.bar.draw()