feat(config): wire up wallpapers_dir, osd, window_switcher, global_menu settings

- wallpapers_dir: read from config, fallback ~/Pictures/Wallpapers
- osd: skip show_audio_osd/show_brightness_osd when disabled
- window_switcher: skip show_switcher when disabled
- global_menu_cache_enabled: bypass GTK class cache when false
- global_menu_method: control discovery strategies (auto/hyprland/dbus)

All keys added to constants.py defaults, settings UI, and config.toml
This commit is contained in:
sankalp committed 2026-07-15 10:31:28 +05:45
1 parent e63a2c04a5
commit 9eb62d7ea3
7 files changed
+148 -55

No files matched your search

+15 -1
View File
@@ -11,7 +11,21 @@ CACHE_DIR = str(GLib.get_user_cache_dir()) + f"/{APP_NAME}"
CONFIG_DIR = os.path.expanduser(f"~/.config/{APP_NAME}")
SYSTEM_CACHE_DIR = GLib.get_user_cache_dir()
WALLPAPER_PATH = f"{HOME_DIR}/Pictures/Wallpapers"
def _get_wallpaper_path() -> str:
try:
from services.config import get_config
custom = get_config("wallpapers_dir")
if custom:
return os.path.expanduser(str(custom))
except Exception:
pass
return f"{HOME_DIR}/Pictures/Wallpapers"
WALLPAPER_PATH = _get_wallpaper_path()
WALLPAPER_THUMBS_PATH = f"{WALLPAPER_PATH}/.thumbnails"
WALLPAPERS_THUMBNAILS_SIZE = 200
WALLPAPERS_DIR_DEFAULT = get_relative_path("../assets/wallpapers_example/")
+5 -3
View File
@@ -1,5 +1,4 @@
DEFAULT = {
"wallpapers_dir": "~/Pictures/Wallpapers/",
"dock_enabled": True,
"dock_auto_hide": True,
"dock_always_occluded": False,
@@ -14,6 +13,8 @@ DEFAULT = {
"control_center": True,
"search": True,
"global_menu": True,
"global_menu_method": "hyprland",
"global_menu_cache_enabled": True,
"network": True,
"battery": True,
"notification_center": True,
@@ -23,9 +24,10 @@ DEFAULT = {
"night_light_temperature": 4500,
"custom_mods": True,
"keyboard_layouts": ["us", "np"],
"window_switcher": True,
"switcher_live_preview": True,
"switcher_live_preview_delay_ms": 200,
"osd": True,
"systray_ignore": ["blueman", "network"],
"wallpapers_dir": "~/Pictures/Wallpapers",
"osd": True,
"window_switcher": True,
}
+12 -5
View File
@@ -222,9 +222,15 @@ def executable_gtk_class(executable: str | None) -> str | None:
cache = _load_cache()
key = f"{path}"
cached = cache.get(key)
if cached and cached.get("mtime") == mtime:
return cached.get("class")
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")
needed = _transitive_needed(path)
if GTK4_SONAME in needed:
@@ -234,6 +240,7 @@ def executable_gtk_class(executable: str | None) -> str | None:
else:
klass = None
cache[key] = {"mtime": mtime, "class": klass}
_save_cache(cache)
if use_cache:
cache[key] = {"mtime": mtime, "class": klass}
_save_cache(cache)
return klass
+14 -5
View File
@@ -619,11 +619,20 @@ class GlobalMenuService(Service):
if target_pid <= 0:
return None
strategies = [
self._find_registry,
self._find_registrar,
self._find_fallback_scan,
]
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)
for strategy in strategies:
result = strategy(wm_class, target_pid)
+8
View File
@@ -38,9 +38,17 @@ class OSD(Box):
self.revealer.set_reveal_child(True)
def show_audio_osd(self):
from services.config import get_config
if not get_config("osd", True):
return
self.show_container(self.containers.get("audio"))
def show_brightness_osd(self):
from services.config import get_config
if not get_config("osd", True):
return
self.show_container(self.containers.get("brightness"))
+92 -41
View File
@@ -224,9 +224,8 @@ class SettingsPage(ScrolledWindow):
h_expand=True,
v_expand=True,
propagate_width=True,
propagate_height=True,
propagate_height=False,
min_content_width=600,
min_content_height=500,
**kwargs,
)
self.add(container)
@@ -335,11 +334,6 @@ class SettingsWindow(Gtk.Window):
return SettingsPage(
"General Settings",
[
SettingsRow(
"Wallpapers Directory",
SettingsEntry("wallpapers_dir"),
"Path to your wallpaper collection",
),
SettingsRow(
"Weather Location",
SettingsEntry("weather_location"),
@@ -350,25 +344,25 @@ class SettingsWindow(Gtk.Window):
SettingsList("keyboard_layouts"),
"Manage active keyboard input languages",
),
SettingsRow(
"Window Switcher",
SettingsSwitch("window_switcher"),
"Enable the Alt-Tab window switcher",
),
SettingsRow(
"Items Per Row",
SettingsEntry("window_switcher_items_per_row"),
"Maximum items in window switcher row",
),
SettingsRow(
"Hide Special Workspace",
SettingsSwitch("hide_special_workspace"),
"Don't show special workspace in indicators",
),
SettingsRow(
"OSD",
SettingsSwitch("osd"),
"On-screen display for volume/brightness",
"Night Light Temperature",
SettingsEntry("night_light_temperature"),
"Color temperature in Kelvin (e.g. 4500)",
),
SettingsRow(
"Live Preview",
SettingsSwitch("switcher_live_preview"),
"Show live window previews in switcher",
),
SettingsRow(
"Preview Delay (ms)",
SettingsEntry("switcher_live_preview_delay_ms"),
"Delay before live preview appears",
),
],
)
@@ -406,31 +400,88 @@ class SettingsWindow(Gtk.Window):
)
def _create_panel_page(self):
# panel visibility settings
rows = []
panel_settings = [
("iMac Button", "imac_button"),
("Global Menu", "global_menu"),
("Systray", "systray"),
("Control Center", "control_center"),
("Search", "search"),
("Network", "network"),
("Battery", "battery"),
("Bluetooth", "bluetooth"),
("Date & Time", "date_time"),
("Workspace Indicator", "workspace_indicator"),
("Notification Center", "notification_center"),
]
for label, key in panel_settings:
rows.append(SettingsRow(label, SettingsSwitch(key)))
rows.append(
rows = [
SettingsRow(
"Global Menu",
SettingsSwitch("global_menu"),
"Show application menu in the panel",
),
SettingsRow(
"Menu Method",
SettingsEntry("global_menu_method"),
"Detection method: auto, hyprland, or dbus",
),
SettingsRow(
"Menu Cache",
SettingsSwitch("global_menu_cache_enabled"),
"Cache GTK class detection results",
),
SettingsRow(
"iMac Button",
SettingsSwitch("imac_button"),
),
SettingsRow(
"Systray",
SettingsSwitch("systray"),
),
SettingsRow(
"Control Center",
SettingsSwitch("control_center"),
),
SettingsRow(
"Search",
SettingsSwitch("search"),
),
SettingsRow(
"Network",
SettingsSwitch("network"),
),
SettingsRow(
"Battery",
SettingsSwitch("battery"),
),
SettingsRow(
"Bluetooth",
SettingsSwitch("bluetooth"),
),
SettingsRow(
"Date & Time",
SettingsSwitch("date_time"),
),
SettingsRow(
"Workspace Indicator",
SettingsSwitch("workspace_indicator"),
),
SettingsRow(
"Notification Center",
SettingsSwitch("notification_center"),
),
SettingsRow(
"Custom Mods",
SettingsSwitch("custom_mods"),
"Enable custom Hyprland mods in panel",
),
SettingsRow(
"Window Switcher",
SettingsSwitch("window_switcher"),
"Enable Alt+Tab window switcher",
),
SettingsRow(
"OSD",
SettingsSwitch("osd"),
"Enable on-screen display for volume/brightness",
),
SettingsRow(
"Wallpapers Directory",
SettingsEntry("wallpapers_dir"),
"Path to wallpapers folder",
),
SettingsRow(
"Systray Ignore",
SettingsList("systray_ignore"),
"Icons to hide from the system tray",
)
)
),
]
return SettingsPage("Panel Settings", rows)
+2
View File
@@ -133,6 +133,8 @@ class ApplicationSwitcher(Window):
self._rebuild()
def show_switcher(self) -> None:
if not config().get("window_switcher", True):
return
self._rebuild()
if not self.windows:
return