Multiple changes
This commit is contained in:
parent
5b7475e50f
commit
8c070c86a5
7 changed files with 1052 additions and 709 deletions
|
@ -1,51 +1,82 @@
|
|||
from libqtile.layout.wmii import Wmii
|
||||
from libqtile.layout import Floating
|
||||
from libqtile.layout.columns import Columns
|
||||
|
||||
|
||||
class KuroWmii(Wmii):
|
||||
def cmd_previous(self):
|
||||
super(KuroWmii, self).cmd_previous()
|
||||
class KuroWmii(Columns):
|
||||
pass
|
||||
|
||||
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)
|
||||
class KuroFloating(Floating):
|
||||
defaults = [
|
||||
("border_static", "#dddddd", "Border colour for static windows."),
|
||||
]
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(KuroFloating, self).__init__(*args, **kwargs)
|
||||
self.add_defaults(KuroFloating.defaults)
|
||||
|
||||
def configure(self, client, screen):
|
||||
# 'sun-awt-X11-XWindowPeer' is a dropdown used in Java application,
|
||||
# don't reposition it anywhere, let Java app to control it
|
||||
cls = client.window.get_wm_class() or ''
|
||||
is_java_dropdown = 'sun-awt-X11-XWindowPeer' in cls
|
||||
if is_java_dropdown:
|
||||
return
|
||||
|
||||
if hasattr(client, "is_static_window") and client.is_static_window:
|
||||
bc = client.group.qtile.colorPixel(self.border_static)
|
||||
elif client.has_focus:
|
||||
bc = client.group.qtile.colorPixel(self.border_focus)
|
||||
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]}
|
||||
bc = client.group.qtile.colorPixel(self.border_normal)
|
||||
if client.maximized:
|
||||
bw = self.max_border_width
|
||||
elif client.fullscreen:
|
||||
bw = self.fullscreen_border_width
|
||||
else:
|
||||
bw = self.border_width
|
||||
above = False
|
||||
|
||||
# We definitely have a screen here, so let's be sure we'll float on screen
|
||||
try:
|
||||
index = self.columns.index(column) + 1
|
||||
except ValueError:
|
||||
index = 0
|
||||
client.float_x
|
||||
client.float_y
|
||||
except AttributeError:
|
||||
# this window hasn't been placed before, let's put it in a sensible spot
|
||||
transient_for = client.window.get_wm_transient_for()
|
||||
win = client.group.qtile.windowMap.get(transient_for)
|
||||
if win is not None:
|
||||
# if transient for a window, place in the center of the window
|
||||
center_x = win.x + win.width / 2
|
||||
center_y = win.y + win.height / 2
|
||||
else:
|
||||
center_x = screen.x + screen.width / 2
|
||||
center_y = screen.y + screen.height / 2
|
||||
above = True
|
||||
|
||||
self.columns.insert(index, c)
|
||||
x = center_x - client.width / 2
|
||||
y = center_y - client.height / 2
|
||||
|
||||
# don't go off the right...
|
||||
x = min(x, screen.x + screen.width)
|
||||
# or left...
|
||||
x = max(x, screen.x)
|
||||
# or bottom...
|
||||
y = min(y, screen.y + screen.height)
|
||||
# or top
|
||||
y = max(y, screen.y)
|
||||
|
||||
if not (self.no_reposition_match and self.no_reposition_match.compare(client)):
|
||||
client.x = int(round(x))
|
||||
client.y = int(round(y))
|
||||
|
||||
client.place(
|
||||
client.x,
|
||||
client.y,
|
||||
client.width,
|
||||
client.height,
|
||||
bw,
|
||||
bc,
|
||||
above,
|
||||
)
|
||||
client.unhide()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue