feat: round bar on smart corners
also take in the i3 ipc code to support custom messages
This commit is contained in:
25
sims/main.py
25
sims/main.py
@@ -12,7 +12,7 @@ else:
|
||||
logger.configure(handlers=[{"sink": sys.stderr, "level": LOG_LEVEL, "format": "{time} | {level} | {name}:{function}:{line} - {message}"}])
|
||||
|
||||
from fabric import Application
|
||||
from fabric.i3 import I3, I3MessageType
|
||||
from sims.services.i3 import I3, I3MessageType
|
||||
from fabric.system_tray.widgets import SystemTray
|
||||
from fabric.widgets.wayland import WaylandWindow as Window
|
||||
from fabric.utils import (
|
||||
@@ -105,13 +105,34 @@ def screenrec_stop():
|
||||
if screenrec_service is not None:
|
||||
screenrec_service.stop()
|
||||
|
||||
|
||||
def _set_all_bars_rounded(rounded: bool):
|
||||
for bar in bar_windows:
|
||||
bar.set_corners_rounded(rounded)
|
||||
|
||||
|
||||
@Application.action()
|
||||
def set_bar_corners_rounded():
|
||||
_set_all_bars_rounded(True)
|
||||
|
||||
|
||||
@Application.action()
|
||||
def set_bar_corners_flat():
|
||||
_set_all_bars_rounded(False)
|
||||
|
||||
|
||||
@Application.action()
|
||||
def toggle_bar_corners():
|
||||
new_state = not any(bar.corners_rounded for bar in bar_windows)
|
||||
_set_all_bars_rounded(new_state)
|
||||
|
||||
# Load CSS - use Stylix if enabled, otherwise use default
|
||||
if STYLIX.get("enable", False):
|
||||
stylix_css_path = get_stylix_css_path()
|
||||
if stylix_css_path:
|
||||
logger.info("[Bar] Using Stylix CSS")
|
||||
app.set_stylesheet_from_file(get_relative_path("styles/main.css"))
|
||||
app.set_stylesheet_from_file(stylix_css_path)
|
||||
app.set_stylesheet_from_file(stylix_css_path, append=True)
|
||||
else:
|
||||
logger.warning("[Bar] Stylix enabled but CSS generation failed, falling back to default")
|
||||
app.set_stylesheet_from_file(get_relative_path("styles/main.css"))
|
||||
|
||||
Reference in New Issue
Block a user