This commit is contained in:
sankalp committed 2025-06-07 15:11:26 +05:45
1 parent f53b335793
commit e1a85413c2
105 files changed
+6137 -27999

No files matched your search

+33 -26
View File
@@ -1,18 +1,16 @@
import os
import gi
import setproctitle
from fabric import Application
from fabric.utils import get_relative_path, monitor_file, exec_shell_command_async
from fabric.utils import exec_shell_command_async, get_relative_path, monitor_file
from loguru import logger
from modules.bar.bar import Bar, Corners
from modules.launcher.launcher import Launcher
from modules.dock import Dock
from modules.notification_popup import NotificationPopup
from modules.osd import OSD
from config.data import APP_NAME, CACHE_DIR, CONFIG_FILE, DOCK_ICON_SIZE, VERTICAL, APP_NAME_CAP
from config.data import APP_NAME, APP_NAME_CAP, CONFIG_FILE
from modules.corners import Corners
from modules.dock.main import Dock
gi.require_version("GLib", "2.0")
for log in [
"fabric.hyprland.widgets",
@@ -21,23 +19,31 @@ for log in [
]:
logger.disable(log)
if __name__ == "__main__":
setproctitle.setproctitle(APP_NAME)
if not os.path.isfile(CONFIG_FILE):
exec_shell_command_async(f"python {get_relative_path('../config/config.py')}")
bar = Bar()
dock = Dock()
corners = Corners()
osd = OSD()
notif = NotificationPopup()
launcher = Launcher()
bar.launcher = launcher
launcher.bar = bar
config_script_path = get_relative_path("config/config.py")
exec_shell_command_async(f"python {config_script_path}")
app = Application(f"{APP_NAME}", bar, launcher, osd, dock)
current_wallpaper = os.path.expanduser("~/.current.wall")
if not os.path.exists(current_wallpaper):
example_wallpaper = os.path.expanduser(
f"~/.config/{APP_NAME_CAP}/assets/wallpapers_example/example-1.jpg"
)
os.symlink(example_wallpaper, current_wallpaper)
# Load configuration
from config.data import load_config
config = load_config()
corners = Corners()
dock = Dock()
# Set corners visibility based on config
corners_visible = config.get("corners_visible", True)
corners.set_visible(corners_visible)
# Monitor CSS files for changes
css_file = monitor_file(get_relative_path("styles"))
@@ -46,13 +52,14 @@ if __name__ == "__main__":
color_css_file = monitor_file(get_relative_path("./styles/colors.css"))
_ = color_css_file.connect("changed", lambda *_: set_css())
app = Application(
f"{APP_NAME}", dock, corners
) # Make sure corners is added to the app
def set_css():
logger.info("[Main] Applying CSS")
app.set_stylesheet_from_file(get_relative_path("styles/main.css"),
exposed_functions={
"dock_nmargin": lambda: f"margin-bottom: -{32 + DOCK_ICON_SIZE}px;" if not VERTICAL else f"margin-right: -{32 + DOCK_ICON_SIZE}px;",
"dock_sep": lambda: f"margin: 8px 0;" if not VERTICAL else f"margin: 0 8px;",
},)
app.set_stylesheet_from_file(
get_relative_path("main.css"),
)
app.set_css = set_css