refactor(src/window/globalmenu): simplify caching logic and remove dynamic menu method selection

This commit is contained in:
sankalp committed 2026-07-15 19:37:02 +05:45
1 parent 11603990ee
commit 6442161f40
2 files changed
+10 -25

No files matched your search

+5 -11
View File
@@ -223,14 +223,9 @@ def executable_gtk_class(executable: str | None) -> str | None:
cache = _load_cache()
key = f"{path}"
from services.config import get_config
use_cache = get_config("global_menu_cache_enabled", True)
if use_cache:
cached = cache.get(key)
if cached and cached.get("mtime") == mtime:
return cached.get("class")
cached = cache.get(key)
if cached and cached.get("mtime") == mtime:
return cached.get("class")
needed = _transitive_needed(path)
if GTK4_SONAME in needed:
@@ -240,7 +235,6 @@ def executable_gtk_class(executable: str | None) -> str | None:
else:
klass = None
if use_cache:
cache[key] = {"mtime": mtime, "class": klass}
_save_cache(cache)
cache[key] = {"mtime": mtime, "class": klass}
_save_cache(cache)
return klass
+5 -14
View File
@@ -619,20 +619,11 @@ class GlobalMenuService(Service):
if target_pid <= 0:
return None
from services.config import get_config
method = get_config("global_menu_method", "hyprland")
strategies = []
if method in ("hyprland", "auto"):
strategies.extend(
[
self._find_registry,
self._find_registrar,
]
)
if method in ("dbus", "auto"):
strategies.append(self._find_fallback_scan)
strategies = [
self._find_registry,
self._find_registrar,
self._find_fallback_scan,
]
for strategy in strategies:
result = strategy(wm_class, target_pid)