Float out the bar a little bit if there are no windows, or multiple windows. Make single windows always fullscreen with no margins. Make bar transparent except when hovered over.
This commit is contained in:
parent
fa5bbee56e
commit
d6870c56b0
6 changed files with 178 additions and 10 deletions
|
|
@ -30,6 +30,7 @@ logger.warning("Importing kuro utils...")
|
|||
|
||||
import kuro.utils.widgets
|
||||
from kuro.utils import general as utils
|
||||
from kuro.utils.bar import KuroBar
|
||||
from kuro.utils.suntime import Sun
|
||||
|
||||
logger.warning("Importing variables and other utils...")
|
||||
|
|
@ -242,6 +243,7 @@ class Kuro(BaseTheme):
|
|||
border_width=Config.get('width_border', "1"),
|
||||
grow_amount=Config.get('grow_amount', "5"),
|
||||
margin=Config.get('margin_layout', "0"),
|
||||
margin_on_single=Config.get('margin_layout_single', "0"),
|
||||
),
|
||||
layout.Max(),
|
||||
layout.Zoomy(
|
||||
|
|
@ -360,17 +362,44 @@ class Kuro(BaseTheme):
|
|||
widgets = [
|
||||
# Workspaces
|
||||
kuro.utils.widgets.KuroGroupBox(
|
||||
|
||||
# Active group font colour
|
||||
active=Config.get('colour_groupbox_icon_active', '#ffffff'),
|
||||
borderwidth=Config.get('width_groupbox_border', 1),
|
||||
# Inactive group font colour
|
||||
inactive=Config.get('colour_groupbox_icon_inactive', '#444444'),
|
||||
|
||||
# Border or line colour for group on this screen when focused.
|
||||
this_current_screen_border=Config.get('colour_groupbox_border_focus', '#ffffff'),
|
||||
# Border or line colour for group on this screen when unfocused.
|
||||
this_screen_border=Config.get('colour_groupbox_border_focus', '#ffffff'),
|
||||
|
||||
# Border or line colour for group on other screen when focused.
|
||||
other_current_screen_border=Config.get('colour_groupbox_border_normal', '#444444'),
|
||||
# Border or line colour for group on other screen when unfocused.
|
||||
other_screen_border=Config.get('colour_groupbox_border_normal', '#444444'),
|
||||
|
||||
# Urgent group font color
|
||||
urgent_text=Config.get('colour_groupbox_urgent_text', '#FF0000'),
|
||||
# Urgent border or line color
|
||||
urgent_border=Config.get('colour_groupbox_urgent_border', '#FF0000'),
|
||||
|
||||
# Method of highlighting ('border', 'block', 'text', or 'line')
|
||||
highlight_method="line",
|
||||
# Active group highlight color when using 'line' highlight method
|
||||
highlight_color=Config.get("colour_groupbox_highlight", '#888888'),
|
||||
|
||||
# Method for alerting you of WM urgent hints (one of 'border', 'text', 'block', or 'line')
|
||||
urgent_alert_method="block",
|
||||
# To round or not to round box borders
|
||||
rounded=Config.get('bool_groupbox_rounded_borders', True),
|
||||
# Disable dragging and dropping of group names on widget
|
||||
disable_drag=Config.get('bool_groupbox_disable_drag', False),
|
||||
|
||||
# Other settings
|
||||
borderwidth=Config.get('width_groupbox_border', 1),
|
||||
font=Config.get('font_groupbox', 'Arial'),
|
||||
fontsize=Config.get('fontsize_groupbox', 15),
|
||||
highlight_color=Config.get("colour_groupbox_border_normal", '#444444'),
|
||||
inactive=Config.get('colour_groupbox_icon_inactive', '#444444'),
|
||||
rounded=Config.get('bool_groupbox_rounded_borders', True),
|
||||
this_current_screen_border=Config.get('colour_groupbox_border_focus', '#ffffff'),
|
||||
this_screen_border=Config.get('colour_groupbox_border_focus', '#ffffff'),
|
||||
margin=Config.get('margin_groupbox', 0)
|
||||
margin=Config.get('margin_groupbox', 0),
|
||||
),
|
||||
|
||||
# Spawn prompt (only shown if activated)
|
||||
|
|
@ -558,11 +587,14 @@ class Kuro(BaseTheme):
|
|||
])
|
||||
|
||||
# Build the bar
|
||||
return bar.Bar(
|
||||
return KuroBar(
|
||||
background=f"{Config.get('bar_background', '#000000')}{Config.get('bar_rgba_opacity', 'AA')}",
|
||||
background_normal=f"{Config.get('bar_background', '#000000')}{Config.get('bar_rgba_opacity', 'AA')}",
|
||||
background_hover=f"{Config.get('bar_background', '#000000')}{Config.get('bar_rgba_opacity_hover', 'AA')}",
|
||||
opacity=Config.get('bar_opacity', 1.0),
|
||||
widgets=widgets,
|
||||
size=Config.get('height_groupbox', 30)
|
||||
size=Config.get('height_groupbox', 30),
|
||||
margin=[8, 8, 0, 8]
|
||||
)
|
||||
|
||||
# QTile base callbacks
|
||||
|
|
@ -606,6 +638,13 @@ class Kuro(BaseTheme):
|
|||
# Save theme instance in qtile
|
||||
qtile.theme_instance = self
|
||||
|
||||
for screen in self.screens:
|
||||
if screen.top:
|
||||
screen.top.window.window.set_property(
|
||||
"_NET_WM_WINDOW_TYPE",
|
||||
[screen.top.window.window.conn.atoms["_NET_WM_WINDOW_TYPE_DOCK"]]
|
||||
)
|
||||
|
||||
# Update color scheme
|
||||
self.update_colorscheme()
|
||||
|
||||
|
|
@ -874,3 +913,43 @@ class Kuro(BaseTheme):
|
|||
subprocess.Popen(["systemctl", "--user", "import-environment", "WAYLAND_DISPLAY", "XDG_CURRENT_DESKTOP"])
|
||||
subprocess.Popen(["dbus-update-activation-environment", "--systemd", "WAYLAND_DISPLAY", "XDG_CURRENT_DESKTOP=qtile"])
|
||||
subprocess.Popen(["systemctl", "--user", "restart", "xdg-desktop-portal"])
|
||||
|
||||
def update_bar_margins(self, screen_ref, layout_ref, extra_windows=None, ignore_windows=None):
|
||||
if extra_windows is None:
|
||||
extra_windows = []
|
||||
if ignore_windows is None:
|
||||
ignore_windows = []
|
||||
if screen_ref and screen_ref.top:
|
||||
logger.warning(f"Updating margins of bar {screen_ref.top} on screen {screen_ref} for layout {layout_ref}")
|
||||
|
||||
# Update margins. Bar should have no margins when there is only one client on screen (Max layout or Columns with 1 window)
|
||||
# and should have margins in all other cases.
|
||||
if isinstance(layout_ref, layout.max.Max):
|
||||
screen_ref.top.margin = [0, 0, 0, 0]
|
||||
elif isinstance(layout_ref, layout.columns.Columns):
|
||||
clients = extra_windows
|
||||
for column in layout_ref.columns:
|
||||
clients.extend(column.clients)
|
||||
is_single = len([c for c in clients if c not in ignore_windows]) == 1
|
||||
if is_single:
|
||||
screen_ref.top.margin = [0, 0, 0, 0]
|
||||
else:
|
||||
screen_ref.top.margin = [8, 8, 0, 8]
|
||||
else:
|
||||
screen_ref.top.margin = [8, 8, 0, 8]
|
||||
|
||||
# Re-render the top bar to apply margins
|
||||
screen_ref.top._configure(qtile=qtile, screen=screen_ref, reconfigure=True)
|
||||
|
||||
# Re-render visible clients on the screen to apply margins
|
||||
layout_ref.group.layout_all()
|
||||
|
||||
def callback_layout_change(self, new_layout, new_group):
|
||||
logger.warning(f"Changed layout in group {new_group} to {new_layout}")
|
||||
self.update_bar_margins(new_group.screen, new_layout)
|
||||
|
||||
def callback_group_window_add(self, group, window):
|
||||
self.update_bar_margins(group.screen, group.layout, extra_windows=[window])
|
||||
|
||||
def callback_group_window_remove(self, group, window):
|
||||
self.update_bar_margins(group.screen, group.layout, ignore_windows=[window])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue