kuro-qtile-theme/kuro/utils/layouts.py

68 lines
2.1 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_rect):
if hasattr(client, "is_static_window") and client.is_static_window:
bc = self.border_static
elif client.has_focus:
bc = self.border_focus
else:
bc = self.border_normal
if client.maximized:
bw = self.max_border_width
elif client.fullscreen:
bw = self.fullscreen_border_width
else:
bw = self.border_width
# '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:
client.paint_borders(bc, bw)
client.cmd_bring_to_front()
# alternatively, users may have asked us explicitly to leave the client alone
elif any(m.compare(client) for m in self.no_reposition_rules):
client.paint_borders(bc, bw)
client.cmd_bring_to_front()
else:
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
above = self.compute_client_position(client, screen_rect)
client.place(
client.x,
client.y,
client.width,
client.height,
bw,
bc,
above,
)
client.unhide()