diff --git a/src/main.py b/src/main.py index c5fab38..d4d5e02 100644 --- a/src/main.py +++ b/src/main.py @@ -45,7 +45,7 @@ def setup_logger(): ]: logger.disable(log) - _debug = config().get("debug", False) + _debug = config().get("general.debug", False) if not _debug: logger.disable("modus_plugin_builtin_emoji") else: diff --git a/src/services/config.py b/src/services/config.py index 8562d3b..1fdbbd7 100644 --- a/src/services/config.py +++ b/src/services/config.py @@ -47,17 +47,47 @@ class ConfigService: self._initialized = True def get(self, key: str, default: Any = None) -> Any: - return self._config.get(key, default) + """Get a config value. Supports dot notation for nested keys (e.g. 'dock.enabled').""" + parts = key.split(".") + current = self._config + for part in parts: + if isinstance(current, dict): + current = current.get(part) + if current is None: + return default + else: + return default + return current def get_all(self) -> Dict[str, Any]: return self._config.copy() def has_changed(self, key: str, old_config: Dict[str, Any]) -> bool: - return self._config.get(key) != old_config.get(key) + """Check if a config value changed. Supports dot notation for nested keys.""" + + def _get_nested(d, k): + parts = k.split(".") + current = d + for part in parts: + if isinstance(current, dict): + current = current.get(part) + if current is None: + return None + else: + return None + return current + + return _get_nested(self._config, key) != _get_nested(old_config, key) def set(self, key: str, value: Any) -> None: - """Set a config value (local state only).""" - self._config[key] = value + """Set a config value (local state only). Supports dot notation for nested keys.""" + parts = key.split(".") + current = self._config + for part in parts[:-1]: + if part not in current: + current[part] = {} + current = current[part] + current[parts[-1]] = value def save(self) -> None: """Persist current in-memory config to disk.""" diff --git a/src/services/custom_notification.py b/src/services/custom_notification.py index 8a620ab..62c90ac 100644 --- a/src/services/custom_notification.py +++ b/src/services/custom_notification.py @@ -238,9 +238,11 @@ class CachedNotifications(Notifications): on_config_change(self._on_config_changed) def _on_config_changed(self, new_config, old_config): + new_notif = new_config.get("notification", {}) + # If ignored apps changed, remove them from history - if config().has_changed("notification_ignored_apps", old_config): - ignored_apps = new_config.get("notification_ignored_apps", []) + if config().has_changed("notification.ignored_apps", old_config): + ignored_apps = new_notif.get("ignored_apps", []) ids_to_remove = [ cid for cid, cnotif in self._cached_notifications.items() @@ -254,8 +256,8 @@ class CachedNotifications(Notifications): ) # If limited apps changed, prune duplicates - if config().has_changed("notification_limited_apps_history", old_config): - limited_apps = new_config.get("notification_limited_apps_history", []) + if config().has_changed("notification.limited_apps_history", old_config): + limited_apps = new_notif.get("limited_apps_history", []) for app in limited_apps: app_notifs = [ (cid, cnotif.timestamp) @@ -355,7 +357,7 @@ class CachedNotifications(Notifications): ) # Check if this app should be ignored for history (don't cache) - ignored_apps = config().get("notification_ignored_apps", []) + ignored_apps = config().get("notification.ignored_apps", []) if notification.app_name in ignored_apps: # Don't cache notifications from ignored apps, but still allow popup display logger.debug( @@ -395,7 +397,7 @@ class CachedNotifications(Notifications): ) # Handle limited history apps - remove previous notifications from same app - limited_apps = config().get("notification_limited_apps_history", []) + limited_apps = config().get("notification.limited_apps_history", []) if notification.app_name in limited_apps: ids_to_remove = [ cid diff --git a/src/services/keyboard_layout.py b/src/services/keyboard_layout.py index b01bd03..3224f15 100644 --- a/src/services/keyboard_layout.py +++ b/src/services/keyboard_layout.py @@ -94,7 +94,7 @@ class KeyboardLayout(Service): self._set_current(0, emit=False) def _load_layouts_from_config(self) -> list[str]: - layouts = get_config("keyboard_layouts", DEFAULT_LAYOUTS) + layouts = get_config("general.keyboard_layouts", DEFAULT_LAYOUTS) if not isinstance(layouts, list) or not layouts: return list(DEFAULT_LAYOUTS) return [str(layout).strip() for layout in layouts if str(layout).strip()] @@ -199,7 +199,8 @@ class KeyboardLayout(Service): # config changes def _on_config_change(self, new_config, old_config): - new_layouts = new_config.get("keyboard_layouts") + new_general = new_config.get("general", {}) + new_layouts = new_general.get("keyboard_layouts") if not isinstance(new_layouts, list) or not new_layouts: return new_layouts = [str(item).strip() for item in new_layouts if str(item).strip()] diff --git a/src/services/nightlight.py b/src/services/nightlight.py index d37089b..d30e479 100644 --- a/src/services/nightlight.py +++ b/src/services/nightlight.py @@ -5,7 +5,7 @@ from fabric.utils import Gio, GLib, logger from services.config import get_config, on_config_change -_CONFIG_KEY = "night_light_temperature" +_CONFIG_KEY = "panel.night_light_temperature" _DEFAULT_TEMPERATURE = 4500 _NEUTRAL_TEMPERATURE = 6000 _PROFILE_TEMP_RE = re.compile(r"(\d{3,5})") @@ -106,9 +106,13 @@ class NightLightService(Service): self._sync_state() def _on_config_change(self, new_config, old_config): - if new_config.get(_CONFIG_KEY) == old_config.get(_CONFIG_KEY): + new_panel = new_config.get("panel", {}) + old_panel = old_config.get("panel", {}) + new_temp = new_panel.get("night_light_temperature") + old_temp = old_panel.get("night_light_temperature") + if new_temp == old_temp: return - self.set_temperature(_coerce_temperature(new_config.get(_CONFIG_KEY))) + self.set_temperature(_coerce_temperature(new_temp)) def _set_active(self, value: bool): if value != self._active: diff --git a/src/services/weather.py b/src/services/weather.py index 6d049cf..e877056 100644 --- a/src/services/weather.py +++ b/src/services/weather.py @@ -372,7 +372,9 @@ class Weather(Service): self.emit("ready") def _on_config_changed(self, new_config: dict, old_config: dict) -> None: - if new_config.get("weather_location") != old_config.get("weather_location"): + new_general = new_config.get("general", {}) + old_general = old_config.get("general", {}) + if new_general.get("weather_location") != old_general.get("weather_location"): self.refresh() def _start_fetch_thread(self) -> None: @@ -387,7 +389,7 @@ class Weather(Service): from services.config import config - target_loc = config().get("weather_location", "").strip() + target_loc = config().get("general.weather_location", "").strip() # Invalidate location cache if the config target changed if location_data and location_data.get("config_location", "") != target_loc: diff --git a/src/shared/data.py b/src/shared/data.py index 91a1113..5754aba 100644 --- a/src/shared/data.py +++ b/src/shared/data.py @@ -20,7 +20,7 @@ def _get_wallpaper_path() -> str: try: from services.config import get_config - custom = get_config("wallpapers_dir") + custom = get_config("general.wallpapers_dir") if custom: expanded = os.path.expanduser(str(custom)) if not os.path.isabs(expanded): diff --git a/src/utils/constants.py b/src/utils/constants.py index 95d72ad..bfc79b3 100644 --- a/src/utils/constants.py +++ b/src/utils/constants.py @@ -1,34 +1,44 @@ DEFAULT = { - "debug": False, - "dock_enabled": True, - "dock_auto_hide": True, - "dock_always_occluded": False, - "dock_icon_size": 52, - "hide_special_workspace": True, - "dock_hide_special_workspace_apps": True, - "notification_timeout": "5s", - "notification_ignored_apps": ["Hyprshot"], - "notification_limited_apps_history": ["Spotify"], - "imac_button": True, - "systray": True, - "control_center": True, - "search": True, - "global_menu": True, - "network": True, - "battery": True, - "notification_center": True, - "workspace_indicator": True, - "bluetooth": True, - "date_time": True, - "night_light_temperature": 4500, - "notch": True, - "custom_mods": True, - "keyboard_layouts": ["us"], - "switcher_live_preview": True, - "switcher_live_preview_delay_ms": 200, - "systray_ignore": ["blueman", "network"], - "wallpapers_dir": "src/assets/wallpaper_example/", - "osd": True, - "window_switcher": True, - "weather_location": "", + "general": { + "debug": False, + "wallpapers_dir": "src/assets/wallpaper_example/", + "keyboard_layouts": ["us"], + "weather_location": "", + }, + "dock": { + "enabled": True, + "auto_hide": True, + "always_occluded": False, + "icon_size": 52, + "hide_special_workspace_apps": True, + }, + "panel": { + "imac_button": True, + "systray": True, + "systray_ignore": ["blueman", "network"], + "control_center": True, + "search": True, + "global_menu": True, + "network": True, + "battery": True, + "notification_center": True, + "workspace_indicator": True, + "bluetooth": True, + "date_time": True, + "night_light_temperature": 4500, + "notch": True, + "osd": True, + "hide_special_workspace": True, + "custom_mods": True, + }, + "switcher": { + "live_preview": True, + "live_preview_delay_ms": 200, + "window_switcher": True, + }, + "notification": { + "timeout": "5s", + "ignored_apps": ["Hyprshot"], + "limited_apps_history": ["Spotify"], + }, } diff --git a/src/window/dock/canvas.py b/src/window/dock/canvas.py index 9cfa186..5c3d827 100644 --- a/src/window/dock/canvas.py +++ b/src/window/dock/canvas.py @@ -123,7 +123,7 @@ class DockCanvas(Gtk.DrawingArea): self.set_visual(visual) def _base_icon_size(self) -> int: - return int(config().get("dock_icon_size", 52)) + return int(config().get("dock.icon_size", 52)) def _icon_cache_size(self) -> int: return int(self._base_icon_size() * MAX_SCALE) diff --git a/src/window/dock/main.py b/src/window/dock/main.py index 75960de..4c02cd6 100644 --- a/src/window/dock/main.py +++ b/src/window/dock/main.py @@ -69,7 +69,7 @@ class Dock(Window): on_config_change(self._on_config_change) - if config().get("dock_auto_hide", True): + if config().get("dock.auto_hide", True): self._setup_occlusion_signals() self._check_occlusion_deferred() @@ -104,7 +104,7 @@ class Dock(Window): try: if not config().get("dock_auto_hide", True): return False - is_occ = config().get("dock_always_occluded", False) or check_occlusion( + is_occ = config().get("dock.always_occluded", False) or check_occlusion( ("bottom", self.dock_height) ) if is_occ and not self.is_hovered and self.revealer.get_reveal_child(): @@ -119,24 +119,24 @@ class Dock(Window): return False def _on_config_change(self, new_config, old_config) -> None: - if config().has_changed("dock_enabled", old_config): + if config().has_changed("dock.enabled", old_config): self._update_visibility() - if config().has_changed("dock_icon_size", old_config): + if config().has_changed("dock.icon_size", old_config): self.canvas.update_icon_size() - if config().has_changed("dock_auto_hide", old_config): - if new_config.get("dock_auto_hide", True): + if config().has_changed("dock.auto_hide", old_config): + if new_config.get("dock.auto_hide", True): self._setup_occlusion_signals() else: self._disconnect_occlusion_signals() self.revealer.set_reveal_child(True) - if config().has_changed("dock_hide_special_workspace_apps", old_config): + if config().has_changed("dock.hide_special_workspace_apps", old_config): self.canvas._rebuild_model() def _update_visibility(self) -> None: - if config().get("dock_enabled", True): + if config().get("dock.enabled", True): self.show() self.revealer.set_reveal_child(True) else: @@ -154,9 +154,9 @@ class Dock(Window): def delayed_hide(t): if t == self.hide_ticket and not self.is_hovered: - if config().get("dock_auto_hide", True): + if config().get("dock.auto_hide", True): is_occ = config().get( - "dock_always_occluded", False + "dock.always_occluded", False ) or check_occlusion(("bottom", self.dock_height)) if is_occ: self.revealer.set_reveal_child(False) diff --git a/src/window/notification/notification.py b/src/window/notification/notification.py index 6acc116..f72186c 100644 --- a/src/window/notification/notification.py +++ b/src/window/notification/notification.py @@ -837,7 +837,7 @@ class NotificationWidget(Box): """Get the current notification timeout from config manager.""" try: timeout_str = get_config( - "notification_timeout", data.NOTIFICATION_TIMEOUT_STR + "notification.timeout", data.NOTIFICATION_TIMEOUT_STR ) from shared.data import parse_timeout_string @@ -1472,13 +1472,13 @@ class ModusNoti(Window): def _apply_initial_config(self): try: timeout_val = get_config( - "notification_timeout", data.NOTIFICATION_TIMEOUT_STR + "notification.timeout", data.NOTIFICATION_TIMEOUT_STR ) ignored_apps = get_config( - "notification_ignored_apps", data.NOTIFICATION_IGNORED_APPS_HISTORY + "notification.ignored_apps", data.NOTIFICATION_IGNORED_APPS_HISTORY ) limited_apps = get_config( - "notification_limited_apps_history", + "notification.limited_apps_history", data.NOTIFICATION_LIMITED_APPS_HISTORY, ) initial = { @@ -1493,14 +1493,19 @@ class ModusNoti(Window): def _on_config_changed(self, new_config: dict, old_config: dict): try: + new_notif = new_config.get("notification", {}) + old_notif = old_config.get("notification", {}) changes = {} - for key in ( - "notification_timeout", - "notification_ignored_apps", - "notification_limited_apps_history", - ): - if key in new_config and new_config.get(key) != old_config.get(key): - changes[key] = new_config.get(key) + key_map = { + "timeout": "notification_timeout", + "ignored_apps": "notification_ignored_apps", + "limited_apps_history": "notification_limited_apps_history", + } + for new_key, local_key in key_map.items(): + if new_key in new_notif and new_notif.get(new_key) != old_notif.get( + new_key + ): + changes[local_key] = new_notif.get(new_key) if changes: self.update_config(changes) diff --git a/src/window/osd/main.py b/src/window/osd/main.py index 51cbe45..14c291d 100644 --- a/src/window/osd/main.py +++ b/src/window/osd/main.py @@ -40,14 +40,14 @@ class OSD(Box): def show_audio_osd(self): from services.config import get_config - if not get_config("osd", True): + if not get_config("panel.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): + if not get_config("panel.osd", True): return self.show_container(self.containers.get("brightness")) @@ -71,13 +71,13 @@ class OSDWindow(Window): def osd_show_audio(self): from services.config import get_config - if not get_config("osd", True): + if not get_config("panel.osd", True): return self.osd.containers["audio"].update() def osd_show_brightness(self): from services.config import get_config - if not get_config("osd", True): + if not get_config("panel.osd", True): return self.osd.containers["brightness"].update() diff --git a/src/window/panel/components/enhanced_system_tray.py b/src/window/panel/components/enhanced_system_tray.py index c5f3a3e..ebf04de 100644 --- a/src/window/panel/components/enhanced_system_tray.py +++ b/src/window/panel/components/enhanced_system_tray.py @@ -12,7 +12,7 @@ _tracked_items = weakref.WeakSet() def should_hide(item) -> bool: """Check if a tray item should be hidden based on config.""" - ignore_list = get_config("systray_ignore", []) + ignore_list = get_config("panel.systray_ignore", []) if not ignore_list: return False diff --git a/src/window/panel/components/workspace.py b/src/window/panel/components/workspace.py index 0ced7da..c41ac40 100644 --- a/src/window/panel/components/workspace.py +++ b/src/window/panel/components/workspace.py @@ -29,25 +29,19 @@ class WorkspaceIndicator(Box): self._apply_initial_config() def _apply_initial_config(self): - new_value = get_config("hide_special_workspace", True) + new_value = get_config("panel.hide_special_workspace", True) if new_value != self._current_config["hide_special_workspace"]: self._current_config["hide_special_workspace"] = new_value self.update_config({"hide_special_workspace": new_value}) def _on_config_changed(self, new_config: dict, old_config: dict): - if "hide_special_workspace" in new_config and new_config.get( - "hide_special_workspace" - ) != old_config.get("hide_special_workspace"): - self._current_config["hide_special_workspace"] = new_config.get( - "hide_special_workspace", True - ) - self.update_config( - { - "hide_special_workspace": self._current_config[ - "hide_special_workspace" - ] - } - ) + new_panel = new_config.get("panel", {}) + old_panel = old_config.get("panel", {}) + new_val = new_panel.get("hide_special_workspace", True) + old_val = old_panel.get("hide_special_workspace", True) + if new_val != old_val: + self._current_config["hide_special_workspace"] = new_val + self.update_config({"hide_special_workspace": new_val}) def _get_button_factory(self): if self._current_config.get("hide_special_workspace", True): diff --git a/src/window/panel/main.py b/src/window/panel/main.py index a428d6d..33e9b88 100644 --- a/src/window/panel/main.py +++ b/src/window/panel/main.py @@ -253,10 +253,12 @@ class Panel(Window): if config_data is None: config_data = get_config_all() + panel = config_data.get("panel", {}) + # Update indicator visibility directly - battery_visible = config_data.get("battery", True) - network_visible = config_data.get("network", True) - bluetooth_visible = config_data.get("bluetooth", True) + battery_visible = panel.get("battery", True) + network_visible = panel.get("network", True) + bluetooth_visible = panel.get("bluetooth", True) self.battery_indicator.set_visible(battery_visible) self.network_indicator.set_visible(network_visible) @@ -271,16 +273,16 @@ class Panel(Window): self.bluetooth_indicator.update_state() # Center (notch) - if config_data.get("notch", True): + if panel.get("notch", True): self.center_box.children = [self.notch] else: self.center_box.children = [] # Left left_children = [] - if config_data.get("imac_button", True): + if panel.get("imac_button", True): left_children.append(self.imac) - if config_data.get("global_menu", True): + if panel.get("global_menu", True): left_children.append(self.globalmenu) for child in left_children: @@ -289,23 +291,23 @@ class Panel(Window): # Right right_children = [] - if config_data.get("custom_mods", True): + if panel.get("custom_mods", True): right_children.append(self.custom_mods) - if config_data.get("workspace_indicator", True): + if panel.get("workspace_indicator", True): right_children.append(self.workspace_indicator) - if config_data.get("systray", True): + if panel.get("systray", True): right_children.extend([self.tray_revealer, self.chevron_button]) right_children.append(self.indicators) - if config_data.get("search", True): + if panel.get("search", True): right_children.append(self.search) - if config_data.get("control_center", True): + if panel.get("control_center", True): right_children.append(self.control_center_btn) - if config_data.get("date_time", True): + if panel.get("date_time", True): right_children.append(self.datetime_btn) - if config_data.get("notification_center", True): + if panel.get("notification_center", True): right_children.append(self.notification_center_btn) for child in right_children: @@ -321,11 +323,13 @@ class Panel(Window): def _on_config_changed(self, new_config, old_config): logger.debug("Config changed, checking keys...") - keys = { + new_panel = new_config.get("panel", {}) + old_panel = old_config.get("panel", {}) + + panel_keys = { "imac_button", "global_menu", "notch", - "custom_mods", "workspace_indicator", "systray", "battery", @@ -335,8 +339,12 @@ class Panel(Window): "control_center", "date_time", "notification_center", + "custom_mods", + "hide_special_workspace", } - changed_keys = [k for k in keys if new_config.get(k) != old_config.get(k)] + + changed_keys = [k for k in panel_keys if new_panel.get(k) != old_panel.get(k)] + if changed_keys: logger.debug(f"Rebuilding due to changes in: {changed_keys}") self._rebuild_layout_from_config(new_config) diff --git a/src/window/settings/main.py b/src/window/settings/main.py index 4ff925a..103b84f 100644 --- a/src/window/settings/main.py +++ b/src/window/settings/main.py @@ -335,37 +335,37 @@ class SettingsWindow(Gtk.Window): [ SettingsRow( "Debug Mode", - SettingsSwitch("debug"), + SettingsSwitch("general.debug"), "Enable verbose logging for development", ), SettingsRow( "Weather Location", - SettingsEntry("weather_location"), + SettingsEntry("general.weather_location"), "City name for weather updates", ), SettingsRow( "Keyboard Layouts", - SettingsList("keyboard_layouts"), + SettingsList("general.keyboard_layouts"), "Manage active keyboard input languages", ), SettingsRow( "Hide Special Workspace", - SettingsSwitch("hide_special_workspace"), + SettingsSwitch("panel.hide_special_workspace"), "Don't show special workspace in indicators", ), SettingsRow( "Night Light Temperature", - SettingsEntry("night_light_temperature"), + SettingsEntry("panel.night_light_temperature"), "Color temperature in Kelvin (e.g. 4500)", ), SettingsRow( "Live Preview", - SettingsSwitch("switcher_live_preview"), + SettingsSwitch("switcher.live_preview"), "Show live window previews in switcher", ), SettingsRow( "Preview Delay (ms)", - SettingsEntry("switcher_live_preview_delay_ms"), + SettingsEntry("switcher.live_preview_delay_ms"), "Delay before live preview appears", ), ], @@ -377,27 +377,27 @@ class SettingsWindow(Gtk.Window): [ SettingsRow( "Enabled", - SettingsSwitch("dock_enabled"), + SettingsSwitch("dock.enabled"), "Show the application dock", ), SettingsRow( "Auto Hide", - SettingsSwitch("dock_auto_hide"), + SettingsSwitch("dock.auto_hide"), "Hide dock when not in use", ), SettingsRow( "Always Occluded", - SettingsSwitch("dock_always_occluded"), + SettingsSwitch("dock.always_occluded"), "Keep dock behind other windows", ), SettingsRow( "Icon Size", - SettingsEntry("dock_icon_size"), + SettingsEntry("dock.icon_size"), "Size of dock icons in pixels", ), SettingsRow( "Hide Special Apps", - SettingsSwitch("dock_hide_special_workspace_apps"), + SettingsSwitch("dock.hide_special_workspace_apps"), "Hide apps from special workspace in dock", ), ], @@ -407,72 +407,72 @@ class SettingsWindow(Gtk.Window): rows = [ SettingsRow( "Global Menu", - SettingsSwitch("global_menu"), + SettingsSwitch("panel.global_menu"), "Show application menu in the panel", ), SettingsRow( "iMac Button", - SettingsSwitch("imac_button"), + SettingsSwitch("panel.imac_button"), ), SettingsRow( "Systray", - SettingsSwitch("systray"), + SettingsSwitch("panel.systray"), ), SettingsRow( "Control Center", - SettingsSwitch("control_center"), + SettingsSwitch("panel.control_center"), ), SettingsRow( "Search", - SettingsSwitch("search"), + SettingsSwitch("panel.search"), ), SettingsRow( "Network", - SettingsSwitch("network"), + SettingsSwitch("panel.network"), ), SettingsRow( "Battery", - SettingsSwitch("battery"), + SettingsSwitch("panel.battery"), ), SettingsRow( "Bluetooth", - SettingsSwitch("bluetooth"), + SettingsSwitch("panel.bluetooth"), ), SettingsRow( "Date & Time", - SettingsSwitch("date_time"), + SettingsSwitch("panel.date_time"), ), SettingsRow( "Workspace Indicator", - SettingsSwitch("workspace_indicator"), + SettingsSwitch("panel.workspace_indicator"), ), SettingsRow( "Notification Center", - SettingsSwitch("notification_center"), + SettingsSwitch("panel.notification_center"), ), SettingsRow( "Custom Mods", - SettingsSwitch("custom_mods"), + SettingsSwitch("panel.custom_mods"), "Enable custom Hyprland mods in panel", ), SettingsRow( "Window Switcher", - SettingsSwitch("window_switcher"), + SettingsSwitch("switcher.window_switcher"), "Enable Alt+Tab window switcher", ), SettingsRow( "OSD", - SettingsSwitch("osd"), + SettingsSwitch("panel.osd"), "Enable on-screen display for volume/brightness", ), SettingsRow( "Wallpapers Directory", - SettingsEntry("wallpapers_dir"), + SettingsEntry("general.wallpapers_dir"), "Path to wallpapers folder", ), SettingsRow( "Systray Ignore", - SettingsList("systray_ignore"), + SettingsList("panel.systray_ignore"), "Icons to hide from the system tray", ), ] @@ -485,17 +485,17 @@ class SettingsWindow(Gtk.Window): [ SettingsRow( "Timeout", - SettingsEntry("notification_timeout"), + SettingsEntry("notification.timeout"), "How long notifications stay on screen (e.g. 5s)", ), SettingsRow( "Ignored Apps", - SettingsList("notification_ignored_apps"), + SettingsList("notification.ignored_apps"), "Apps that won't show notifications", ), SettingsRow( "Limited History", - SettingsList("notification_limited_apps_history"), + SettingsList("notification.limited_apps_history"), "Apps with only the latest notification shown", ), ], diff --git a/src/window/switcher/main.py b/src/window/switcher/main.py index d5aa56b..a3c4171 100644 --- a/src/window/switcher/main.py +++ b/src/window/switcher/main.py @@ -120,9 +120,9 @@ class ApplicationSwitcher(Window): self.set_visible(False) def _on_config_changed(self, new_config, old_config): - preview_changed = config().has_changed("switcher_live_preview", old_config) + preview_changed = config().has_changed("switcher.live_preview", old_config) if ( - config().has_changed("hide_special_workspace", old_config) + config().has_changed("panel.hide_special_workspace", old_config) or preview_changed ): if preview_changed: @@ -133,7 +133,7 @@ class ApplicationSwitcher(Window): self._rebuild() def show_switcher(self) -> None: - if not config().get("window_switcher", True): + if not config().get("switcher.window_switcher", True): return self._rebuild() if not self.windows: @@ -180,7 +180,7 @@ class ApplicationSwitcher(Window): return pixbuf def _create_item(self) -> _SwitcherItem: - use_preview = config().get("switcher_live_preview", True) + use_preview = config().get("switcher.live_preview", True) if use_preview: app_icon = Image(name="app-switcher-app-icon") @@ -300,7 +300,7 @@ class ApplicationSwitcher(Window): item.button.set_visible(False) return - hide_special = config().get("hide_special_workspace", True) + hide_special = config().get("panel.hide_special_workspace", True) filtered = [] for c in clients: if c.get("hidden", False): @@ -333,7 +333,7 @@ class ApplicationSwitcher(Window): ) self.current_index = idx - use_preview = config().get("switcher_live_preview", True) + use_preview = config().get("switcher.live_preview", True) display = Gdk.Display.get_default() monitor = display.get_primary_monitor() if display else None @@ -430,7 +430,7 @@ class ApplicationSwitcher(Window): self._update_selection() self._addr_to_idx = {w["address"]: i for i, w in enumerate(self.windows)} - use_preview = config().get("switcher_live_preview", True) + use_preview = config().get("switcher.live_preview", True) if use_preview: self._capture_queue = [w["address"] for w in self.windows] self._current_capture_addr = None @@ -574,7 +574,7 @@ class ApplicationSwitcher(Window): item.preview_image.set_from_pixbuf(pixbuf) if self.get_visible() and config().get("switcher_live_preview", True): - fps_delay = config().get("switcher_live_preview_delay_ms", 200) + fps_delay = config().get("switcher.live_preview_delay_ms", 200) invoke_repeater( fps_delay, lambda: ( @@ -604,7 +604,7 @@ class ApplicationSwitcher(Window): ) def _pump_capture_queue(self): - use_preview = config().get("switcher_live_preview", True) + use_preview = config().get("switcher.live_preview", True) if not use_preview: return