83 lines
2.7 KiB
Python
83 lines
2.7 KiB
Python
from libqtile.layout import Floating
|
|
from libqtile.layout.columns import Columns
|
|
|
|
|
|
class KuroWmii(Columns):
|
|
pass
|
|
|
|
|
|
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.color_pixel(self.border_static)
|
|
elif client.has_focus:
|
|
bc = client.group.qtile.color_pixel(self.border_focus)
|
|
else:
|
|
bc = client.group.qtile.color_pixel(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:
|
|
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.windows_map.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
|
|
|
|
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()
|