From 4203148cabb74abfb17e5c02f3b76c28b52601e7 Mon Sep 17 00:00:00 2001 From: bbedward Date: Thu, 18 Jun 2026 18:42:33 -0400 Subject: [PATCH] ci: add settings index check to pre-commit --- .pre-commit-config.yaml | 8 + .../translations/extract_settings_index.py | 4 +- .../translations/settings_search_index.json | 374 ++++++++---------- 3 files changed, 174 insertions(+), 212 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index dbc05ad9..ef7c6ffe 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -20,6 +20,14 @@ repos: language: system files: ^core/.*\.(go|mod|sum)$ pass_filenames: false + - repo: local + hooks: + - id: settings-search-index + name: settings search index is up to date + entry: bash -c 'python3 quickshell/translations/extract_settings_index.py >/dev/null || exit 1; if ! git diff --exit-code -- quickshell/translations/settings_search_index.json; then echo "settings_search_index.json is out of date; run quickshell/translations/extract_settings_index.py and stage the result" >&2; exit 1; fi' + language: system + files: ^quickshell/(Modules/Settings/.*\.qml|Modals/Settings/SettingsSidebar\.qml|translations/extract_settings_index\.py)$ + pass_filenames: false - repo: local hooks: - id: no-console-in-qml diff --git a/quickshell/translations/extract_settings_index.py b/quickshell/translations/extract_settings_index.py index 93080dc9..cfe4110f 100755 --- a/quickshell/translations/extract_settings_index.py +++ b/quickshell/translations/extract_settings_index.py @@ -509,7 +509,7 @@ def extract_settings_index(root_dir): all_entries = [] seen_keys = set() - for qml_file in settings_dir.glob("*.qml"): + for qml_file in sorted(settings_dir.glob("*.qml")): if qml_file.name not in TAB_INDEX_MAP: continue @@ -556,7 +556,7 @@ def main(): all_entries = tab_entries + settings_entries - all_entries.sort(key=lambda x: (x["tabIndex"], x["label"])) + all_entries.sort(key=lambda x: (x["tabIndex"], x["label"], x["section"])) output_path = script_dir / "settings_search_index.json" with open(output_path, "w", encoding="utf-8") as f: diff --git a/quickshell/translations/settings_search_index.json b/quickshell/translations/settings_search_index.json index c4f7e4c2..47a69ea3 100644 --- a/quickshell/translations/settings_search_index.json +++ b/quickshell/translations/settings_search_index.json @@ -4585,6 +4585,27 @@ ], "description": "Automatically lock the screen when DMS starts" }, + { + "section": "lockBeforeSuspend", + "label": "Lock before suspend", + "tabIndex": 11, + "category": "Lock Screen", + "keywords": [ + "automatic", + "automatically", + "before", + "lock", + "login", + "password", + "prepares", + "screen", + "security", + "sleep", + "suspend", + "system" + ], + "description": "Automatically lock the screen when the system prepares to suspend" + }, { "section": "lockScreenNotificationMode", "label": "Notification Display", @@ -4871,29 +4892,6 @@ ], "icon": "info" }, - { - "section": "popoutAnimationSpeed", - "label": "%1 Animation Speed", - "tabIndex": 14, - "category": "Typography & Motion", - "keywords": [ - "animate", - "animation", - "animations", - "custom", - "duration", - "fonts", - "motion", - "popout", - "speed", - "sync", - "text", - "transition", - "typography" - ], - "icon": "open_in_new", - "description": "%1 custom animation duration" - }, { "section": "modalAnimationSpeed", "label": "%1 Animation Speed", @@ -4917,6 +4915,29 @@ "icon": "web_asset", "description": "%1 custom animation duration" }, + { + "section": "popoutAnimationSpeed", + "label": "%1 Animation Speed", + "tabIndex": 14, + "category": "Typography & Motion", + "keywords": [ + "animate", + "animation", + "animations", + "custom", + "duration", + "fonts", + "motion", + "popout", + "speed", + "sync", + "text", + "transition", + "typography" + ], + "icon": "open_in_new", + "description": "%1 custom animation duration" + }, { "section": "customAnimationDuration", "label": "Animation Duration", @@ -4985,27 +5006,6 @@ ], "icon": "auto_awesome_motion" }, - { - "section": "popoutCustomAnimationDuration", - "label": "Custom Duration", - "tabIndex": 14, - "category": "Typography & Motion", - "keywords": [ - "animate", - "animation", - "animations", - "custom", - "duration", - "fonts", - "motion", - "popout", - "speed", - "text", - "transition", - "typography" - ], - "description": "%1 custom animation duration" - }, { "section": "modalCustomAnimationDuration", "label": "Custom Duration", @@ -5027,6 +5027,27 @@ ], "description": "%1 custom animation duration" }, + { + "section": "popoutCustomAnimationDuration", + "label": "Custom Duration", + "tabIndex": 14, + "category": "Typography & Motion", + "keywords": [ + "animate", + "animation", + "animations", + "custom", + "duration", + "fonts", + "motion", + "popout", + "speed", + "text", + "transition", + "typography" + ], + "description": "%1 custom animation duration" + }, { "section": "fontScale", "label": "Font Scale", @@ -6540,30 +6561,6 @@ "icon": "refresh", "description": "How often the server polls for new updates." }, - { - "section": "powerAdvanced", - "label": "Advanced", - "tabIndex": 21, - "category": "Power & Sleep", - "keywords": [ - "actually", - "advanced", - "battery", - "changes", - "charge", - "charging", - "does", - "energy", - "limit", - "percentage", - "power", - "shutdown", - "sleep", - "suspend" - ], - "icon": "tune", - "description": "Note: this only changes the percentage, it does not actually limit charging." - }, { "section": "lockTimeout", "label": "Automatically lock after", @@ -6584,28 +6581,6 @@ "timeout" ] }, - { - "section": "batteryChargeLimit", - "label": "Battery Charge Limit", - "tabIndex": 21, - "category": "Power & Sleep", - "keywords": [ - "actually", - "battery", - "changes", - "charge", - "charging", - "does", - "energy", - "limit", - "percentage", - "power", - "shutdown", - "sleep", - "suspend" - ], - "description": "Note: this only changes the percentage, it does not actually limit charging." - }, { "section": "customPowerActions", "label": "Custom Power Actions", @@ -6773,27 +6748,6 @@ "icon": "schedule", "description": "Gradually fade the screen before locking with a configurable grace period" }, - { - "section": "lockBeforeSuspend", - "label": "Lock before suspend", - "tabIndex": 21, - "category": "Power & Sleep", - "keywords": [ - "automatically", - "before", - "energy", - "lock", - "power", - "prepares", - "screen", - "security", - "shutdown", - "sleep", - "suspend", - "system" - ], - "description": "Automatically lock the screen when the system prepares to suspend" - }, { "section": "fadeToLockGracePeriod", "label": "Lock fade grace period", @@ -8358,28 +8312,6 @@ ], "icon": "line_start" }, - { - "section": "niriLayoutBorderSize", - "label": "Border Size", - "tabIndex": 37, - "category": "Personalization", - "keywords": [ - "appearance", - "border", - "custom", - "customize", - "focus", - "niri", - "override", - "personal", - "personalization", - "ring", - "size", - "width", - "window" - ], - "description": "Width of window border and focus ring" - }, { "section": "hyprlandLayoutBorderSize", "label": "Border Size", @@ -8421,6 +8353,28 @@ ], "description": "Width of window border" }, + { + "section": "niriLayoutBorderSize", + "label": "Border Size", + "tabIndex": 37, + "category": "Personalization", + "keywords": [ + "appearance", + "border", + "custom", + "customize", + "focus", + "niri", + "override", + "personal", + "personalization", + "ring", + "size", + "width", + "window" + ], + "description": "Width of window border and focus ring" + }, { "section": "hyprlandLayout", "label": "Hyprland Layout Overrides", @@ -8520,27 +8474,6 @@ "description": "Use custom gaps instead of bar spacing", "conditionKey": "isNiri" }, - { - "section": "niriLayoutBorderSizeEnabled", - "label": "Override Border Size", - "tabIndex": 37, - "category": "Personalization", - "keywords": [ - "appearance", - "border", - "custom", - "customize", - "focus", - "niri", - "override", - "personal", - "personalization", - "ring", - "size", - "width" - ], - "description": "Use custom border/focus-ring width" - }, { "section": "hyprlandLayoutBorderSizeEnabled", "label": "Override Border Size", @@ -8579,31 +8512,25 @@ "description": "Use custom border size" }, { - "section": "niriLayoutRadiusOverrideEnabled", - "label": "Override Corner Radius", + "section": "niriLayoutBorderSizeEnabled", + "label": "Override Border Size", "tabIndex": 37, "category": "Personalization", "keywords": [ "appearance", - "colors", - "colour", - "corner", - "corners", + "border", "custom", "customize", - "look", + "focus", "niri", "override", "personal", "personalization", - "radius", - "round", - "rounded", - "style", - "theme", - "window" + "ring", + "size", + "width" ], - "description": "Use custom window radius instead of theme radius" + "description": "Use custom border/focus-ring width" }, { "section": "hyprlandLayoutRadiusOverrideEnabled", @@ -8662,30 +8589,31 @@ "description": "Use custom window radius instead of theme radius" }, { - "section": "niriLayoutGapsOverrideEnabled", - "label": "Override Gaps", + "section": "niriLayoutRadiusOverrideEnabled", + "label": "Override Corner Radius", "tabIndex": 37, "category": "Personalization", "keywords": [ "appearance", + "colors", + "colour", + "corner", + "corners", "custom", "customize", - "gap", - "gaps", - "margin", - "margins", + "look", "niri", "override", - "padding", - "panel", "personal", "personalization", - "spacing", - "statusbar", - "taskbar", - "topbar" + "radius", + "round", + "rounded", + "style", + "theme", + "window" ], - "description": "Use custom gaps instead of bar spacing" + "description": "Use custom window radius instead of theme radius" }, { "section": "hyprlandLayoutGapsOverrideEnabled", @@ -8740,6 +8668,32 @@ ], "description": "Use custom gaps instead of bar spacing" }, + { + "section": "niriLayoutGapsOverrideEnabled", + "label": "Override Gaps", + "tabIndex": 37, + "category": "Personalization", + "keywords": [ + "appearance", + "custom", + "customize", + "gap", + "gaps", + "margin", + "margins", + "niri", + "override", + "padding", + "panel", + "personal", + "personalization", + "spacing", + "statusbar", + "taskbar", + "topbar" + ], + "description": "Use custom gaps instead of bar spacing" + }, { "section": "hyprlandResizeOnBorder", "label": "Resize on Border", @@ -8763,29 +8717,6 @@ ], "description": "Resize windows by dragging their edges with the mouse" }, - { - "section": "niriLayoutRadiusOverride", - "label": "Window Corner Radius", - "tabIndex": 37, - "category": "Personalization", - "keywords": [ - "appearance", - "corner", - "corners", - "custom", - "customize", - "niri", - "override", - "personal", - "personalization", - "radius", - "round", - "rounded", - "window", - "windows" - ], - "description": "Rounded corners for windows" - }, { "section": "hyprlandLayoutRadiusOverride", "label": "Window Corner Radius", @@ -8835,25 +8766,27 @@ "description": "Rounded corners for windows" }, { - "section": "niriLayoutGapsOverride", - "label": "Window Gaps", + "section": "niriLayoutRadiusOverride", + "label": "Window Corner Radius", "tabIndex": 37, "category": "Personalization", "keywords": [ "appearance", - "between", + "corner", + "corners", "custom", "customize", - "gaps", "niri", "override", "personal", "personalization", - "space", + "radius", + "round", + "rounded", "window", "windows" ], - "description": "Space between windows" + "description": "Rounded corners for windows" }, { "section": "hyprlandLayoutGapsOverride", @@ -8898,6 +8831,27 @@ ], "description": "Space between windows" }, + { + "section": "niriLayoutGapsOverride", + "label": "Window Gaps", + "tabIndex": 37, + "category": "Personalization", + "keywords": [ + "appearance", + "between", + "custom", + "customize", + "gaps", + "niri", + "override", + "personal", + "personalization", + "space", + "window", + "windows" + ], + "description": "Space between windows" + }, { "section": "windowRules", "label": "Window Rules",