Small tweaks for new navbar and fallback for older qtile on work laptop
This commit is contained in:
parent
e4b40d40b1
commit
dfcb366241
3 changed files with 60 additions and 28 deletions
|
|
@ -9,7 +9,14 @@ from dateutil import tz
|
|||
from typing import Optional
|
||||
|
||||
from libqtile.backend.base import Window
|
||||
from libqtile.backend.wayland.window import Window as WaylandWindow, Static as WaylandStatic
|
||||
|
||||
# QTile 0.33.x fallback (for work laptop)
|
||||
try:
|
||||
from libqtile.backend.wayland.window import Window as WaylandWindow, Static as WaylandStatic
|
||||
except ImportError:
|
||||
from libqtile.backend.wayland.xwindow import XWindow as WaylandWindow, XStatic as WaylandStatic
|
||||
|
||||
|
||||
from libqtile.backend.x11.window import XWindow as XorgXWindow
|
||||
# Initialize logging
|
||||
from libqtile.log_utils import logger
|
||||
|
|
@ -680,15 +687,16 @@ class Kuro(BaseTheme):
|
|||
|
||||
# TODO: Move get_pid to an utility function
|
||||
w_pid = None
|
||||
try:
|
||||
if hasattr(client, 'get_pid'):
|
||||
w_pid = client.get_pid()
|
||||
except AttributeError: # Some windows might not have this .get_pid method. Try other ways
|
||||
if isinstance(client, XorgXWindow):
|
||||
w_pid = client.get_net_wm_pid()
|
||||
elif isinstance(client, WaylandStatic) or isinstance(client, WaylandInternal):
|
||||
pass # Wayland background layer 'window'
|
||||
else:
|
||||
logger.error(f"Unknown window type {client.__class__.__name__}")
|
||||
elif hasattr(client, 'get_net_wm_pid'):
|
||||
w_pid = client.get_net_wm_pid()
|
||||
elif hasattr(client, 'surface') and hasattr(client.surface, 'pid'):
|
||||
w_pod = client.surface.pid
|
||||
elif client.__class__.__name__ in ["Static", "XStatic", "LayerStatic"]:
|
||||
pass # Wayland background layer 'window'
|
||||
else:
|
||||
logger.error(f"Unknown window type {client.__class__.__name__}")
|
||||
|
||||
if w_pid is not None and w_pid in self.autostart_app_rules.keys():
|
||||
rule_id = self.autostart_app_rules[w_pid]
|
||||
|
|
@ -928,20 +936,20 @@ class Kuro(BaseTheme):
|
|||
logger.warning(f"Ignored clients: {ignore_windows}")
|
||||
logger.warning(f"Extra clients: {extra_windows}")
|
||||
if (len(layout_ref.clients) == 0 and len(extra_windows) == 0) or (len(ignore_windows) > 0 and all(w in ignore_windows for w in layout_ref.clients)):
|
||||
screen_ref.top.margin = [8, 8, 0, 8]
|
||||
screen_ref.top.update_bar_type("floating")
|
||||
else:
|
||||
screen_ref.top.margin = [0, 0, 0, 0]
|
||||
screen_ref.top.update_bar_type("docked")
|
||||
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]
|
||||
screen_ref.top.update_bar_type("docked")
|
||||
else:
|
||||
screen_ref.top.margin = [8, 8, 0, 8]
|
||||
screen_ref.top.update_bar_type("floating")
|
||||
else:
|
||||
screen_ref.top.margin = [8, 8, 0, 8]
|
||||
screen_ref.top.update_bar_type("floating")
|
||||
|
||||
# Re-render the top bar to apply margins
|
||||
screen_ref.top._configure(qtile=qtile, screen=screen_ref, reconfigure=True)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue