Add KuroWMII layout that manages new windows in a way I like, add some more shortcuts, improve battery icon, automatically open programs on workspaces and remove the GroupRules for them after they spawn so that new instances of that app don't open on that workspace any more.

This commit is contained in:
Kevin Alberts 2017-12-02 09:29:26 +01:00
parent b9224b667d
commit 9a3fdf1b65
5 changed files with 176 additions and 14 deletions

51
kuro/utils/layouts.py Normal file
View file

@ -0,0 +1,51 @@
from libqtile.layout.wmii import Wmii
class KuroWmii(Wmii):
def cmd_previous(self):
super(KuroWmii, self).cmd_previous()
def cmd_next(self):
super(KuroWmii, self).cmd_next()
def add(self, client):
"""
Add a new client window to the layout and focus it. It will be added to either the current column if there
are less rows in the current column than columns on the screen, or to a new row to the right of the current
column if there are less columns than rows in the current column.
:param client: The client window to add.
"""
self.clients.append(client)
c = self.current_column()
if c is None:
if len(self.columns) == 0:
self.columns = [{'active': 0, 'width': 100, 'mode': 'split', 'rows': []}]
c = self.columns[0]
c['rows'].append(client)
else:
num_cols = len(self.columns)
num_rows_curr_col = len(c['rows'])
if num_rows_curr_col < num_cols:
c['rows'].append(client)
else:
self.add_column_to_right(c, client)
self.focus(client)
def add_column_to_right(self, column, win):
"""
Adds a new column to the right of the given column with the given window in it
:param column: The column that's going to be to the left of the new column
:param win: The window to add to the new column
"""
newwidth = int(100 / (len(self.columns) + 1))
# we are only called if there already is a column, simplifies things
for c in self.columns:
c['width'] = newwidth
c = {'width': newwidth, 'mode': 'split', 'rows': [win]}
try:
index = self.columns.index(column) + 1
except ValueError:
index = 0
self.columns.insert(index, c)