Files
Modus/main.py
T
sankalp 34cfb2f49e feat(root): add keyboard layouts, OSDWindow, and update services & utilities
Introduce a new OSDWindow implementation, expose keyboard layout configuration, and modernize dependency handling and helper utilities.

- **New Features**
  - Added `keyboard_layouts` list (`us`, `np`) to `config.json`
  - Created `OSDWindow` class and updated `main.py` to use it
  - Introduced new service modules (`battery`, `brightness`, `capslock`, `network`, `mpris`, `todo`, `modus`) and expanded `services/__init__.py`
  - Added `CommandResult` and `run_command` helper in `utils/functions.py`

- **Enhancements**
  - Upgraded numerous dependencies to newer versions and switched `fabric` to a git source
  - Replaced bare `except:` with `except Exception:` in `WiFiPasswordDialog`
  - Improved type hints (`NamedTuple`, `TypeVar`) and refactored JSON file helpers
  - Added property notifications for battery percentage, state, and presence

- **Bug Fixes**
  - Fixed incorrect return type annotation in `read_json_file`
  - Corrected tick‑handler logic to avoid double registration
  - Properly notify listeners on battery property changes
  - Ensured proper exception handling and cleanup in utility functions
2026-03-23 23:33:53 +05:45

60 lines
1.4 KiB
Python

from fabric import Application
from fabric.utils import get_relative_path, logger, monitor_file
from config.data import APP_NAME
from modules.desktop.widget import Deskwidgets
from modules.launcher.main import Launcher
from modules.notification.notification import ModusNoti
from modules.osd.main import OSDWindow
from modules.panel.main import Panel
from modules.switcher import ApplicationSwitcher
from utils.functions import set_process_name
for log in [
"fabric.hyprland.widgets",
"fabric.audio.service",
"fabric.bluetooth.service",
"services.network",
"utils.wayland",
]:
logger.disable(log)
if __name__ == "__main__":
set_process_name(APP_NAME)
# Load configuration
from config.data import load_config
# About().toggle(None)
config = load_config()
switcher = ApplicationSwitcher()
panel = Panel()
modusnoti = ModusNoti()
launcher = Launcher()
deskwidget = Deskwidgets()
osd = OSDWindow()
# Monitor CSS files for changes
css_file = monitor_file(get_relative_path("styles"))
_ = css_file.connect("changed", lambda *_: set_css())
app = Application(
f"{APP_NAME}",
panel,
modusnoti,
deskwidget,
osd,
launcher,
switcher,
)
def set_css():
app.set_stylesheet_from_file(
get_relative_path("styles/main.css"),
)
app.set_css = set_css
app.set_css()
app.run()