Skip to content

Commit

Permalink
Merge remote branch 'roger/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
cortesi committed Nov 29, 2010
2 parents ca4b7cc + bba5e33 commit 113063d
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 23 deletions.
17 changes: 13 additions & 4 deletions examples/config/dgroups.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,15 @@ def compare(self, client):
if _type == 'title':
value = client.name
elif _type == 'wm_class':
value = client.window.get_wm_class()[1]
value = client.window.get_wm_class()
if value:
value = value[1]
elif _type == 'wm_type':
value = client.window.get_wm_type()
else:
value = client.window.get_wm_window_role()

if match_func(value):
if value and match_func(value):
return True
return False

Expand Down Expand Up @@ -75,8 +77,13 @@ def _add(self, client):

wm_class = client.window.get_wm_class()

self.qtile.addGroup(wm_class[1])
client.togroup(wm_class[1])
if wm_class:
group_name = wm_class[1]
else:
group_name = client.name

self.qtile.addGroup(group_name)
client.togroup(group_name)

def _del(self, client):
group = client.group
Expand All @@ -85,4 +92,6 @@ def _del(self, client):
if not (group.name in self.groups and\
self.groups[group.name].get('persist')) and\
len(group.windows) == 1:

client.group.remove(client)
self.qtile.delGroup(group.name)
51 changes: 34 additions & 17 deletions examples/config/roger-config.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@
lazy.spawn("amixer -c 0 -q set Master 2dB-")
),
Key(
[mod], "Left", lazy.prevgroup(),
[mod], "Left", lazy.group.prevgroup(),
),
Key(
[mod], "Right", lazy.nextgroup(),
[mod], "Right", lazy.group.nextgroup(),
),
]

Expand All @@ -71,8 +71,8 @@
# Next, we specify group names, and use the group name list to generate an appropriate
# set of bindings for group switching.
groups = [
Group("1"),
Group("2"),
# Group("1"),
# Group("2"),
]
for i in groups:
keys.append(
Expand All @@ -91,36 +91,53 @@
]


# I have two screens, each of which has a Bar at the bottom. Each Bar has two
# simple widgets - a GroupBox, and a WindowName.
screens = [
Screen(
top = bar.Bar(
[
widget.GroupBox(),
widget.WindowName(),
#widget.Spacer(),
widget.GroupBox(borderwidth=2,
fontsize=14,
padding=1, margin_x=1, margin_y=1),
widget.Sep(),
widget.WindowName(
fontsize=14, margin_x=6),
widget.Sep(),
widget.CPUGraph(width=50, graph_color='0066FF',
fill_color='001188'),
widget.MemoryGraph(width=50, graph_color='22FF44',
fill_color='11AA11'),
widget.SwapGraph(width=50, graph_color='FF2020',
fill_color='C01010'),
widget.Sep(),
widget.Systray(),
widget.Clock(),
widget.Sep(),
widget.Clock('%H:%M %d/%m/%y',
fontsize=18, padding=6),
],
20,
24
),
),
]


def main(qtile):
from dgroups import DGroups, Match
import re

groups = {
'design': {'init': True, 'persist': True},
'h4x': {'init': True, 'spawn': 'Terminal', 'exclusive': True},
'lol': {},
'h4x': {'init': True, 'persist': True, 'spawn': 'guake'},
'design': {},
'emesene': {},
'gajim': {},
}
apps = [
{'match': Match(wm_class=['Gimp']),
'group': 'design', 'float': True},
{'match': Match(title=[re.compile('T.*')]), 'group': 'h4x'},
{'match': Match(wm_type=['dialog']), 'float': True},
{'match': Match(wm_class=['emesene']),
'group': 'emesene'},
{'match': Match(wm_class=['Gajim.py']),
'group': 'gajim'},
{'match': Match(wm_class=['Guake.py', 'MPlayer'],
wm_type=['dialog']), 'float': True},
{'match': Match(wm_class=['Wine']), 'float': True, 'group': 'wine'},
]
dgroups = DGroups(qtile, groups, apps)
2 changes: 1 addition & 1 deletion libqtile/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -770,7 +770,7 @@ def unmanage(self, window):
c = self.windowMap.get(window)
if c:
hook.fire("client_killed", c)
if hasattr(c, "group"):
if getattr(c, "group", None):
c.group.remove(c)
del self.windowMap[window]

Expand Down
2 changes: 1 addition & 1 deletion libqtile/widget/systray.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ def _configure(self, qtile, bar):
atexit.register(self.cleanup)

def draw(self):
self.drawer.draw(self.offset, self.calculate_width())
for pos, icon in enumerate(self.icons.values()):
icon.place(
self.offset + (self.icon_size + self.padding)*pos + self.padding,
Expand All @@ -118,7 +119,6 @@ def draw(self):
0,
None
)


def cleanup(self):
atoms = self.qtile.conn.atoms
Expand Down

0 comments on commit 113063d

Please sign in to comment.