diff --git a/src/shared/data.py b/src/shared/data.py index 4399734..75d5184 100644 --- a/src/shared/data.py +++ b/src/shared/data.py @@ -1,38 +1,18 @@ from fabric.utils import logger -from fabric.utils import Gdk, GLib, get_relative_path, os +from fabric.utils import GLib, get_relative_path, os from utils.functions import parse_timeout_string from utils.utils import toml_file APP_NAME = "modus1" -APP_NAME_CAP = "Modus" - CACHE_DIR = str(GLib.get_user_cache_dir()) + f"/{APP_NAME}" -USERNAME = os.getlogin() -HOSTNAME = os.uname().nodename -HOME_DIR = GLib.get_home_dir() CONFIG_DIR = os.path.expanduser(f"~/.config/{APP_NAME}") - -def _get_screen_dimensions(): - try: - screen = Gdk.Screen.get_default() - if screen: - return screen.get_width(), screen.get_height() - except Exception: - pass - return 1920, 1080 - - -CURRENT_WIDTH, CURRENT_HEIGHT = _get_screen_dimensions() - - WALLPAPERS_DIR_DEFAULT = get_relative_path("../assets/wallpapers_example/") CONFIG_FILE = toml_file("config.toml") -MATUGEN_STATE_FILE = os.path.join(CONFIG_DIR, "matugen") def load_config(): @@ -58,50 +38,7 @@ def load_config(): return config -def _load_config_from_toml(): - """Load config dict from config.toml (module-level helper).""" - if os.path.exists(CONFIG_FILE): - try: - import tomlkit - - with open(CONFIG_FILE, "r") as f: - return dict(tomlkit.load(f)) - except Exception as e: - logger.error(f"Error loading config: {e}") - return {} - - -config = _load_config_from_toml() -wallpapers_dir_from_config = config.get("wallpapers_dir", WALLPAPERS_DIR_DEFAULT) -WALLPAPERS_DIR = os.path.expanduser(wallpapers_dir_from_config) -DOCK_POSITION = config.get("dock_position", "Bottom") -DOCK_ENABLED = config.get("dock_enabled", True) -DOCK_AUTO_HIDE = config.get("dock_auto_hide", True) -DOCK_ALWAYS_OCCLUDED = config.get("dock_always_occluded", False) -DOCK_ICON_SIZE = config.get("dock_icon_size", 60) -WINDOW_SWITCHER_ITEMS_PER_ROW = config.get("window_switcher_items_per_row", 10) -HIDE_SPECIAL_WORKSPACE = config.get("hide_special_workspace", True) -DOCK_HIDE_SPECIAL_WORKSPACE_APPS = config.get("dock_hide_special_workspace_apps", True) - -NOTIFICATION_TIMEOUT_STR = config.get("notification_timeout", "5s") +NOTIFICATION_TIMEOUT_STR = "5s" NOTIFICATION_TIMEOUT = parse_timeout_string(NOTIFICATION_TIMEOUT_STR) -NOTIFICATION_IGNORED_APPS_HISTORY = config.get( - "notification_ignored_apps_history", ["Hyprshot"] -) -NOTIFICATION_LIMITED_APPS_HISTORY = config.get( - "notification_limited_apps_history", ["Spotify"] -) - -PANEL_COMPONENTS_VISIBILITY = { - "imac_button": config.get("imac_button", True), - "systray": config.get("systray", True), - "control_center": config.get("control_center", True), - "search": config.get("search", True), - "global_menu": config.get("global_menu", True), - "network": config.get("network", True), - "battery": config.get("battery", True), - "notification_center": config.get("notification_center", True), - "workspace_indicator": config.get("workspace_indicator", True), - "bluetooth": config.get("bluetooth", True), - "date_time": config.get("date_time", True), -} +NOTIFICATION_IGNORED_APPS_HISTORY = ["Hyprshot"] +NOTIFICATION_LIMITED_APPS_HISTORY = ["Spotify"] diff --git a/src/shared/dialogs/wifi_password_dialog.py b/src/shared/dialogs/wifi_password_dialog.py index b1e8327..6cf1152 100644 --- a/src/shared/dialogs/wifi_password_dialog.py +++ b/src/shared/dialogs/wifi_password_dialog.py @@ -276,9 +276,6 @@ class WiFiPasswordDialog(Window): except Exception: return False - def get_password(self): - return self.password_entry.get_text() - def destroy_dialog(self): self.hide() self.destroy() diff --git a/src/shared/widgets/animator.py b/src/shared/widgets/animator.py index 244d129..03709ce 100644 --- a/src/shared/widgets/animator.py +++ b/src/shared/widgets/animator.py @@ -19,13 +19,6 @@ def lerp(start: float, end: float, progress: float) -> float: return start + (end - start) * progress -@lru_cache(maxsize=512) -def steps(n: int, progress: float, start_jump: bool = False) -> float: - if start_jump: - return min(int(progress * n), n - 1) / (n - 1) if n > 1 else 0.0 - return min(int(progress * n + 1e-10), n) / n - - @lru_cache(maxsize=512) def cubic_bezier( x1: float, y1: float, x2: float, y2: float, progress: float, epsilon=1e-6 diff --git a/src/shared/widgets/circle_image.py b/src/shared/widgets/circle_image.py index 8488219..1dee90b 100644 --- a/src/shared/widgets/circle_image.py +++ b/src/shared/widgets/circle_image.py @@ -96,24 +96,3 @@ class CircleImage(Gtk.DrawingArea, Widget): Gdk.cairo_set_source_pixbuf(ctx, self._image, 0, 0) ctx.paint() ctx.restore() - - def set_image_from_file(self, new_image_file: str): - if not new_image_file: - return - pixbuf = GdkPixbuf.Pixbuf.new_from_file(new_image_file) - self._orig_image = pixbuf - self._image = self._process_image(pixbuf) - self.queue_draw() - - def set_image_from_pixbuf(self, pixbuf: GdkPixbuf.Pixbuf): - if not pixbuf: - return - self._orig_image = pixbuf - self._image = self._process_image(pixbuf) - self.queue_draw() - - def set_image_size(self, size: int): - self.size = size - if self._orig_image: - self._image = self._process_image(self._orig_image) - self.queue_draw() diff --git a/src/shared/widgets/customrevealer.py b/src/shared/widgets/customrevealer.py index 2ca10a3..8d06d1b 100644 --- a/src/shared/widgets/customrevealer.py +++ b/src/shared/widgets/customrevealer.py @@ -122,9 +122,6 @@ class SlideRevealer(Gtk.Overlay): if not self._revealed: self.child.hide() - def _get_container_for_redraw(self): - return self - def _get_dimensions(self): if self.fixed_size: return self.fixed_size @@ -132,18 +129,6 @@ class SlideRevealer(Gtk.Overlay): alloc = self.child.get_allocation() return alloc.width, alloc.height - def _get_offscreen_pos_cached(self): - w, h = self._cached_dimensions - if self.direction == "left": - return -w, 0 - elif self.direction == "right": - return w, 0 - elif self.direction == "top": - return 0, -h - elif self.direction == "bottom": - return 0, h - return 0, 0 - def _get_position_at_progress_cached(self, progress): w, h = self._cached_dimensions if self._show_animation: @@ -171,18 +156,6 @@ class SlideRevealer(Gtk.Overlay): def set_slide_direction(self, direction): self.direction = direction - def is_revealed(self): - return self._revealed - - def is_animating(self): - return self.animator.playing - - def get_child_revealed(self): - return self._revealed - - def stop_animation(self): - self.animator.stop() - def destroy(self): self.stop_animation() super().destroy() diff --git a/src/shared/widgets/flat_scale.py b/src/shared/widgets/flat_scale.py index 34e246a..4df4711 100644 --- a/src/shared/widgets/flat_scale.py +++ b/src/shared/widgets/flat_scale.py @@ -13,18 +13,6 @@ from shared.widgets.animator import Animator, ease_in, ease_in_out, ease_out # ------------------------------------------------------------------ # -def _ease_out_expo(t: float) -> float: - if t >= 1.0: - return 1.0 - return 1.0 - pow(2.0, -10.0 * t) - - -def _ease_in_expo(t: float) -> float: - if t <= 0.0: - return 0.0 - return pow(2.0, 10.0 * t - 10.0) - - def _draw_rounded_rect(cr, x, y, w, h, r): r = min(r, w / 2, h / 2) if r <= 0: diff --git a/src/shared/widgets/smooth_switch.py b/src/shared/widgets/smooth_switch.py index 77c3fe4..bbaf206 100644 --- a/src/shared/widgets/smooth_switch.py +++ b/src/shared/widgets/smooth_switch.py @@ -26,7 +26,6 @@ class SmoothSwitch(Gtk.DrawingArea): self._width = width self._height = height self._on_user_toggle = on_user_toggle - self._anim_value = 1.0 if active else 0.0 self.set_size_request(width, height) self.set_hexpand(h_expand) diff --git a/src/shared/window/dropdown.py b/src/shared/window/dropdown.py index 892686a..2b3f404 100644 --- a/src/shared/window/dropdown.py +++ b/src/shared/window/dropdown.py @@ -54,10 +54,6 @@ class ModusDropdown(AppletWindow): self.children = [self.event_box] self.add_keybinding("escape", self.hide_dropdown) - def toggle_dropdown(self, button, parent=None): - self.toggle() - modus_service.current_dropdown = self.id if self.is_visible() else None - def hide_dropdown(self, *_): if self.is_visible(): GLib.idle_add(lambda: self.hide()) @@ -68,18 +64,6 @@ class ModusDropdown(AppletWindow): elif str(modus_service.current_dropdown) == str(self.id): modus_service.current_dropdown = None - def hide_via_mousecapture(self): - self.hide() - - def on_cursor_enter(self, *_): - self.show() - - def on_cursor_leave(self, *_): - if self.is_hovered(): - return - self.hide() - modus_service.dropdowns_hide = not modus_service.dropdowns_hide - def destroy(self): """Clean up resources and global references""" global dropdowns diff --git a/src/shared/window/popup_win.py b/src/shared/window/popup_win.py index 727ad1b..3484764 100644 --- a/src/shared/window/popup_win.py +++ b/src/shared/window/popup_win.py @@ -33,8 +33,6 @@ class PopupWindow(WaylandWindow): self._pointing_widget = pointing_to self._base_margin = self.extract_margin(margin) self.margin = self._base_margin.values() - self._initial_position = True - self.connect("notify::visible", self.do_update_handlers) def get_coords_for_widget(self, widget: Gtk.Widget) -> tuple[int, int]: @@ -86,7 +84,6 @@ class PopupWindow(WaylandWindow): GLib.timeout_add(10, self._do_delayed_reposition) def _do_delayed_reposition(self): - self._initial_position = True self.do_reposition(self.do_calculate_edges()) return False @@ -190,4 +187,3 @@ class PopupWindow(WaylandWindow): if tuple(self.margin) != tuple(new_margin): self.margin = new_margin - self._initial_position = False