feat: control center

This commit is contained in:
2026-05-05 00:19:10 +02:00
parent 4a271ac4d8
commit 47e104465e
9 changed files with 478 additions and 835 deletions

View File

@@ -25,10 +25,12 @@ from .modules.launcher.clipboard import ClipboardMenu
from .modules.launcher.power import PowerMenu
from .modules.launcher.screenrec import ScreenrecMenu
from .modules.launcher.screenshot import ScreenshotMenu
from .modules.notification_center import NotificationCenter
from .modules.calendar import CalendarService
from .modules.control_center import ControlCenter
from .modules.notifications import NotificationToasts
from .modules.stylix import get_stylix_css_path
from .config import NOTIFICATIONS, POWER, SCREENREC, STYLIX
from .modules.vinyl import VinylButton
from .config import CALENDAR, NOTIFICATIONS, POWER, SCREENREC, STYLIX, VINYL
from .services.fenster import get_i3_connection
from .services.notification_history import NotificationHistoryService
from .services.screenrec import ScreenrecService
@@ -57,7 +59,6 @@ if SCREENREC.get("enable", False):
notifications_service: Notifications | None = None
notification_history: NotificationHistoryService | None = None
notification_toasts: NotificationToasts | None = None
notification_center: NotificationCenter | None = None
if NOTIFICATIONS.get("enable", False):
notifications_service = Notifications()
notification_history = NotificationHistoryService(
@@ -73,8 +74,18 @@ if NOTIFICATIONS.get("enable", False):
width=NOTIFICATIONS.get("width", 360),
timeout_ms=NOTIFICATIONS.get("timeout_ms", 10_000),
)
notification_center = NotificationCenter(
notification_history,
vinyl_button: VinylButton | None = VinylButton() if VINYL.get("enable", False) else None
calendar_service: CalendarService | None = (
CalendarService(update_interval=120000) if CALENDAR.get("enable", True) else None
)
control_center: ControlCenter | None = None
if notification_history is not None:
control_center = ControlCenter(
history=notification_history,
calendar_service=calendar_service,
vinyl_button=vinyl_button,
monitor=0,
width=NOTIFICATIONS.get("center_width", 380),
)
@@ -87,8 +98,8 @@ if screenrec_menu is not None:
_app_windows.append(screenrec_menu)
if notification_toasts is not None:
_app_windows.append(notification_toasts)
if notification_center is not None:
_app_windows.append(notification_center)
if control_center is not None:
_app_windows.append(control_center)
app = Application("sims", *_app_windows)
@@ -148,9 +159,9 @@ def screenrec_stop():
@Application.action()
def toggle_notification_center():
if notification_center is not None:
notification_center.toggle()
def toggle_control_center():
if control_center is not None:
control_center.toggle()
def _set_all_bars_rounded(rounded: bool):
@@ -210,8 +221,7 @@ def spawn_bars():
tray=tray if i == 0 else None,
monitor=i,
screenrec_service=screenrec_service if i == 0 else None,
notification_history=notification_history if i == 0 else None,
notification_center=notification_center if i == 0 else None,
control_center=control_center if i == 0 else None,
)
bar_windows.append(bar)
if i == 0 and bar.notmuch: