Adding default layouts to groups.

This commit is contained in:
Rodolphe Breard 2015-07-18 14:52:27 +02:00
parent 8085aea394
commit 9fbb1bbcc1

View file

@ -44,8 +44,8 @@ class ConfigWrapper:
k = Key(mod, key, action) k = Key(mod, key, action)
self.keys.append(k) self.keys.append(k)
def _add_group(self, name, position): def _add_group(self, name, position, **kwargs):
grp = Group(name, position=position) grp = Group(name, position=position, **kwargs)
self.groups.append(grp) self.groups.append(grp)
access_key = str(position + 1) access_key = str(position + 1)
self._add_key(access_key, lazy.group[name].toscreen()) self._add_key(access_key, lazy.group[name].toscreen())
@ -79,17 +79,29 @@ class ConfigWrapper:
return self.keys return self.keys
def set_groups(self): def set_groups(self):
names = ['main', 'www', 'remote', 'email', 'media', 'misc'] groups = [
for i, name in enumerate(names): ('main', {'layout': 'xmonad-tall'}),
self._add_group(name, i) ('www', {'layout': 'max'}),
('remote', {'layout': 'max'}),
('email', {'layout': 'max'}),
('media', {'layout': 'xmonad-tall'}),
('misc', {'layout': 'floating'}),
]
for i, group in enumerate(groups):
name, opts = group
self._add_group(name, i, **opts)
return self.groups return self.groups
def set_layouts(self): def set_layouts(self):
self.layouts = [ self.layouts = [
layout.MonadTall(border_focus=self.border_focus, align=1), layout.MonadTall(
layout.Max(), border_focus=self.border_focus,
layout.Stack(border_focus=self.border_focus), align=1,
layout.Floating(border_focus=self.border_focus), name='xmonad-tall'
),
layout.Max(name='max'),
layout.Stack(border_focus=self.border_focus, name='stack'),
layout.Floating(border_focus=self.border_focus, name='floating'),
] ]
return self.layouts return self.layouts
@ -141,8 +153,8 @@ def startup():
if __name__ in ['config', '__main__']: if __name__ in ['config', '__main__']:
cnf = ConfigWrapper() cnf = ConfigWrapper()
groups = cnf.set_groups()
layouts = cnf.set_layouts() layouts = cnf.set_layouts()
groups = cnf.set_groups()
screens = cnf.set_screens() screens = cnf.set_screens()
mouse = cnf.set_mouse() mouse = cnf.set_mouse()
keys = cnf.set_keys() keys = cnf.set_keys()