feat: add app launcher

This commit is contained in:
2026-05-03 21:42:30 +02:00
parent 60757ee336
commit 7bdf23001f
18 changed files with 665 additions and 57 deletions

View File

@@ -20,9 +20,12 @@ from fabric.utils import (
)
from .modules.bar import StatusBar
from .modules.window_fuzzy import FuzzyWindowFinder
from .modules.launcher.apps import AppLauncher
from .modules.launcher.screenrec import ScreenrecMenu
from .modules.stylix import get_stylix_css_path
from .config import STYLIX
from .config import SCREENREC, STYLIX
from .services.fenster import get_i3_connection
from .services.screenrec import ScreenrecService
tray = SystemTray(name="system-tray", spacing=4)
@@ -30,11 +33,23 @@ i3 = get_i3_connection()
dummy = Window(visible=False)
finder = FuzzyWindowFinder()
app_launcher = AppLauncher()
screenrec_service: ScreenrecService | None = None
screenrec_menu = None
if SCREENREC.get("enable", False):
screenrec_service = ScreenrecService(
output_dir=SCREENREC.get("output_dir", "~/Videos/wl-screenrec")
)
screenrec_menu = ScreenrecMenu(screenrec_service)
bar_windows = []
notmuch_widget = None
app = Application("sims", dummy, finder)
_app_windows = [dummy, finder, app_launcher]
if screenrec_menu is not None:
_app_windows.append(screenrec_menu)
app = Application("sims", *_app_windows)
@Application.action()
@@ -42,19 +57,46 @@ def open_finder():
finder.show()
@Application.action()
def open_app_launcher():
app_launcher.show()
@Application.action()
def refresh_notmuch():
if notmuch_widget is not None:
notmuch_widget.service.update_unread_count()
@Application.action()
def open_screenrec_menu():
if screenrec_menu is not None:
screenrec_menu.show()
@Application.action()
def screenrec_start_monitor():
if screenrec_service is not None:
screenrec_service.start_monitor("videos")
@Application.action()
def screenrec_start_region():
if screenrec_service is not None:
screenrec_service.start_region("videos")
@Application.action()
def screenrec_stop():
if screenrec_service is not None:
screenrec_service.stop()
# 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")
# Load base styles first for structure
app.set_stylesheet_from_file(get_relative_path("styles/main.css"))
# Then apply Stylix theme colors
app.set_stylesheet_from_file(stylix_css_path)
else:
logger.warning("[Bar] Stylix enabled but CSS generation failed, falling back to default")
@@ -81,7 +123,12 @@ def spawn_bars():
for i, output in enumerate(outputs):
output_name = output.get("name", f"Unknown-{i}")
bar = StatusBar(display=output_name, tray=tray if i == 0 else None, monitor=i)
bar = StatusBar(
display=output_name,
tray=tray if i == 0 else None,
monitor=i,
screenrec_service=screenrec_service if i == 0 else None,
)
bar_windows.append(bar)
if i == 0 and bar.notmuch:
notmuch_widget = bar.notmuch