refactor(modules): Clean up imports and centralize utilities- Enhancements:

- Remove redundant gi.repository imports
  - Move common utilities (GLib, GObject, logger, os) into fabric.utils
  - Centralize GLib usage and reduce namespace pollution
This commit is contained in:
sankalp committed 2026-04-10 00:10:40 +05:45
1 parent 9847bdf884
commit adb87456c7
12 files changed
+25 -41

No files matched your search

+1 -1
View File
@@ -5,7 +5,7 @@ from fabric.widgets.box import Box
from fabric.widgets.entry import Entry
from fabric.widgets.scrolledwindow import ScrolledWindow
from fabric.widgets.wayland import WaylandWindow as Window
from gi.repository import Gdk, GLib
from fabric.utils import Gdk, GLib
from modules.launcher.plugin_manager import PluginManager
from modules.launcher.result import Result
+2 -3
View File
@@ -6,9 +6,10 @@ from pathlib import Path
from typing import Dict, List, Optional
from urllib.parse import urlparse
from fabric.utils import GLib
from fabric.utils.helpers import get_relative_path
from thefuzz import fuzz
from fabric.utils.helpers import get_relative_path
from modules.launcher.plugin_base import PluginBase
from modules.launcher.result import Result
@@ -739,7 +740,6 @@ class BookmarksPlugin(PluginBase):
# Reset to trigger word with space
try:
from gi.repository import GLib
def reset_and_refresh():
# Set text to trigger word
@@ -772,7 +772,6 @@ class BookmarksPlugin(PluginBase):
# Trigger a search to refresh results
try:
from gi.repository import GLib
def refresh():
self._launcher_instance._perform_search(current_text)
+1 -2
View File
@@ -7,7 +7,7 @@ import time
from concurrent.futures import ThreadPoolExecutor
from typing import Dict, List, Optional
from gi.repository import GdkPixbuf, GLib
from fabric.utils import GdkPixbuf, GLib
from modules.launcher.plugin_base import PluginBase
from modules.launcher.result import Result
@@ -85,7 +85,6 @@ class ClipboardPlugin(PluginBase):
def _force_launcher_refresh(self):
"""Force the launcher to refresh its results."""
try:
from gi.repository import GLib
def trigger_refresh():
try:
+2 -5
View File
@@ -5,7 +5,8 @@ import time
from pathlib import Path
from typing import Dict, List, Optional
from fabric.utils import get_relative_path
from fabric.utils import GLib, get_relative_path
from modules.launcher.plugin_base import PluginBase
from modules.launcher.result import Result
from services.auth import (
@@ -99,8 +100,6 @@ class OTPPlugin(PluginBase):
try:
import gc
from gi.repository import GLib
def do_update():
try:
for obj in gc.get_objects():
@@ -230,8 +229,6 @@ class OTPPlugin(PluginBase):
def _trigger_refresh(self):
"""Trigger launcher refresh to return to default OTP view."""
try:
from gi.repository import GLib
# Use a small delay to ensure the action completes first
def trigger_refresh():
try:
+2 -2
View File
@@ -7,7 +7,8 @@ from datetime import datetime
from pathlib import Path
from typing import Dict, List, Optional
from fabric.utils import get_relative_path
from fabric.utils import GLib, get_relative_path
from modules.launcher.plugin_base import PluginBase
from modules.launcher.result import Result
@@ -676,7 +677,6 @@ class PasswordPlugin(PluginBase):
# Trigger a search to refresh results
try:
from gi.repository import GLib
def refresh():
self._launcher_instance._perform_search(current_text)
+1 -6
View File
@@ -1,18 +1,14 @@
import colorsys
import hashlib
import json
import os
import random
import re
import threading
import time
from typing import Dict, List, Optional
from loguru import logger
from gi.repository import GdkPixbuf
import config.data as data
from fabric.utils.helpers import exec_shell_command_async
from fabric.utils import exec_shell_command_async, GdkPixbuf, logger, os, GLib
from modules.launcher.plugin_base import PluginBase
from modules.launcher.result import Result
@@ -123,7 +119,6 @@ class WallpaperPlugin(PluginBase):
"""Clear the launcher search query and reset to trigger."""
try:
# Try to access the launcher through the fabric Application
from gi.repository import GLib
from fabric import Application
+1 -1
View File
@@ -1,7 +1,7 @@
from dataclasses import dataclass
from typing import Any, Callable, Optional
from gi.repository import GdkPixbuf, Gtk
from fabric.utils import GdkPixbuf, Gtk
@dataclass